Skip to content

Captures of curried function are incorrectly dropped  #21620

Closed
@odersky

Description

@odersky

Compiler version

3.6.0

Minimized example

class C
def test(x: C^) =
  val f = () =>
    def foo() =
      x
      ()
    println(s"hey: $x")
    () => foo()
  val _: () -> () ->{x} Unit = f  // should be error, but compiles
  ()

Output

compiles

Expectation

An error, since the outer lambda also captures x in its println statement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    stat:needs triageEvery issue needs to have an "area" and "itype" label

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions