-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
case of
integer matching does not work correctly for larger numbers
#8493
Comments
I suspect we are likely performing a |
Looking at sources confirms that to be the case: |
So applying the following patch Index: engine/runtime/src/main/java/org/enso/interpreter/node/controlflow/caseexpr/NumericLiteralBranchNode.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/controlflow/caseexpr/NumericLiteralBranchNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/controlflow/caseexpr/NumericLiteralBranchNode.java
--- a/engine/runtime/src/main/java/org/enso/interpreter/node/controlflow/caseexpr/NumericLiteralBranchNode.java (revision 2182072c7cad5725e3a5187e7c68e2ff02f03190)
+++ b/engine/runtime/src/main/java/org/enso/interpreter/node/controlflow/caseexpr/NumericLiteralBranchNode.java (revision 2ff98076e0244074a88ffdfa937d77413dc58442)
@@ -42,7 +42,7 @@
Object state,
Object target,
@CachedLibrary(limit = "1") InteropLibrary interop) {
- if (numProfile.profile(literal == target)) accept(frame, state, new Object[0]);
+ if (numProfile.profile(literal.equals(target))) accept(frame, state, new Object[0]);
}
@Fallback seems to fix the issue. @JaroslavTulach do you think that fix seems OK? I'm happy to integrate it as part of my PR for ticket #8352 as I need it there to fix HTTP status code translation. |
@radeusgd I'd rather we do it in a separate PR (as @JaroslavTulach mentioned, there are problems with native image build in that PR). |
Yes, For
Yes, this is not going to be straightforward fix. |
Okay. I guess I will be figuring out a workaround for my PR then, or will be waiting with integration until a fix. |
Repro:
Actual behaviour
It gives:
missing the 200 and 9999 branches.
Expected behaviour
The text was updated successfully, but these errors were encountered: