Skip to content

Accept names that start with a keyword - #900

Merged
milessabin merged 1 commit into
mainfrom
fix/f12-keyword-prefix-names
Aug 20, 2026
Merged

Accept names that start with a keyword#900
milessabin merged 1 commit into
mainfrom
fix/f12-keyword-prefix-names

Conversation

@hugo-vrijswijk

Copy link
Copy Markdown
Contributor

The fragment-name parser rejected any name that starts with "on". The enum-value parser rejected any name that starts with "true", "false" or "null". Both lookaheads had no word-boundary check.

Changes:

  • FragmentName and EnumValue now reject only the exact keyword.
  • BooleanValue requires a word boundary after "true" or "false", and backtracks so that trueStory can parse as an enum value.
  • NullValue backtracks for the same reason.
  • InlineFragment backtracks its type condition, so that ...onFoo falls through to the fragment-spread branch.

The fragment-name parser rejected any name that starts with "on". The enum-value parser rejected any name that starts with "true", "false" or "null". Both lookaheads had no word-boundary check.

Changes:
- `FragmentName` and `EnumValue` now reject only the exact keyword.
- `BooleanValue` requires a word boundary after "true" or "false", and backtracks so that `trueStory` can parse as an enum value.
- `NullValue` backtracks for the same reason.
- `InlineFragment` backtracks its type condition, so that `...onFoo` falls through to the fragment-spread branch.
@hugo-vrijswijk
hugo-vrijswijk force-pushed the fix/f12-keyword-prefix-names branch from ba37862 to 4bb9665 Compare August 20, 2026 10:31

@milessabin milessabin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@milessabin
milessabin merged commit bea0c00 into main Aug 20, 2026
23 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