Skip to content

Broken rewrite for refutable pattern binding with type ascription #15313

@griggt

Description

@griggt

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions