Skip to content

End on empty method returning Unit #12150

Closed
@nicolasstucki

Description

@nicolasstucki

Compiler version

3.0.0-RC2

Minimized code

def f: Unit =
  
end f

Output

2 |end f
  |^^^
  |postfix operator `f` needs to be enabled
  |by making the implicit value scala.language.postfixOps visible.
  |----
  |This can be achieved by adding the import clause 'import scala.language.postfixOps'
  |or by setting the compiler option -language:postfixOps.
  |See the Scaladoc for value scala.language.postfixOps for a discussion
  |why the feature needs to be explicitly enabled.

Expectation

Should compile or should have a better error message.

It feels like it should behave the same as

def f: Unit = {

}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions