Skip to content

Commit be537d4

Browse files
author
Nicolas Laurent
committed
fix guard completeness in ToIntNode and ToLongNode
1 parent 0a5320e commit be537d4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/java/org/truffleruby/core/cast/ToIntNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ protected long coerceNil(Nil value) {
108108
coreExceptions().typeError("no implicit conversion from nil to integer", this));
109109
}
110110

111-
@Specialization(guards = { "!isRubyInteger(object)", "!isNil(object)" })
111+
@Specialization(guards = { "!isRubyInteger(object)", "!isDouble(object)", "!isNil(object)" })
112112
protected int coerceObject(Object object,
113113
@Cached CallDispatchHeadNode toIntNode,
114114
@Cached ToIntNode fitNode) {

src/main/java/org/truffleruby/core/cast/ToLongNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ protected long coerceNil(Nil nil) {
7878
coreExceptions().typeError("no implicit conversion from nil to integer", this));
7979
}
8080

81-
@Specialization(guards = { "!isRubyInteger(object)", "!isNil(object)" })
81+
@Specialization(guards = { "!isRubyInteger(object)", "!isDouble(object)", "!isNil(object)" })
8282
protected long coerceObject(Object object,
8383
@Cached CallDispatchHeadNode toIntNode,
8484
@Cached ToLongNode fitNode) {

0 commit comments

Comments
 (0)