Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9712 from som-snytt/issue/5606
- Loading branch information
Showing
14 changed files
with
123 additions
and
45 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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// scalac: -Xfatal-warnings | ||
// scalac: -Werror | ||
// | ||
|
||
import annotation._ | ||
|
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,16 @@ | ||
t5606.scala:3: error: identifier expected but '_' found. | ||
case class CaseTest[_](someData: String) | ||
^ | ||
t5606.scala:5: error: using `?` as a type name requires backticks. | ||
case class CaseTest_?[?](someData: String) | ||
^ | ||
t5606.scala:8: error: identifier expected but '_' found. | ||
case class CaseTest2[_, _](someData: String) | ||
^ | ||
t5606.scala:11: error: identifier expected but '_' found. | ||
def f[_](x: Int) = ??? | ||
^ | ||
t5606.scala:23: error: using `?` as a type name requires backticks. | ||
def regress_?[F[?]] = 2 | ||
^ | ||
5 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,26 @@ | ||
// scalac: -Xsource:3 | ||
// was: _ taken as ident of type param, but poor interactions below | ||
case class CaseTest[_](someData: String) | ||
|
||
case class CaseTest_?[?](someData: String) | ||
|
||
// was: _ already defined | ||
case class CaseTest2[_, _](someData: String) | ||
|
||
class C { | ||
def f[_](x: Int) = ??? | ||
} | ||
|
||
object Test extends App { | ||
def f0 = new CaseTest("X") | ||
def f1: CaseTest[Int] = new CaseTest[Int]("X") // OK! | ||
def f2: CaseTest[Int] = CaseTest[Int]("X") // CaseTest[Any] | ||
def f3 = new CaseTest[Int]("X").copy() // CaseTest[Any] | ||
def f4 = new CaseTest[Int]("X").copy[Int]() // CaseTest[Any] | ||
|
||
def regress0[F[_]] = 0 | ||
def regress1[F[_, _]] = 1 | ||
def regress_?[F[?]] = 2 | ||
//def regress0[F[_$$1]] = 0; | ||
//def regress1[F[_$$2, _$$3]] = 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
t5606b.scala:4: warning: Top-level wildcard is not allowed and will error under -Xsource:3 | ||
case class CaseTest[_](someData: String) | ||
^ | ||
t5606b.scala:7: warning: Top-level wildcard is not allowed and will error under -Xsource:3 | ||
case class CaseTest2[_, _](someData: String) | ||
^ | ||
t5606b.scala:7: warning: Top-level wildcard is not allowed and will error under -Xsource:3 | ||
case class CaseTest2[_, _](someData: String) | ||
^ | ||
t5606b.scala:10: warning: Top-level wildcard is not allowed and will error under -Xsource:3 | ||
def f[_](x: Int) = ??? | ||
^ | ||
error: No warnings can be incurred under -Werror. | ||
4 warnings | ||
1 error |
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,11 @@ | ||
// scalac: -Xlint -Werror | ||
// | ||
// was: _ taken as ident of type param, now a fresh name | ||
case class CaseTest[_](someData: String) | ||
|
||
// was: _ already defined, now a fresh name | ||
case class CaseTest2[_, _](someData: String) | ||
|
||
class C { | ||
def f[_](x: Int) = ??? | ||
} |
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,9 +1,9 @@ | ||
// was: _ taken as ident of type param, now a fresh name | ||
case class CaseTest[_](someData: String) | ||
|
||
// was: _ already defined, now a fresh name | ||
case class CaseTest2[_, _](someData: String) | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
case class CaseTest[_](someData:String) | ||
class C { | ||
def f[_](x: Int) = ??? | ||
} |