Skip to content
This repository has been archived by the owner on Mar 26, 2023. It is now read-only.

when inheriting from nonclass an error is thrown #308

Merged
merged 1 commit into from
Mar 1, 2014

Conversation

niccokunzmann
Copy link

class X < 1 # some object that is not a class
end

now creates the

TypeError: wrong argument type Fixnum. expected a class.

instead of the former

NoMethodError: a MessageNotUnderstood occurred (error 2010), a SmallInteger does not understand  #'newRubySubclass:instancesPersistent:fixedIvs:'

The specs do not test this case in spec/rubyspec/core/class/new_spec.rb. They test Class.new which raises a TypeError.

lambda { Class.new("")         }.should raise_error(TypeError)
lambda { Class.new(1)          }.should raise_error(TypeError)
lambda { Class.new(:symbol)    }.should raise_error(TypeError)
lambda { Class.new(mock('o'))  }.should raise_error(TypeError)
lambda { Class.new(Module.new) }.should raise_error(TypeError)

I did not find other specs that test my code directly.

@timfel
Copy link
Member

timfel commented May 6, 2013

needs test

timfel added a commit that referenced this pull request Mar 1, 2014
…nclass

when inheriting from nonclass an error is thrown
@timfel timfel merged commit 73afce5 into master-1.9 Mar 1, 2014
@timfel timfel deleted the niccokunzmann/inheritence_from_nonclass branch March 1, 2014 08:43
timfel added a commit that referenced this pull request Mar 1, 2014
johnnyt added a commit that referenced this pull request Mar 1, 2014
* master:
  add test for #308
  when inheriting from nonclass an error is thrown
  method Object>>_nameForMethodMissing returns now 'Unknown', if name was nil. produces readable error messages, if method missing
johnnyt added a commit that referenced this pull request Mar 1, 2014
* master:
  add test for #308
  when inheriting from nonclass an error is thrown
  method Object>>_nameForMethodMissing returns now 'Unknown', if name was nil. produces readable error messages, if method missing
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants