effekt
effekt copied to clipboard
Incorrect captures for interface operations with block parameters
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
).