-
Notifications
You must be signed in to change notification settings - Fork 448
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
Fix js ouput of bigint max, min #7088
Conversation
Since there were no tests for max and min, it seems we were unable to identify issues during testing. Therefore, I have added the necessary tests. |
jscomp/core/lam_compile_primitive.ml
Outdated
@@ -416,7 +416,7 @@ let translate output_prefix loc (cxt : Lam_compile_context.t) | |||
| _ -> assert false) | |||
| Pbigintmax -> ( | |||
match args with | |||
| [ { expression_desc = Number (Float _) } as a; { expression_desc = Number (Float _) } as b ] | |||
| [ { expression_desc = Number (BigInt _) } as a; { expression_desc = Number (BigInt _) } as b ] | |||
when Js_analyzer.is_okay_to_duplicate a && Js_analyzer.is_okay_to_duplicate b -> | |||
E.econd (E.js_comp Cgt a b) a b |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use E.bigint_comp
here should improve the outputs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks. 77a4630
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm ok E.econd
itself doesn't seem to be optimized enough yet
This PR fixes the issue where max, min operations generate js ouput incorrectly. It is described in the related issue #7062 (comment)