From 1f23d83774ace1bd3aa5cde268c5ed4711555138 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Sat, 15 Apr 2023 22:55:19 +0200 Subject: [PATCH] Invalid comparison throws Incomparable_Values rather than Type_Error --- .../expression/builtin/number/bigInteger/GreaterNode.java | 4 ++-- .../builtin/number/bigInteger/GreaterOrEqualNode.java | 4 ++-- .../node/expression/builtin/number/bigInteger/LessNode.java | 4 ++-- .../expression/builtin/number/bigInteger/LessOrEqualNode.java | 4 ++-- .../node/expression/builtin/number/decimal/GreaterNode.java | 4 ++-- .../expression/builtin/number/decimal/GreaterOrEqualNode.java | 4 ++-- .../node/expression/builtin/number/decimal/LessNode.java | 4 ++-- .../expression/builtin/number/decimal/LessOrEqualNode.java | 4 ++-- .../expression/builtin/number/smallInteger/GreaterNode.java | 4 ++-- .../builtin/number/smallInteger/GreaterOrEqualNode.java | 4 ++-- .../node/expression/builtin/number/smallInteger/LessNode.java | 4 ++-- .../builtin/number/smallInteger/LessOrEqualNode.java | 4 ++-- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/bigInteger/GreaterNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/bigInteger/GreaterNode.java index 963c004ec802..46afcca0b24d 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/bigInteger/GreaterNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/bigInteger/GreaterNode.java @@ -36,7 +36,7 @@ boolean doBigInteger(EnsoBigInteger self, EnsoBigInteger that) { @Fallback DataflowError doOther(EnsoBigInteger self, Object that) { var builtins = EnsoContext.get(this).getBuiltins(); - var typeError = builtins.error().makeTypeError(builtins.number().getNumber(), that, "that"); - return DataflowError.withoutTrace(typeError, this); + var incomparableValsErr = builtins.error().makeIncomparableValues(self, that); + return DataflowError.withoutTrace(incomparableValsErr, this); } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/bigInteger/GreaterOrEqualNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/bigInteger/GreaterOrEqualNode.java index c615457d1a15..099ad9eee91e 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/bigInteger/GreaterOrEqualNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/bigInteger/GreaterOrEqualNode.java @@ -36,7 +36,7 @@ boolean doBigInteger(EnsoBigInteger self, EnsoBigInteger that) { @Fallback DataflowError doOther(EnsoBigInteger self, Object that) { var builtins = EnsoContext.get(this).getBuiltins(); - var typeError = builtins.error().makeTypeError(builtins.number().getNumber(), that, "that"); - return DataflowError.withoutTrace(typeError, this); + var incomparableValsErr = builtins.error().makeIncomparableValues(self, that); + return DataflowError.withoutTrace(incomparableValsErr, this); } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/bigInteger/LessNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/bigInteger/LessNode.java index 71e4a55e74ac..4fd6e79522f2 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/bigInteger/LessNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/bigInteger/LessNode.java @@ -36,7 +36,7 @@ boolean doBigInteger(EnsoBigInteger self, EnsoBigInteger that) { @Fallback DataflowError doOther(EnsoBigInteger self, Object that) { var builtins = EnsoContext.get(this).getBuiltins(); - var typeError = builtins.error().makeTypeError(builtins.number().getNumber(), that, "that"); - return DataflowError.withoutTrace(typeError, this); + var incomparableValsErr = builtins.error().makeIncomparableValues(self, that); + return DataflowError.withoutTrace(incomparableValsErr, this); } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/bigInteger/LessOrEqualNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/bigInteger/LessOrEqualNode.java index 5fd408ba79f7..a3131c803cb2 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/bigInteger/LessOrEqualNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/bigInteger/LessOrEqualNode.java @@ -36,7 +36,7 @@ boolean doBigInteger(EnsoBigInteger self, EnsoBigInteger that) { @Fallback DataflowError doOther(EnsoBigInteger self, Object that) { var builtins = EnsoContext.get(this).getBuiltins(); - var typeError = builtins.error().makeTypeError(builtins.number().getNumber(), that, "that"); - return DataflowError.withoutTrace(typeError, this); + var incomparableValsErr = builtins.error().makeIncomparableValues(self, that); + return DataflowError.withoutTrace(incomparableValsErr, this); } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/decimal/GreaterNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/decimal/GreaterNode.java index cf1d301edb4d..d01ba71977cf 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/decimal/GreaterNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/decimal/GreaterNode.java @@ -36,7 +36,7 @@ boolean doBigInteger(double self, EnsoBigInteger that) { @Fallback DataflowError doOther(double self, Object that) { var builtins = EnsoContext.get(this).getBuiltins(); - var typeError = builtins.error().makeTypeError(builtins.number().getNumber(), that, "that"); - return DataflowError.withoutTrace(typeError, this); + var incomparableValsErr = builtins.error().makeIncomparableValues(self, that); + return DataflowError.withoutTrace(incomparableValsErr, this); } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/decimal/GreaterOrEqualNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/decimal/GreaterOrEqualNode.java index 00683e4cf399..3409b9821f30 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/decimal/GreaterOrEqualNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/decimal/GreaterOrEqualNode.java @@ -36,7 +36,7 @@ boolean doBigInteger(double self, EnsoBigInteger that) { @Fallback DataflowError doOther(double self, Object that) { var builtins = EnsoContext.get(this).getBuiltins(); - var typeError = builtins.error().makeTypeError(builtins.number().getNumber(), that, "that"); - return DataflowError.withoutTrace(typeError, this); + var incomparableValsErr = builtins.error().makeIncomparableValues(self, that); + return DataflowError.withoutTrace(incomparableValsErr, this); } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/decimal/LessNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/decimal/LessNode.java index 914f28259971..c8526c3cf33f 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/decimal/LessNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/decimal/LessNode.java @@ -36,7 +36,7 @@ boolean doBigInteger(double self, EnsoBigInteger that) { @Fallback DataflowError doOther(double self, Object that) { var builtins = EnsoContext.get(this).getBuiltins(); - var typeError = builtins.error().makeTypeError(builtins.number().getNumber(), that, "that"); - return DataflowError.withoutTrace(typeError, this); + var incomparableValsErr = builtins.error().makeIncomparableValues(self, that); + return DataflowError.withoutTrace(incomparableValsErr, this); } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/decimal/LessOrEqualNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/decimal/LessOrEqualNode.java index 9e58ffed5818..2fa12b139739 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/decimal/LessOrEqualNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/decimal/LessOrEqualNode.java @@ -36,7 +36,7 @@ boolean doBigInteger(double self, EnsoBigInteger that) { @Fallback DataflowError doOther(double self, Object that) { var builtins = EnsoContext.get(this).getBuiltins(); - var typeError = builtins.error().makeTypeError(builtins.number().getNumber(), that, "that"); - return DataflowError.withoutTrace(typeError, this); + var incomparableValsErr = builtins.error().makeIncomparableValues(self, that); + return DataflowError.withoutTrace(incomparableValsErr, this); } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/smallInteger/GreaterNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/smallInteger/GreaterNode.java index e444e925bac4..73d4899f0ff7 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/smallInteger/GreaterNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/smallInteger/GreaterNode.java @@ -35,7 +35,7 @@ boolean doBigInteger(long self, EnsoBigInteger that) { @Fallback DataflowError doOther(long self, Object that) { var builtins = EnsoContext.get(this).getBuiltins(); - var typeError = builtins.error().makeTypeError(builtins.number().getNumber(), that, "that"); - return DataflowError.withoutTrace(typeError, this); + var incomparableValsErr = builtins.error().makeIncomparableValues(self, that); + return DataflowError.withoutTrace(incomparableValsErr, this); } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/smallInteger/GreaterOrEqualNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/smallInteger/GreaterOrEqualNode.java index dcb316b7ff6d..9f32e168d03a 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/smallInteger/GreaterOrEqualNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/smallInteger/GreaterOrEqualNode.java @@ -35,7 +35,7 @@ boolean doBigInteger(long self, EnsoBigInteger that) { @Fallback DataflowError doOther(long self, Object that) { var builtins = EnsoContext.get(this).getBuiltins(); - var typeError = builtins.error().makeTypeError(builtins.number().getNumber(), that, "that"); - return DataflowError.withoutTrace(typeError, this); + var incomparableValsErr = builtins.error().makeIncomparableValues(self, that); + return DataflowError.withoutTrace(incomparableValsErr, this); } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/smallInteger/LessNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/smallInteger/LessNode.java index 2bf8362b6ee3..cbeef290bc2e 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/smallInteger/LessNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/smallInteger/LessNode.java @@ -35,7 +35,7 @@ boolean doBigInteger(long self, EnsoBigInteger that) { @Fallback DataflowError doOther(long self, Object that) { var builtins = EnsoContext.get(this).getBuiltins(); - var typeError = builtins.error().makeTypeError(builtins.number().getNumber(), that, "that"); - return DataflowError.withoutTrace(typeError, this); + var incomparableValsErr = builtins.error().makeIncomparableValues(self, that); + return DataflowError.withoutTrace(incomparableValsErr, this); } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/smallInteger/LessOrEqualNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/smallInteger/LessOrEqualNode.java index e74a28297f9d..1cd5c643b3ad 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/smallInteger/LessOrEqualNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/number/smallInteger/LessOrEqualNode.java @@ -35,7 +35,7 @@ boolean doBigInteger(long self, EnsoBigInteger that) { @Fallback DataflowError doOther(long self, Object that) { var builtins = EnsoContext.get(this).getBuiltins(); - var typeError = builtins.error().makeTypeError(builtins.number().getNumber(), that, "that"); - return DataflowError.withoutTrace(typeError, this); + var incomparableValsErr = builtins.error().makeIncomparableValues(self, that); + return DataflowError.withoutTrace(incomparableValsErr, this); } }