Skip to content

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
mainfrom
fix/v0.9.x-applies-to-feature-paths
Open

fix(hir-def): applies_to accepts feature paths per AADL v2.3 (v0.9.x bug closeout)#219
avrabe wants to merge 2 commits into
mainfrom
fix/v0.9.x-applies-to-feature-paths

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented May 13, 2026

Summary

AADL v2.3 (SAE AS5506D §11.3) permits a contained property association's applies to clause 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

system implementation Sys.Impl
  subcomponents
    cpu: processor Cpu;
    fw: process Proc.Impl;          -- contains thread `w` with feature `input_port`
  properties
    Required_Connection_Quality_Of_Service => (Latency)
      applies to fw.w.input_port;   -- pre-fix: diagnostic + dropped
end Sys.Impl;

What changed

crates/spar-hir-def/src/instance.rs:

  • New 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.
  • Unresolvable paths still emit the existing diagnostic, now with text "could not be resolved to a component instance or feature".

Test plan

  • applies_to_feature_path_does_not_emit_unresolved_diagnostic — clean resolution of fw.w (subcomponent) and fw.w.input_port (feature)
  • applies_to_unknown_segment_still_emits_diagnosticfw.w.no_such_port still emits the unresolved diagnostic
  • cargo clippy -p spar-hir-def -p spar -- -D warnings clean
  • Existing applies_to_nested.rs + applies_to_unresolvable_path_emits_diagnostic tests still pass

Part 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

…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>
@avrabe avrabe enabled auto-merge (squash) May 13, 2026 18:48
# Conflicts:
#	artifacts/requirements.yaml
#	artifacts/verification.yaml
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