Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
NameError is thrown by method_missing when using self #872
Here's an example
class Bug def method_missing(meth, *args, &block) super rescue NoMethodError puts "Catched Error!" args.first end def set_bug_type self.bug_type = 2 end end Bug.new.bug_type = 1 Bug.new.set_bug_type
The expected output is (that's what I get in MRI 1.9.x):
The actual output is:
This is happening using both JRuby 1.7.3 and 1.7.4.
The relationship between NoMethodError and NameError is a little weird. In general I'd recommend sticking to NameError for these things, since depending on how something's parsed it might be one or the other.
That said, this appears to be specific to attribute assignment (and possible access), since we do the right thing for normal calls:
Fixed! We appear to match MRI for a full range of call types now: