Skip to content
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

Issue 61: ICE with an empty block #110

Closed
consiliens opened this issue Aug 26, 2011 · 2 comments
Closed

Issue 61: ICE with an empty block #110

consiliens opened this issue Aug 26, 2011 · 2 comments
Assignees
Milestone

Comments

@consiliens
Copy link
Contributor

"
Reported by rogerpack2005, May 28, 2011
Run the following code:

import java.util.ArrayList

interface CallableOneArg do
  def call(arg1:Object):Object
  end
end

# should I make this class static? cache it [in a hash]?
class RubyInt < Object

  def times(call_me:CallableOneArg):Object
    self
  end

end

RubyInt.new.times do |n|

end

=> Mirah::InternalCompilerError: undefined method `each' for nil:NilClass

"

http://code.google.com/p/mirah/issues/detail?id=61

@ghost ghost assigned baroquebobcat Oct 16, 2011
@baroquebobcat
Copy link
Member

reproduced and looking into it.

@baroquebobcat
Copy link
Member

0a826dd fixes this.

The problem was that a Block with an empty body was being transformed into an AST node with a nil body.
The typer then checks the body to see if it contains any method definitions and if it does it appends them to the class representing the block.

The code was blowing up where it checked for children of the body because the body was nil. Now the body will be an AST node with no children.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants