Skip to content

parser: write binary numeric promotion as a chain of rules from the spec - #66

Merged
rameel merged 1 commit into
mainfrom
parser/simplify-binary-numeric-promotions
Nov 23, 2026
Merged

rameel merged 1 commit into
mainfrom
parser/simplify-binary-numeric-promotions

Conversation

@rameel

@rameel rameel commented Nov 23, 2026

Copy link
Copy Markdown
Owner

ApplyBinaryNumericPromotions looped over an array of seven types, allocated on every call, and handled decimal, ulong, and uint as special cases inside the loop.

This PR picks the promoted type with a chain of checks that follows the rules quoted in the method comment, in the same order.

No behavior change: the expression trees and error messages are the same for every pair of numeric types and their nullable forms with the arithmetic, bitwise, and comparison operators.

ApplyBinaryNumericPromotions looped over an array of seven types,
allocated on every call, and handled decimal, ulong, and uint as
special cases inside the loop. Pick the promoted type with a chain of
checks that follows the rules quoted in the method comment, in the
same order. No behavior change.
@rameel
rameel merged commit 67c2511 into main Nov 23, 2026
1 check passed
@rameel
rameel deleted the parser/simplify-binary-numeric-promotions branch November 23, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant