mirah/mirah — Issue #155: Closures in Closures don't work.
Author: baroquebobcat
Created: 2011-11-06 23:24:27+00:00
State: open

wrote a test case

```mirah
# test/jvm/test_blocks.rb
def test_closure_in_closure_doesnt_raise_error
assert_nothing_raised do
parse_and_type(<<-CODE)
interface Bar do;def run:void;end;end

class Foo
def foo(a:Bar)
1
end
end
Foo.new.foo do
Foo.new.foo do
1
end
end
CODE
end
end
```

gets you

```
Class:
Message: <"undefined method `defining_class' for #">
---Backtrace---
/Users/nick/hacking/fresh_mirah/lib/mirah/ast/structure.rb:150:in `prepare'
/Users/nick/hacking/fresh_mirah/lib/mirah/ast/call.rb:200:in `infer'
```

the problem is that while the parent of the method definition of the closure is reset to the closure class, the scope somehow is still the block and not the new class for the outer closure.