-
Notifications
You must be signed in to change notification settings - Fork 21
Pattern matching and case classes with type parameters #5900
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
Comments
Imported From: https://issues.scala-lang.org/browse/SI-5900?orig=1 |
@adriaanm said (edited on Jun 13, 2012 8:53:00 AM UTC): (5) Convert constructors in a pattern as follows:
(5.1) If constructor refers to a case class factory, set tree's type to the unique
instance of its primary constructor that is a subtype of the expected type.
(5.2) If constructor refers to an extractor, convert to application of
unapply or unapplySeq method. |
@jrudolph said: https://groups.google.com/d/topic/scala-language/zihVwcwJR2Q/discussion |
@adriaanm said: The unapply and case class scenarios should behave in the same way. |
@adriaanm said: |
@adriaanm said (edited on Nov 22, 2013 10:14:00 PM UTC): scala> case class Transition[S](x: S) ; object C ; (??? : Any) match { case Transition(C) => }
<console>:11: error: pattern type is incompatible with expected type;
found : C.type
required: S
(??? : Any) match { case Transition(C) => }
^ |
@adriaanm said: scala-hash is missing a build or two around the critical area, but is in:
* acd7780 Merge pull request #3014 from ceedubs/pr/implicitNotFound-scaladoc
|\
| * 9835d33 Describe type parameter interpolation in @implicitNotFound documentation
* | 90a3126 Merge pull request #3005 from paulp/pr/7886
|\ \
| * | 5708e9d SI-6680 unsoundness in gadt typing.
| * | 95d5554 SI-7886 unsoundness in pattern matcher. |
@retronym said: https://github.com/retronym/scala/compare/ticket/5900?expand=1 |
@retronym said: |
@adriaanm said: |
@retronym said: I'd rather not ship a change to pattern inference only to change it again when we fix this for real. I'm marking as 2.11.0 again and will followup tomorrow with a patch. |
@adriaanm said: |
@retronym said (edited on Feb 11, 2014 10:35:32 PM UTC): |
@retronym said: |
@adriaanm said: |
@adriaanm said: |
@milessabin said: |
fails to compile with
The error goes away using a hand-crafted
unapply
method:The text was updated successfully, but these errors were encountered: