-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
117 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// scalac: -Werror -Xsource:3 | ||
//> using options -Werror -Xsource:3-X | ||
|
||
class Test { | ||
val b1 = { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// scalac: -Werror -Xsource:3 | ||
//> using options -Werror -Xsource:3-X | ||
|
||
class Test { | ||
val x = 42 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// scalac: -Werror -Xlint -Xsource:3 | ||
//> using options -Werror -Xlint -Xsource:3-X | ||
|
||
class Test { | ||
val x = 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
t7212b.scala:8: error: type mismatch; | ||
found : Object | ||
required: String | ||
val s: String = k.f | ||
^ | ||
t7212b.scala:14: error: type mismatch; | ||
found : Object | ||
required: String | ||
val s: String = f.f | ||
^ | ||
t7212b.scala:21: error: type mismatch; | ||
found : Object | ||
required: String | ||
val s: String = w.f | ||
^ | ||
t7212b.scala:5: warning: under -Xsource:3, inferred Object instead of String [quickfixable] | ||
class K extends T { def f = "" } | ||
^ | ||
t7212b.scala:11: warning: under -Xsource:3, inferred Object instead of String [quickfixable] | ||
class F extends T { val f = "" } | ||
^ | ||
t7212b.scala:17: warning: under -Xsource:3, inferred Object instead of String [quickfixable] | ||
trait V extends T { var f = "" } | ||
^ | ||
3 warnings | ||
3 errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
//> using options -Xmigration -Xsource:3-X | ||
|
||
trait T { def f: Object } | ||
class K extends T { def f = "" } | ||
object K { | ||
val k = new K | ||
val s: String = k.f | ||
} | ||
|
||
class F extends T { val f = "" } | ||
object F { | ||
val f = new F | ||
val s: String = f.f | ||
} | ||
|
||
trait V extends T { var f = "" } | ||
class W extends V | ||
object W { | ||
val w = new W | ||
val s: String = w.f | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// scalac: -deprecation -Xfatal-warnings | ||
//> using options -Werror -Xlint | ||
// | ||
object Foo { | ||
List(1,2,3).toSet() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// scalac: -Xsource:3 | ||
// scalac: -Xsource:3-X | ||
|
||
class K { def x(y: Int) = 0 } | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
// scalac: -Xsource:3 | ||
// scalac: -Xsource:3-X | ||
|
||
trait T { | ||
def f(x: Int): Boolean = | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//> using options -Werror -Xsource:3 | ||
|
||
// there is no warning even under -Xsource:3 about the future behavior | ||
class C { | ||
class X(parts: Any*) { | ||
def s(args: Any*) = "hello, old world" | ||
} | ||
object StringContext { | ||
def apply(parts: Any*) = new X(parts: _*) | ||
} | ||
def name = "Scala3" | ||
def test = s"hello, $name" | ||
} | ||
class D { | ||
import D.* | ||
class StringContext(parts: Any*) { | ||
def x(args: Any*) = "hello, old world" } | ||
object StringContext { | ||
def apply(parts: Any*) = new StringContext(parts: _*) | ||
} | ||
def name = "Scala3" | ||
def test = x"hello, $name" | ||
} | ||
object D { | ||
implicit class x(val sc: StringContext) extends AnyVal { | ||
def x(args: Any*) = "hello, world" | ||
} | ||
} | ||
object Test extends App { | ||
assert(new C().test == "hello, old world") | ||
assert(new D().test == "hello, old world") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters