New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closures in Closures don't work. #155

Closed
baroquebobcat opened this Issue Nov 6, 2011 · 7 comments

Comments

Projects
None yet
3 participants
@baroquebobcat
Member

baroquebobcat commented Nov 6, 2011

wrote a test case

# 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: <Mirah::InternalCompilerError>
        Message: <"undefined method `defining_class' for #<Mirah::AST::Block:0x2f267610>">
        ---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.

@baroquebobcat

This comment has been minimized.

Show comment
Hide comment
@baroquebobcat

baroquebobcat Jan 9, 2012

Member

This has been reported before #72

Member

baroquebobcat commented Jan 9, 2012

This has been reported before #72

@baroquebobcat

This comment has been minimized.

Show comment
Hide comment
@baroquebobcat
Member

baroquebobcat commented Feb 27, 2012

96a9074 fixes it!

@baroquebobcat

This comment has been minimized.

Show comment
Hide comment
@baroquebobcat

baroquebobcat Mar 6, 2012

Member

So, they still don't work. But they don't work in a new way.

Member

baroquebobcat commented Mar 6, 2012

So, they still don't work. But they don't work in a new way.

@nedgar

This comment has been minimized.

Show comment
Hide comment
@nedgar

nedgar Mar 6, 2012

Excellent! Made me lol.

nedgar commented Mar 6, 2012

Excellent! Made me lol.

@sshankar

This comment has been minimized.

Show comment
Hide comment
@sshankar

sshankar Mar 15, 2012

Contributor

@baroquebobcat can you provide an updated test case?

Contributor

sshankar commented Mar 15, 2012

@baroquebobcat can you provide an updated test case?

@baroquebobcat

This comment has been minimized.

Show comment
Hide comment
@baroquebobcat

baroquebobcat Mar 18, 2012

Member

I've got some ideas, but I won't be able to get back poking at them until next weekend. Part of the problem is that I'm trying to do some crazy things.

I think I have a partial solution, that fixes the simpler cases, but I'd like to dig in futher.

Member

baroquebobcat commented Mar 18, 2012

I've got some ideas, but I won't be able to get back poking at them until next weekend. Part of the problem is that I'm trying to do some crazy things.

I think I have a partial solution, that fixes the simpler cases, but I'd like to dig in futher.

@baroquebobcat

This comment has been minimized.

Show comment
Hide comment
@baroquebobcat

baroquebobcat Mar 5, 2013

Member

The new typer has fixed this apparently. updated test at e5f1c7d

Member

baroquebobcat commented Mar 5, 2013

The new typer has fixed this apparently. updated test at e5f1c7d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment