-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Quote pattern spliced expression has wrong type #6999
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
Also note the compiler crash described in #6997 when trying to cast, I think these two can be different issues |
Actually the issue is type avoidance which seems to do exactly what it should. val $1$: (scala.quoted.Expr[Any], scala.quoted.Type[_]) = e:quoted.Expr[Any](e) @unchecked match { ... }
val x: scala.quoted.Expr[Any] = $1$._1
val t: scala.quoted.Type[_] = $1$._2
'{ ... } The correct way to express this is to write the complete pattern match e match {
case '{ $x: $t } =>
'{ val a: $t = $x }
} |
With new syntax it is possible to unpack on one line e match case '{ $x: $t } =>
'{ val a: $t = $x } |
The best we can do is to emit an error if a |
Fix #6999: Emit an error when using type splice in quoted val pattern
minimized code
expectation
x
should have typequoted.Expr[t.T]
The text was updated successfully, but these errors were encountered: