Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 010342ac4da9
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8a49a9c046b6
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Dec 31, 2014

  1. Add failing spec for distinguishing between a vcall and method when m…

    …issing.
    
    (Missing method => NoMethodError, missing vcall => NameError)
    Demonstrates issue #3101.
    jemc committed Dec 31, 2014

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    bda83a2 View commit details
  2. Correctly distinguish between a vcall and method when missing.

    (Missing method => NoMethodError, missing vcall => NameError)
    Fixes #3101.
    jemc committed Dec 31, 2014
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8a49a9c View commit details
Showing with 15 additions and 5 deletions.
  1. +14 −5 spec/ruby/language/send_spec.rb
  2. +1 −0 vm/builtin/call_site.cpp
19 changes: 14 additions & 5 deletions spec/ruby/language/send_spec.rb
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@
end
end

describe "with only manditory arguments" do
describe "with only mandatory arguments" do
it "requires exactly the same number of passed values" do
specs.fooM1(1).should == [1]
specs.fooM2(1,2).should == [1,2]
@@ -58,12 +58,12 @@
end
end

describe "with manditory and optional arguments" do
describe "with mandatory and optional arguments" do
it "uses the passed values in left to right order" do
specs.fooM1O1(2).should == [2,1]
end

it "raises an ArgumentError if there are no values for the manditory args" do
it "raises an ArgumentError if there are no values for the mandatory args" do
lambda {
specs.fooM1O1
}.should raise_error(ArgumentError)
@@ -187,12 +187,21 @@ def foobar; 200; end
end

describe "when the method is not available" do
it "invokes method_missing" do
it "invokes method_missing if it is defined" do
o = LangSendSpecs::MethodMissing.new
o.not_there(1,2)
o.message.should == :not_there
o.args.should == [1,2]
end

it "raises NameError if invoked as a vcall" do
lambda { no_such_method }.should raise_error NameError
end

it "raises NoMethodError if invoked as an unambiguous method call" do
lambda { no_such_method() }.should raise_error NoMethodError
lambda { no_such_method(1,2,3) }.should raise_error NoMethodError
end
end

end
@@ -242,7 +251,7 @@ def foobar; 200; end
end
end

describe "with manditory arguments after optional arguments" do
describe "with mandatory arguments after optional arguments" do
it "binds the required arguments first" do
specs.fooO1Q1(0,1).should == [0,1]
specs.fooO1Q1(2).should == [1,2]
1 change: 1 addition & 0 deletions vm/builtin/call_site.cpp
Original file line number Diff line number Diff line change
@@ -139,6 +139,7 @@ namespace rubinius {
Dispatch dis(call_site->name());

if(!dis.resolve(state, call_site->name(), lookup)) {
dis.method_missing = eVCall;
if(!lookup_method_missing(state, call_frame, args,
dis, call_frame->self(), recv->lookup_begin(state))) {
return NULL;