From e5def777f7ea78fe4a2c8bdabe346ec08ca8e0e1 Mon Sep 17 00:00:00 2001 From: Jaroslav Tulach Date: Wed, 24 Jul 2024 08:21:12 +0200 Subject: [PATCH] Treat WithWarnings via dedicated @Specialization --- .../Standard/Base/0.0.0-dev/src/Data/Decimal.enso | 3 +-- .../runtime/library/dispatch/TypeOfNode.java | 12 +++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Decimal.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Decimal.enso index a14c9f9f65c7..90ab71dabc45 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Decimal.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Decimal.enso @@ -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 diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/library/dispatch/TypeOfNode.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/library/dispatch/TypeOfNode.java index a8393c9a279c..810134af8f34 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/library/dispatch/TypeOfNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/library/dispatch/TypeOfNode.java @@ -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,