Derive inline-union allowlist from the spec; remove INLINE_UNIONS#97
Merged
Conversation
This was referenced Jun 10, 2026
Member
Author
This was referenced Jun 10, 2026
Merged
Member
Author
Merge activity
|
Replaces the hand-maintained `INLINE_UNIONS` allowlist with a rule derived purely from the spec: a union is inline iff it has no `registered<PascalCase>` sibling AND is referenced by at least one node attribute (recursively, through any wrapper type expression). The per-union `stripSuffix` is computed as the longest common PascalCase suffix shared by every flattened leaf's `pascalCase(kind)`, trimmed back to start at an uppercase letter so we never strip mid-word. New helpers in `unions.ts`: `isInlineUnion`, `getReferencedUnionNames`, and `getInlineUnionStripSuffix`. `getEmittableUnions` now takes the full `Spec` (so it can see references from other categories) and applies the derived rule alongside the registered-twin check; `unionPage.ts` consults the new helpers instead of `INLINE_UNIONS`. The map and `InlineUnionConfig` are deleted from `defaults.ts`. Generated output is byte-identical (the derived rule produces the same stripSuffix `ValueNode` for both currently-emitted inline unions, `constantPdaSeedValue` and `enumValuePayload`).
ac27e64 to
7745d7d
Compare
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.

Replaces the hand-maintained
INLINE_UNIONSallowlist with a rule derived purely from the spec: a union is inline iff it has noregistered<PascalCase>sibling AND is referenced by at least one node attribute (recursively, through any wrapper type expression). The per-unionstripSuffixis computed as the longest common PascalCase suffix shared by every flattened leaf'spascalCase(kind), trimmed back to start at an uppercase letter so we never strip mid-word. New helpers inunions.ts:isInlineUnion,getReferencedUnionNames, andgetInlineUnionStripSuffix.getEmittableUnionsnow takes the fullSpec(so it can see references from other categories) and applies the derived rule alongside the registered-twin check;unionPage.tsconsults the new helpers instead ofINLINE_UNIONS. The map andInlineUnionConfigare deleted fromdefaults.ts. Generated output is byte-identical (the derived rule produces the same stripSuffixValueNodefor both currently-emitted inline unions,constantPdaSeedValueandenumValuePayload).