Skip to content

Commit

Permalink
Treat WithWarnings via dedicated @specialization
Browse files Browse the repository at this point in the history
  • Loading branch information
JaroslavTulach committed Jul 24, 2024
1 parent db669a6 commit e5def77
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -764,8 +764,7 @@ type Decimal
d = Decimal.new "2345.6"
d.to_integer
# => 2345
to_integer : Integer
to_integer self =
to_integer self -> Integer =
as_biginteger = self.big_decimal.toBigInteger
back_to_decimal = BigDecimal.new as_biginteger
are_equal = (self.big_decimal.compareTo back_to_decimal) == 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,17 @@ Object doWarning(WithWarnings value) {
return execute(value.getValue());
}

@Specialization(guards = {"!types.hasType(value)"})
static boolean isWithoutType(Object value, TypesLibrary types) {
if (value instanceof EnsoObject) {
return false;
}
if (types.hasType(value)) {
return false;
}
return true;
}

@Specialization(guards = {"isWithoutType(value, types)"})
Object withoutType(
Object value,
@Shared("interop") @CachedLibrary(limit = "3") InteropLibrary interop,
Expand Down

0 comments on commit e5def77

Please sign in to comment.