Skip to content

Compiler hangs instead of throwing error when expanding anonymous function #19334

Closed
@szymon-rd

Description

@szymon-rd

Compiler version

Hangs on 3.4.0-RC1-bin-20231223-938d405-NIGHTLY
Fails to compile on 3.3.0

Minimized code

//> using scala 3.4.0-RC1-bin-20231223-938d405-NIGHTLY

def foo[T](f: T): T = ???

@main
def main =
  foo {
    def f() = { }
    f(_)
  }

Output

On 3.4.0-RC1-bin-20231223-938d405-NIGHTLY:

Compiling project (Scala 3.4.0-RC1-bin-20231223-938d405-NIGHTLY, JVM)
<hangs forever>

On 3.3.0:

[error] ./Main.scala:9:7
[error] Missing parameter type
[error] 
[error] I could not infer the type of the parameter _$1 of expanded function:
[error] _$1 => f(_$1).
[error]     f(_)
[error]   

Expectation

Unsure, I don't know what change caused this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:reportingError reporting including formatting, implicit suggestions, etcitype:bugregressionThis worked in a previous version but doesn't anymore

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions