Skip to content

Dotty 0.20.0-RC1 braceless match cases returning functions syntax error #7516

Closed
@j-mie6

Description

@j-mie6

minimized code

Previously it was possible for me to write this code:

val foo: Int => Int = Some(7) match
case Some(y) => x => x + y
case None => identity[Int]

But as of this new release, this gives an "Expected start of definition" error unless either a) you add braces, or b) you add brackets:

val foo: Int => Int = Some(7) match
{
case Some(y) => x => x + y
case None => identity[Int]
}
val foo: Int => Int = Some(7) match
case Some(y) => (x => x + y)
case None => identity[Int]

It doesn't matter if the indentation is aligned with the match or not, just as long as indentation is in use.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions