Skip to content

indentation region after return keyword is not recognized #11802

Closed
@unkarjedy

Description

@unkarjedy

Compiler version

3.0.0-RC2-bin-20210317-758782a-NIGHTLY

Minimized code

def bar2: Int = {
  println(1)
  println(2)
  return
    var x = 1
    var y = 1
    x + y
}

bar2

Output

return              
^^^^^^              
Found:    Unit      
Required: Int       

image

Expectation

According to:
http://dotty.epfl.ch/docs/reference/other-new-features/indentation.html#optional-braces

... an indentation region can start ... after one of the following tokens:
... return ...

So the code should compile, or the reference should be adjusted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions