effekt icon indicating copy to clipboard operation
effekt copied to clipboard

Incorrect captures for interface operations with block parameters

Open marzipankaiser opened this issue 5 months ago • 3 comments

In the following example, the captures are annotated as indicated in the comments:

interface Bar {
  def bar(): Unit
}
interface Foo {
  def foo(){b: Bar}: Unit
}

// {b}
def baz() = {
  // {b}
  def x = new Foo { 
    def foo(){b} = { b.bar() }
  }
  // {}
  def b2 = new Bar { def bar() = () }
  x.foo{b2}
}

// {}
def foof(){b: Bar} = b.bar()

// {b}
def main() = {
  baz()
}

Here, the capture for x contains b, which is not even in scope outside of the definition of foo. (This is also inconsistent with the captures of foof).

marzipankaiser avatar Sep 24 '24 11:09 marzipankaiser