Skip to content

fold the special-value symbol too under case insensitivity - #305

Merged
floitsch merged 1 commit into
google:masterfrom
Ramya-9353:symbol-case-fold
Aug 16, 2026
Merged

fold the special-value symbol too under case insensitivity#305
floitsch merged 1 commit into
google:masterfrom
Ramya-9353:symbol-case-fold

Conversation

@Ramya-9353

Copy link
Copy Markdown
Contributor

Repro: build a converter with ALLOW_CASE_INSENSITIVITY and the EcmaScript symbols infinity_symbol_ = "Infinity", nan_symbol_ = "NaN". StringToDouble("Infinity"), StringToDouble("infinity") and StringToDouble("INFINITY") all return junk_string_value with processed_characters_count == 0; the same holds for every casing of NaN. Lower-case symbols ("infinity"/"nan") are matched fine, which is why the existing case-insensitive test never caught it.

Cause: the fold is applied to the input character only. ConsumeFirstCharacter compares ToLower(input) == symbol_first and ConsumeSubStringImpl compares converter(input) != symbol_byte, both leaving the symbol side un-folded. Any symbol byte that is an upper-case letter therefore never equals the lower-cased input, so no input matches, not even the symbol's own spelling.

Fix: fold both sides. ToLower(first) in ConsumeFirstCharacter, and converter(CodeUnit(*substring)) in ConsumeSubStringImpl and its assert. The case-sensitive path passes Pass (identity), so it keeps rejecting a spelling that differs only in case. Regression test added beside the existing case-insensitive cases, using upper-case symbols across both the char and uc16 overloads.

@google-cla

google-cla Bot commented Aug 16, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@floitsch

Copy link
Copy Markdown
Collaborator

Thanks.

@floitsch
floitsch merged commit 2c1eb4f into google:master Aug 16, 2026
8 of 9 checks passed
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.

2 participants