Skip to content
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

regression (since 2.9): pattern matcher chokes on invalid pattern with type parameter #7330

Closed
scabug opened this issue Apr 4, 2013 · 3 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Apr 4, 2013

Welcome to Scala version 2.10.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0-ea).

scala> class Y[T]; 0 match { case Y[_] => }
<console>:9: error: unsupported pattern: Y[_] (a class scala.reflect.internal.Trees$TypeTree).
 This is a scalac bug. Tree diagnostics: Y[_].
        0 match { case Y[_] => }
                        ^

"This is a scalac bug": when I say it, most often false; when scalac says it, guaranteed true!

the result in Scala version 2.11.0-20130322-102202-0acf87844e is the same.

2.9 says "class Y of type Y does not take type parameters", which is a correct-ish error to give though it doesn't help the naive user clear up the class vs. companion object confusion that probably made them write this. (what naive user? who, me? )

@scabug
Copy link
Author

scabug commented Apr 4, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7330?orig=1
Reporter: @SethTisue
Affected Versions: 2.10.1

@scabug
Copy link
Author

scabug commented Apr 4, 2013

@adriaanm said (edited on Apr 4, 2013 8:47:16 PM UTC):
Yes, a real error message would probably be more appropriate than scalac going all mea culpa.

@scabug
Copy link
Author

scabug commented Apr 4, 2013

@adriaanm said:
scala/scala#2358

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants