New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
report error when using wildcard for top-level type parameter name #5606
Comments
Imported From: https://issues.scala-lang.org/browse/SI-5606?orig=1 |
@adriaanm said: |
@adriaanm said: |
@paulp said:
|
@som-snytt said: In the real world, there are many behaviors that are degenerate but not illegal, or no longer illegal, except in certain states of the Union where they frown on that sort of thing. (For instance, buying beer on Sunday.) I took a quick look, and the example The spec says that the motivation for the shorthand One use case for top-level I have to come up with symbols? Couldn't the compiler just make me a symbol? So I don't have to remember if we prefer Another use case is where a type param is deprecated because improvements in type inference make it superfluous. trait T[@deprecated("I'm free","2.11") _, B <: S[_]] Then, hypothetically, one could warn on usage of Just thinking aloud. |
@paulp said: |
@retronym said: ~/code/scala2 scala210
Welcome to Scala version 2.10.0-20121024-085118-2c554249fd (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_27).
Type in expressions to have them evaluated.
Type :help for more information.
scala> case class CaseTest[_](someData:String)
defined class CaseTest
scala> new CaseTest[Int]("").copy()
res0: CaseTest[Any] = CaseTest()
scala> case class CaseTest[A](someData:String)
defined class CaseTest
scala> new CaseTest[Int]("").copy()
res1: CaseTest[Nothing] = CaseTest()
scala> case class CaseTest[_](someData:String)
defined class CaseTest
scala> new CaseTest[Int]("").copy[Int]()
res2: CaseTest[Any] = CaseTest()
scala> case class CaseTest[A](someData:String)
defined class CaseTest
scala> new CaseTest[Int]("").copy[Int]()
res3: CaseTest[Int] = CaseTest()
scala> case class CaseTest[_](someData:String)
defined class CaseTest
scala> val x = CaseTest[Int]("")
x: CaseTest[Any] = CaseTest()
scala> x.copy
def copy[_](someData: String): CaseTest[Any] I figured I'd be able to trip up Value Classes with this, but while we can generate some funny looking signatures, they seem to go unnoticed. scala> class CCC[_](val value: String) extends AnyVal { def foo[_]: Option[`_`] = None }
...
final def foo$extension[_ >: Nothing <: Any, _ >: Nothing <: Any]($this: CCC[_]): Option[Any] = scala.None; That sort of signature comes up without the _, of course, but seems to be innocuous as everything is symful by that stage. scala> class C[A](val value: String) extends AnyVal { def foo[A] = this }
...
final def foo$extension[A >: Nothing <: Any, A >: Nothing <: Any]($this: C[A]): C[A] = $this; |
@SethTisue Since the code in the original example already compiles (so there is no longer a compiler crash) and there already is a |
It doesn't crash, but retronym's |
The PR emits fresh names for underscore but with deprecation, and error under |
I am able to crash the compiler with the following code:
The error is the following:
(I really hope I was supposed to issue this as a bug, first time ever I do this kind of thing. If I shouldnt, I am very sorry for the inconvenience)
The text was updated successfully, but these errors were encountered: