-
Notifications
You must be signed in to change notification settings - Fork 21
default argument desugaring does not properly deal with patterns #3353
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-3353?orig=1 |
@dubochet said: |
@paulp said: |
@lrytz said: Using default arguments in patterns is currently not supported, the fact that it's not disallowed for this extractor is rather a missed case, maybe we should disallow it for now. There's a whole space to explore on the interaction of named/default arguments and pattern matching. If we start doing this, we will end up with this kind of blocks during pattern matching (and btw, blocks don't need to have symbols). |
@magarciaEPFL said: Still crashing:
|
@adriaanm said: val argDummy = context.owner.newValue(nme.SELECTOR_DUMMY, fun.pos, SYNTHETIC) setInfo pt |
@adriaanm said (edited on Jan 29, 2013 1:01:14 AM UTC): {
val x$1: String = <unapply-selector>;
val x$2: Option[String] = TestingObject.this.Matcher.unapply$default$2(x$1);
TestingObject.this.Matcher.unapply(x$1)(x$2)
} should be {
val x$1: Option[String] = TestingObject.this.Matcher.unapply$default$1();
TestingObject.this.Matcher.unapply(<unapply-selector>)(x$1)
} |
@adriaanm said: |
@lrytz said: |
[extempore says: this is an intersection of implicit + default + unapply. If we let it get past the NPE (which is from a Block not having a symbol) we see what has happened:
There is nothing in place to deal with symbol-free Blocks popping up inside patterns.
Here's the class being compiled.
It compiles fine if an implicit val is defined in main().
Here's the error the compiler throws:
The text was updated successfully, but these errors were encountered: