Give min and max the kind of their untyped arguments - #25
Merged
Conversation
…ator max(5, 4.0) has an untyped float type even though the integer wins, so max(5, 4.0) / 2 * 10 is 25 and not 20. A right shift count is bounded by a constant instead of the width of the value, which reaches the same result without measuring it. Tests cover every branch of the evaluator, including the error paths of each operand position, and the package is back to full statement coverage.
umputun
approved these changes
Aug 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #24, which merged one commit before this one.
max(5, 4.0)has an untyped float type even though the integer argument wins, somax(5, 4.0) / 2 * 10is 25 in Go while the evaluator computed 20: it returned the winning argument as an integer and divided as one. The result now takes the kind of the arguments, float when any of them is an untyped float.A right shift count is bounded by a constant rather than measured against the width of the value. Shifting further than the value is wide keeps giving the same result, so the bound reaches it without inspecting the operand, and
math/bigis no longer needed.The rest is tests. They cover the error path of every operand position, the declaration paths that are skipped, and the literal kinds that carry no value, which brings the package back to full statement coverage; it stands at 93.2% on master because the tests removed with the old evaluator were never replaced.