Skip to content

Commit 5522b6a

Browse files
committed
[GR-19220] Use the owner module instead of origin with UnboundMethod#{inspect,==} (#3437)
PullRequest: truffleruby/4163
2 parents 061ab63 + 0d703c3 commit 5522b6a

File tree

6 files changed

+3
-18
lines changed

6 files changed

+3
-18
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Compatibility:
4848
* Support `connect_timeout` keyword argument to `TCPSocket.{new,open}` (#3421, @manefz, @patricklinpl, @nirvdrum, @rwstauner).
4949
* Add `File.lutime` and `Pathname#lutime` methods (#3039, @andrykonchin).
5050
* Add a deprecation warning for `Encoding#replicate` (#3039, @patricklinpl, @manefz, @nirvdrum).
51+
* Change `UnboundMethod#{==,inspect}` to use the owner module rather than the origin (#3039, @rwstauner, @manefz, @patricklinpl)
5152

5253
Performance:
5354

spec/tags/core/unboundmethod/equal_value_tags.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

spec/tags/core/unboundmethod/inspect_tags.txt

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

spec/tags/core/unboundmethod/to_s_tags.txt

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

src/main/java/org/truffleruby/core/method/UnboundMethodNodes.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ public abstract static class EqualNode extends CoreMethodArrayArgumentsNode {
5252

5353
@Specialization
5454
boolean equal(RubyUnboundMethod self, RubyUnboundMethod other) {
55-
return self.origin == other.origin &&
56-
MethodNodes.areInternalMethodEqual(self.method, other.method);
55+
return MethodNodes.areInternalMethodEqual(self.method, other.method);
5756
}
5857

5958
@Specialization(guards = "!isRubyUnboundMethod(other)")
@@ -134,16 +133,6 @@ RubySymbol name(RubyUnboundMethod unboundMethod) {
134133

135134
}
136135

137-
@Primitive(name = "unbound_method_origin")
138-
public abstract static class OriginNode extends PrimitiveArrayArgumentsNode {
139-
140-
@Specialization
141-
RubyModule origin(RubyUnboundMethod unboundMethod) {
142-
return unboundMethod.origin;
143-
}
144-
145-
}
146-
147136
@CoreMethod(names = "original_name")
148137
public abstract static class OriginalNameNode extends CoreMethodArrayArgumentsNode {
149138

src/main/ruby/truffleruby/core/unbound_method.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class UnboundMethod
1212
def inspect
13-
Truffle::MethodOperations.inspect_method(self, Primitive.unbound_method_origin(self), owner)
13+
Truffle::MethodOperations.inspect_method(self, owner, owner)
1414
end
1515
alias_method :to_s, :inspect
1616

0 commit comments

Comments
 (0)