-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Star match with external capture fails #13844
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
we get the same error if we use the syntactically correct version, suggesting that val qs = Seq(2, 3)
Seq(1, 2, 3) match
case Seq(b, `qs` @ _*) => println("matched")
case Seq(b, vs @ _*) => println("missed") the following also fails, but syntactically this looks more like testing equality, so this behaviour seems ok to keep (it is also not allowed in 2.13): val qs = Seq(2, 3)
Seq(1, 2, 3) match
case Seq(b, `qs`*) => println("matched") // type mismatch of `qs`
case Seq(b, vs @ _*) => println("missed") this does not fail and binds val qs = Seq(2, 3)
Seq(1, 2, 3) match
case Seq(b, qs*) => println("matched")
case Seq(b, vs @ _*) => println("missed") |
Hmm I used the syntax shown in the pattern matching docs. I agree that |
I see, I thought this syntax was meant to be removed in #11240, instead it was made a warning when you import |
Compiler version
3.1.2-RC1-bin-20211027-435207d-NIGHTLY
Minimized code
Output
Expectation
Work the same as
The text was updated successfully, but these errors were encountered: