fix(ecmascript): avoid numeric `+` folding when an operand may be a string
Merged
CA
1mo ago+70+70+01234567890123456789-25-25-01234567890123456789
Summary
The constant evaluator used numeric addition whenever either operand was statically known to be numeric. An operand with an unknown static type can still evaluate to a string, so (!1 || "5") + 1 was evaluated as 6 instead of "51".
The minifier can create that intermediate shape when it rewrites true ? "5" : true before recording a const value, then inline the incorrect cached value.
This change only uses numeric or BigInt addition when both operands are known not to be strings. When either type is unknown, it evaluates the operands to primitive values and applies + to those values.
fixes #28521