feat(generator): SEM003 diagnostic + form-specific relationships (closes #58)#73
Merged
matt-edmondson merged 1 commit intovectorsfrom May 10, 2026
Merged
Conversation
#58) Each entry under integrals / derivatives / dotProducts / crossProducts in dimensions.json may now declare an explicit "forms" array (e.g. { "other": "Length", "result": "Torque", "forms": [3] }). When set, the generator only emits operators at those forms; when a listed form is missing on a participating dimension, it surfaces as the new SEM003 Roslyn diagnostic instead of being silently skipped. When "forms" is omitted, the generator falls back to per-relationship defaults — [0..4] for integrals/derivatives, [1..4] for dotProducts, [3] for crossProducts — preserving every emit decision currently in place. The Generated/ tree is unchanged. Migrated the one current crossProduct (Force × Length → Torque) to "forms": [3] explicitly to demonstrate the new field. Verified that swapping to "forms": [2, 3]" produces: error SEM003: Relationship in dimension 'Force' (crossProducts[Length -> Torque]) explicitly requests form V2, but 'Torque' does not declare that form. Doc updates: - CLAUDE.md generator-diagnostics list adds SEM003 with an example. - docs/strategy-unified-vector-quantities.md describes the optional "forms" field on each relationship. - AnalyzerReleases.Unshipped.md adds the SEM003 row.
|
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.




Summary
Closes #58 — adds the
SEM003diagnostic and the optionalformsfield on each relationship that the original issue called for. Pairs with the form-coverage matrix doc that landed in #72.What changed
RelationshipDefinition(indimensions.json) gets an optionalformsarray (int[]). When present, the generator only emits operators at those vector forms; when a listed form is missing on a participating dimension, it now surfaces asSEM003instead of being silently dropped:When
formsis omitted, the generator uses per-relationship defaults — preserving every emit decision currently in place:formsintegrals,derivatives[0, 1, 2, 3, 4]dotProducts[1, 2, 3, 4](V0 has no dot product)crossProducts[3](cross product is intrinsically 3D)Migrated the only current
crossProduct(Force × Length → Torque) to"forms": [3]explicitly. TheGenerated/tree is unchanged — the migration just makes the V3 expectation visible in metadata.Verification
dotnet build Semantics.SourceGeneratorsanddotnet build Semantics.Quantitiesboth succeed with noSEM00xwarnings.Force3D.Cross(Displacement3D) → Torque3Dis still emitted."forms": [2, 3]on the cross product produces the expectedSEM003againstTorque(which has no V2). Reverting to[3]makes the warning go away.Doc updates
CLAUDE.mdgenerator diagnostics list addsSEM003with an example.docs/strategy-unified-vector-quantities.mddescribes the optionalformsfield.AnalyzerReleases.Unshipped.mdadds theSEM003row.Test plan
formsforcrossProductsmatches the existing V3-only emit)forms: [2, 3], observed warning, reverted)dotnet test—Semantics.Testcannot restore in this sandbox (Microsoft.NETCore.App.Host.ubuntu.24.04-x64not in feeds); CI will run.https://claude.ai/code/session_01Tj63Rddvs9frqLUgsjNEP5
Generated by Claude Code