Skip to content

Support Behavior Annex short-circuit logical operators 馃 - #3218

Merged
lwrage merged 2 commits into
masterfrom
3169_support_short_circuit_operators
Sep 12, 2026
Merged

Support Behavior Annex short-circuit logical operators 馃#3218
lwrage merged 2 commits into
masterfrom
3169_support_short_circuit_operators

Conversation

@lwrage

@lwrage lwrage commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Fixes #3169

Cause and correction

The Behavior Annex expression grammar accepted only the single-word logical operators and, or, and xor. Consequently, and then and or else failed during parsing and could not be represented distinctly in either the declarative or strict model.

This change:

  • parses and then and or else through datatype rules that produce the canonical declarative values "and then" and "or else", regardless of hidden whitespace or comments between the keywords;
  • adds distinct AndThen and OrElse literals to the strict-model LogicalOperator enum;
  • maps the declarative values to those literals while reusing the existing Boolean operand checks;
  • regenerates the runtime, IDE, UI, parser, serializer, and grammar metadata; and
  • activates the existing short-circuit conformance expectation and refreshes only the affected goldens.

Regression coverage

Issue3169Test uses external AADL model fixtures and verifies:

  • preservation of both operators in the declarative and strict models;
  • canonical AST values when tabs, multiple spaces, a line comment, and a line ending separate the keywords;
  • serialization and reparsing without degrading either operator to ordinary and or or; and
  • Boolean-only operand diagnostics for both operators.

Before the production change, the regression failed because then and else were rejected by the parser.

Validation

Focused regression, 3 tests passed:

mvn -o -T5 -s releng/osate.releng/settings.xml -Plocal -pl :org.osate.ba.tests -Dtycho.localArtifacts=default -Dpr.build=true -Dsign=false -Dspotbugs=false -Dcodecoverage=false -Djavadoc=false -Dtest=Issue3169Test -DfailIfNoTests=false clean verify

Complete BA reactor, 13 modules successful; 128 BA tests passed with 4 tracked skips, and 15 BA Xtext tests passed:

mvn -o -T5 -s releng/osate.releng/settings.xml -f ba/pom.xml -Plocal -Dtycho.localArtifacts=default -Dpr.build=true -Dsign=false -Dspotbugs=false -Dcodecoverage=false -Djavadoc=false -DfailIfNoTests=false clean verify

Clean root reactor, all 143 modules successful:

mvn -o -T5 -s releng/osate.releng/settings.xml -Plocal -Dtycho.localArtifacts=ignore -Dpr.build=true -Dsign=false -Dspotbugs=false -Dcodecoverage=false -Djavadoc=false -DfailIfNoTests=false clean install

Dependencies and residual risk

This branch is based directly on the current origin/master and has no PR dependencies.

Adding the then keyword shifts generated ANTLR token identifiers, so the generated parser diff is substantial. The explicit MWE2 generation, complete BA reactor, and clean root reactor all succeeded. Downstream code that switches exhaustively over LogicalOperator may need to distinguish the two new literals; the complete reactor found no uncompilable consumers.

Model both short-circuit logical operators with Boolean and invalid integer operands. Assert that the declarative and strict representations preserve each spelling, that copied annexes serialize and reparse without degrading the operators, and that the operators retain Boolean-only type checking. Activate the existing conformance expectation while preserving pre-fix corpus baselines.
Parse and then and or else as distinct logical operators while canonicalizing hidden text between each keyword in the declarative value. Preserve both forms as dedicated strict-model enum literals during translation and keep the existing Boolean operand validation behavior.

Regenerate the runtime and content-assist grammars, refresh the affected characterization goldens, and mark the conformance expectation for issue #3169 active.
@lwrage
lwrage force-pushed the 3169_support_short_circuit_operators branch from 0da367a to 9b06d0d Compare September 11, 2026 22:38
@lwrage
lwrage merged commit a33c66d into master Sep 12, 2026
1 check passed
@lwrage
lwrage deleted the 3169_support_short_circuit_operators branch September 12, 2026 11:28
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.

Support Behavior Annex short-circuit logical operators 馃

2 participants