Skip to content

wrong error for method with name inline: inline must be followed by an if or a match #11860

Closed
@unkarjedy

Description

@unkarjedy

Compiler version

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

Minimized code

object SoftModifierTests {
  def main(args: Array[String]): Unit = {
    def inline(): Unit = println("do some work...")
    inline()
  }
}

Output

Error

`inline` must be followed by an `if` or a `match`
    inline()

Expectation

According to the spec https://dotty.epfl.ch/docs/reference/soft-modifier.html inline should be treated as a normal identifier:

  • it's not followed by if or match
  • it's not followed by parameter definition
  • it's not followed by hard modifier
  • it's not followed by class, trait, etc...
  • Everywhere else a soft keyword is treated as a normal identifier

and the code should compile

image

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