fix(hir-def): applies_to accepts feature paths per AADL v2.3 (v0.9.x bug closeout)#219
Open
avrabe wants to merge 2 commits into
Open
fix(hir-def): applies_to accepts feature paths per AADL v2.3 (v0.9.x bug closeout)#219avrabe wants to merge 2 commits into
avrabe wants to merge 2 commits into
Conversation
…bug closeout)
AADL v2.3 (SAE AS5506D §11.3) permits a contained property association's
`applies to` clause to end with a feature name:
Some_Property => value applies to subcomp.input_port;
spar's resolver previously walked the dotted path matching only
subcomponents, so when the final segment named a feature it returned
None and emitted a spurious "could not be resolved" diagnostic, dropping
the property.
Introduces AppliesTarget { Component, FeatureOwner, Unresolvable } and
extends resolve_applies_to_path: each non-final segment must name a
subcomponent (as before); the final segment may name either a
subcomponent or a feature on the resolved component. When it names a
feature, the property attaches to the component that owns the feature.
Genuinely unresolvable paths (no matching subcomponent or feature on
the final segment) still emit the existing diagnostic, now with the
text "could not be resolved to a component instance or feature".
2 integration tests in crates/spar-cli/tests/applies_to_feature_path.rs
cover both the happy path and the unresolved-feature diagnostic.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
# Conflicts: # artifacts/requirements.yaml # artifacts/verification.yaml
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
AADL v2.3 (SAE AS5506D §11.3) permits a contained property association's
applies toclause to end with a feature name. spar previously walked the dotted path matching only subcomponents, so when the final segment named a feature it emitted a spurious "could not be resolved" diagnostic and dropped the property.MWE
What changed
crates/spar-hir-def/src/instance.rs:enum AppliesTarget { Component, FeatureOwner, Unresolvable }.resolve_applies_to_path: each non-final segment must name a subcomponent (as before); the final segment may name either a subcomponent or a feature on the resolved component. When it names a feature, the property attaches to the component that owns the feature."could not be resolved to a component instance or feature".Test plan
applies_to_feature_path_does_not_emit_unresolved_diagnostic— clean resolution offw.w(subcomponent) andfw.w.input_port(feature)applies_to_unknown_segment_still_emits_diagnostic—fw.w.no_such_portstill emits the unresolved diagnosticcargo clippy -p spar-hir-def -p spar -- -D warningscleanapplies_to_nested.rs+applies_to_unresolvable_path_emits_diagnostictests still passPart of v0.9.x bug closeout series (#214 nested binding, #216 classifier_match, #217 has-features, #218 count-comparisons).
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com