Skip to content

Commit 82d2961

Browse files
committed
[GR-19220] Fix last super spec (#2104)
PullRequest: truffleruby/1994
2 parents e68afb3 + c3f94fe commit 82d2961

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Compatibility:
3434
* Implement `rb_ivar_count`.
3535
* Implemented `rb_yield_values2`.
3636
* Implemented `Digest::Base#{update, <<}` (#2100).
37+
* Pass the final `super` specs (#2104, @chrisseaton).
3738

3839
Performance:
3940

spec/tags/language/super_tags.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/main/java/org/truffleruby/language/supercall/ReadZSuperArgumentsNode.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved. This
2+
* Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. This
33
* code is released under a tri EPL/GPL/LGPL license. You can use it,
44
* redistribute it and/or modify it under the terms of the:
55
*
@@ -9,6 +9,7 @@
99
*/
1010
package org.truffleruby.language.supercall;
1111

12+
import com.oracle.truffle.api.profiles.ConditionProfile;
1213
import org.truffleruby.core.array.ArrayToObjectArrayNode;
1314
import org.truffleruby.core.array.ArrayToObjectArrayNodeGen;
1415
import org.truffleruby.core.array.ArrayUtils;
@@ -28,6 +29,7 @@ public class ReadZSuperArgumentsNode extends RubyContextSourceNode {
2829
@Child private ArrayToObjectArrayNode unsplatNode;
2930

3031
private final int restArgIndex;
32+
private final ConditionProfile isArrayProfile = ConditionProfile.create();
3133

3234
public ReadZSuperArgumentsNode(int restArgIndex, RubyNode[] reloadNodes) {
3335
this.restArgIndex = restArgIndex;
@@ -48,7 +50,14 @@ public final Object execute(VirtualFrame frame) {
4850

4951
if (restArgIndex != -1) {
5052
final Object restArg = superArguments[restArgIndex];
51-
final Object[] restArgs = unsplat((RubyArray) restArg);
53+
54+
final Object[] restArgs;
55+
if (isArrayProfile.profile(restArg instanceof RubyArray)) {
56+
restArgs = unsplat((RubyArray) restArg);
57+
} else {
58+
restArgs = new Object[]{ restArg };
59+
}
60+
5261
final int after = superArguments.length - (restArgIndex + 1);
5362
Object[] splattedArguments = ArrayUtils.copyOf(superArguments, superArguments.length + restArgs.length - 1);
5463
ArrayUtils.arraycopy(

test/mri/excludes/TestSuper.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@
77
exclude :test_double_include2, "needs investigation"
88
exclude :test_from_eval, "needs investigation"
99
exclude :test_super_in_BEGIN, "needs investigation"
10-
exclude :test_super_with_modified_rest_parameter, "needs investigation"

0 commit comments

Comments
 (0)