Skip to content

fix(check): accept a feature reference to a named multiplicity - #817

Merged
HuiJun merged 1 commit into
developfrom
fix/multiplicity-feature-reference
Oct 2, 2026
Merged

HuiJun merged 1 commit into
developfrom
fix/multiplicity-feature-reference

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

What and why

The feature-reference rule (passes/w8c_feature_reference.go, checkReferent) reported Must be a valid feature for a reference to a named multiplicity, because its test was isUsageKind(target.Kind) and SymbolMultiplicity is not a usage kind:

class E {
    multiplicity em [1..4];
    feature v : ScalarValues::Natural = em;   // was: error Must be a valid feature
}

The condition now reads !isUsageKind(target.Kind) && target.Kind != symbols.SymbolMultiplicity. SymbolKind.IsFeature() already classifies a multiplicity as a feature. A class or other type used as a referent still reports the error, and the accessibility check is unchanged.

This false positive appeared in the reproduction for Systems-Modeling/SysML-v2-Pilot-Implementation#802, which expects no diagnostics there. The docs now say that the maintainer confirmed #802 and fixed it upstream on ST6RI-975 (commit 1563e068, Type_multiplicity_SettingDelegate now derives multiplicity from ownedMember). The fix is not in a release yet. With that class compiled ahead of the pinned 2026-08 jar, the #802 reproduction and its subclass and struct variants validate clean.

Specification basis

KerML 1.1 §8.3.3.1.9: Multiplicity specializes Feature, so a FeatureReferenceExpression may name one. No row of docs/project/spec-compliance.md moves; the validation-constraints.md and omg-issues.md entries for #802 record the upstream status.

How it was verified

  • New TestW8CFeatureReferenceToMultiplicity: an in-class multiplicity, a package-level multiplicity, and the full fix(repl): exit on Ctrl-C at an empty prompt, discard the continuation otherwise #802 reproduction, all with no errors. The existing class-referent negative control in TestW8CFeatureReferenceAccessibleAndValid still reports.
  • Checked against the pinned pilot validate-kerml. The pilot accepts the package-level feature w = pm;. Its remaining diagnostics on the in-class case come from the fix(repl): exit on Ctrl-C at an empty prompt, discard the continuation otherwise #802 delegate bug, and they disappear with the ST6RI-975 class.
  • go vet ./internal/check/..., make lint, go test ./internal/check/... ./internal/semantic/..., and the training and pilot corpus gates (OPENSYSML_REQUIRE_TRAINING_CORPUS=1 OPENSYSML_REQUIRE_PILOT_CORPORA=1) all pass with no rows moved. The changelog, doc-id and doc-link checks also pass.

Checklist

  • make test and make lint pass locally (scoped go test above plus the corpus gates; the full suite runs in CI)
  • Tests added or updated for the change
  • Documentation extended where it already covers the surface (see CONTRIBUTING.md)
  • Changelog entry added as changes/unreleased/<slug>.<section>.md, not as an edit to CHANGELOG.md
  • baselines regenerated and make docs-counts run if a gate count moved (no gate count moved)
  • No internal work-item labels (waves, slices, F4, K5) in the body, docs, or changelog

Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/9c1dd2015da0409389e714253be0fb0b
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/9c1dd2015da0409389e714253be0fb0b?variant=devin
Requested by: @HuiJun

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration
devin-ai-integration Bot marked this pull request as ready for review October 2, 2026 16:25

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@HuiJun
HuiJun merged commit 266c15d into develop Oct 2, 2026
24 checks passed
@HuiJun
HuiJun deleted the fix/multiplicity-feature-reference branch October 2, 2026 17:12
@devin-ai-integration devin-ai-integration Bot mentioned this pull request Oct 5, 2026
6 tasks done
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.

1 participant