Skip to content

Eta expansion val f = mymethod (i.e., no applied argument lists) shows spurious error about trailing "_" #11311

Closed
@deanwampler

Description

@deanwampler

Compiler version

scala 3.0.0-M3

Minimized code

In the REPL, try this:

def cat1(s1: String)(s2: String) = s1 + s2
val fcat1 = cat1

Output

1 |val fcat1 = cat1
  |            ^^^^
  |            The syntax `<function> _` is no longer supported;
  |            you can simply leave out the trailing ` _`

By accident, I noticed you get exactly the same error message if you type def fcat1 = cat1.

Expectation

It accepts the definition of fcat1, as described in the automatic eta expansion docs, https://dotty.epfl.ch/docs/reference/changed-features/eta-expansion.html

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