-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Compiler crash with custom unapply
method
#22550
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
This issue was picked for the Scala Issue Spree of tomorrow, Monday, February 24th. @SethTisue, @kyouko-taiga and @mbovel will be working on it. If you have any insight into the issue or guidance on how to fix it, please leave it here. |
Minimized to: object Matches:
def unapply(y: Any)[T]: Option[Any] = None
def main =
42 match
case Matches(x) => println(x) However, moving the type parameter makes is compile: object Matches:
def unapply[T](y: Any): Option[Any] = None
def main =
42 match
case Matches(x) => println(x) |
Error case: TypeApply(Apply(Select(Ident(Matches),unapply),List(Literal(Constant(null)))),List(TypeTree[TypeVar(TypeParamRef(T))])) Happy case:
|
@Sporarum do you think that should be accepted? 😄 The problem is that the |
Martin thinks that we should not support type parameters after parameter lists for |
For me the question resides in: If they are not useful, there's no need to support this pattern If they are useful (and have no good alternatives), then we should support this feature Regardless, the compiler should not crash ^^" |
Compiler version
3.6.2, 3.6.3 NEXT
Minimized code
scastie: https://scastie.scala-lang.org/road21/zxQttu6JT4qdQWgloptmGA/7
Output (click arrow to expand)
The text was updated successfully, but these errors were encountered: