Skip to content

Broken rewrite for refutable pattern binding with type ascription #15313

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

Closed
griggt opened this issue May 29, 2022 · 0 comments · Fixed by #15314
Closed

Broken rewrite for refutable pattern binding with type ascription #15313

griggt opened this issue May 29, 2022 · 0 comments · Fixed by #15314
Assignees
Milestone

Comments

@griggt
Copy link
Contributor

griggt commented May 29, 2022

Compiler version

3.2.0-RC1-bin-20220527-001bfc3-NIGHTLY

Minimized code

val (_: Int | _: AnyRef) = ??? : AnyRef

When compiled with -source 3.2-migration -rewrite the result is

val (_: Int | _: AnyRef) = ??? : AnyRef: @unchecked

which is syntactically invalid.

Output

-- Error: test.scala:1:39 ------------------------------------------------------
1 |val (_: Int | _: AnyRef) = ??? : AnyRef: @unchecked
  |                                       ^
  |                         end of toplevel definition expected but ':' found

Expectation

Rewrite should add parentheses as required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants