spec-generators: map float to crate::Number; remove FIELD_TYPE_OVERRIDES#104
Merged
Conversation
This was referenced Jun 10, 2026
Merged
Member
Author
Member
Author
Merge activity
|
The sole entry in `FIELD_TYPE_OVERRIDES` — `numberValueNode.number → crate::Number` — wasn't really a per-field exception: it was the spec's only `float`, and the JS generator already maps `float → number`. `Number` (a `u64|i64|f64` enum with custom serde) is the exact Rust analogue, so the mapping now lives in `typeExpr.ts` and the whole override surface collapses. `attributeBodyLine.ts` loses its override lookup (and its `nodeKind` parameter); `nodeStructFragment.ts`'s Default heuristic drops the opaque-check and moves `float` out of the Default-able set (`Number` is `Copy`, not `Default`), keeping it in `SCALAR_KINDS` for `Copy`. Generated output is byte-identical: `NumberValueNode` keeps `pub number: Number,`, `#[derive(Copy)]`, and the hand-written `Number` enum is untouched. Tests move alongside the source. No per-field/per-name overrides remain.
8da0d38 to
e9c113f
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.

The sole entry in
FIELD_TYPE_OVERRIDES—numberValueNode.number → crate::Number— wasn't really a per-field exception: it was the spec's onlyfloat, and the JS generator already mapsfloat → number.Number(au64|i64|f64enum with custom serde) is the exact Rust analogue, so the mapping now lives intypeExpr.tsand the whole override surface collapses.attributeBodyLine.tsloses its override lookup (and itsnodeKindparameter);nodeStructFragment.ts's Default heuristic drops the opaque-check and movesfloatout of the Default-able set (NumberisCopy, notDefault), keeping it inSCALAR_KINDSforCopy.Generated output is byte-identical:
NumberValueNodekeepspub number: Number,,#[derive(Copy)], and the hand-writtenNumberenum is untouched. Tests move alongside the source. No per-field/per-name overrides remain.