Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Fixed

- `validateStateDefinitionParallelSubactions` and `validateStateUsageParallelSubactions` report only transitions in a parallel state, not successions: SysML 8.3.18.5 and 8.3.18.6 forbid incoming and outgoing transitions of the substates, and 7.18.2 and 7.18.3 say the same. The Pilot Implementation also rejects a succession there; the opensysml fixtures `s33-parallel-state-usage-with-succession` and `p19-parallel-state-with-transition`, which hold a succession and no transition, move to unknown in both baselines.

## v0.11.3

### Added
Expand Down
23 changes: 23 additions & 0 deletions crates/sysmlv2-model/src/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1168,6 +1168,29 @@ mod tests {
assert_eq!(shown(&on_threads), shown(&in_line));
}

/// SysML 8.3.18.5 validateStateDefinitionParallelSubactions and
/// 8.3.18.6 validateStateUsageParallelSubactions forbid transitions of
/// the substates of a parallel state, not successions (7.18.2).
#[test]
fn a_parallel_state_may_own_successions() {
let mut model = Model::new();
model.add_source(
"user.sysml",
"package P {
state def S parallel { state a; state b; first a then b; }
state t parallel { state a; state b; first a then b; }
state def T parallel { state a; state b; transition first a then b; }
state u parallel { state a; state b; transition first a then b; }
}",
);
let found: Vec<String> = findings(&model)
.into_iter()
.map(|(_, m)| m)
.filter(|m| m.contains("ParallelSubactions"))
.collect();
assert_eq!(found.len(), 2, "{found:?}");
}

#[test]
fn semantic_checks_walk_tables_without_copying_them() {
// Fresh build: library rows and user rows share one storage.
Expand Down
8 changes: 4 additions & 4 deletions crates/sysmlv2-model/src/check/structural.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,9 @@ pub(super) fn validate(r: &ResolvedModel, model: &Model, g: &Facts) -> Vec<(usiz
}
}
if flag(b, e, "isParallel")
&& g.members[e].iter().any(|&m| {
is_a!(b.elements[m], "TransitionUsage") || is_a!(b.elements[m], "Succession")
})
&& g.members[e]
.iter()
.any(|&m| is_a!(b.elements[m], "TransitionUsage"))
{
report(
e,
Expand All @@ -594,7 +594,7 @@ pub(super) fn validate(r: &ResolvedModel, model: &Model, g: &Facts) -> Vec<(usiz
} else {
"validateStateUsageParallelSubactions"
},
"A parallel state cannot own successions or transitions",
"A parallel state cannot own transitions",
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2702,16 +2702,8 @@
"status": "diagnostic baseline"
},
"negative/semantic/s33-parallel-state-usage-with-succession.sysml": {
"diagnostics": [
{
"end": 196,
"message": "A parallel state cannot own successions or transitions [validateStateUsageParallelSubactions]",
"severity": "Error",
"stage": "semantics",
"start": 195
}
],
"status": "diagnostic baseline"
"diagnostics": [],
"status": "unknown"
},
"negative/semantic/s34-state-usage-two-entry-actions.sysml": {
"diagnostics": [
Expand Down Expand Up @@ -3422,16 +3414,8 @@
"status": "accepted (adjudicated)"
},
"negative/xpect/p19-parallel-state-with-transition.sysml": {
"diagnostics": [
{
"end": 215,
"message": "A parallel state cannot own successions or transitions [validateStateDefinitionParallelSubactions]",
"severity": "Error",
"stage": "semantics",
"start": 214
}
],
"status": "diagnostic baseline"
"diagnostics": [],
"status": "unknown"
},
"negative/xpect/p20-connection-with-one-end.sysml": {
"diagnostics": [
Expand Down Expand Up @@ -5416,7 +5400,7 @@
"diagnostics": [
{
"end": 151,
"message": "A parallel state cannot own successions or transitions [validateStateDefinitionParallelSubactions]",
"message": "A parallel state cannot own transitions [validateStateDefinitionParallelSubactions]",
"severity": "Error",
"stage": "semantics",
"start": 150
Expand Down Expand Up @@ -5452,7 +5436,7 @@
"diagnostics": [
{
"end": 156,
"message": "A parallel state cannot own successions or transitions [validateStateUsageParallelSubactions]",
"message": "A parallel state cannot own transitions [validateStateUsageParallelSubactions]",
"severity": "Error",
"stage": "semantics",
"start": 155
Expand Down
28 changes: 6 additions & 22 deletions crates/sysmlv2-parser/tests/fixtures/opensysml/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2744,16 +2744,8 @@
"status": "diagnostic baseline"
},
"negative/semantic/s33-parallel-state-usage-with-succession.sysml": {
"diagnostics": [
{
"end": 196,
"message": "A parallel state cannot own successions or transitions [validateStateUsageParallelSubactions]",
"severity": "Error",
"stage": "semantics",
"start": 195
}
],
"status": "diagnostic baseline"
"diagnostics": [],
"status": "unknown without library"
},
"negative/semantic/s34-state-usage-two-entry-actions.sysml": {
"diagnostics": [
Expand Down Expand Up @@ -3569,16 +3561,8 @@
"status": "accepted (adjudicated)"
},
"negative/xpect/p19-parallel-state-with-transition.sysml": {
"diagnostics": [
{
"end": 215,
"message": "A parallel state cannot own successions or transitions [validateStateDefinitionParallelSubactions]",
"severity": "Error",
"stage": "semantics",
"start": 214
}
],
"status": "diagnostic baseline"
"diagnostics": [],
"status": "unknown without library"
},
"negative/xpect/p20-connection-with-one-end.sysml": {
"diagnostics": [
Expand Down Expand Up @@ -5878,7 +5862,7 @@
"diagnostics": [
{
"end": 151,
"message": "A parallel state cannot own successions or transitions [validateStateDefinitionParallelSubactions]",
"message": "A parallel state cannot own transitions [validateStateDefinitionParallelSubactions]",
"severity": "Error",
"stage": "semantics",
"start": 150
Expand Down Expand Up @@ -5914,7 +5898,7 @@
"diagnostics": [
{
"end": 156,
"message": "A parallel state cannot own successions or transitions [validateStateUsageParallelSubactions]",
"message": "A parallel state cannot own transitions [validateStateUsageParallelSubactions]",
"severity": "Error",
"stage": "semantics",
"start": 155
Expand Down