Skip to content

ST6RI-979 Remove model mutation in adapters for expression result parameter creation - #818

Merged
seidewitz merged 3 commits into
masterfrom
ST6RI-979
Oct 19, 2026
Merged

seidewitz merged 3 commits into
masterfrom
ST6RI-979

Conversation

@adaussy

@adaussy adaussy commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Following the same approach as PR #815 for default multiplicities, this PR separates expression result preparation from semantic consultation.

Background

The KerML grammar for expressions requires FeatureReferenceExpressions, ConstructorExpressions and InvocationExpressions to parse with owned result parameters, satisfying the constraints validateFeatureReferenceExpressionResult and validInstantiationExpressionResult (InstantiationExpression is the superclass of ConstructorExpression and InvocationExpression). Previously, this was implemented in FeatureReferenceExpressionAdapter, ConstructorExpressionAdapter, and InvocationExpressionAdapter, respectively, by creating an owned result parameter through the method addAdditionalMembers(). This method can be invoked by derived queries, including Expression::result, so reading the model can modify its containment structure.

Objectives

  1. Preserve the semantic behavior of prepared models, including result typing, implicit specializations, argument ordering, and explicit return parameters.
  2. Prevent derived queries and cache computation from creating expression result parameters.
  3. Support incremental editing in downstream application, where caches should be restricted to stable elements, while retaining the Pilot’s broader caching policy.
  4. Avoid introducing target resolution during preparation, given the sensitivity of the current architecture to resolution order, recursion, and cycles.
  5. Maintain performance at least equivalent to the existing implementation.

Changes

  1. Moved the code for adding result parameters from the adapters to the parse post-processing classes FeatureReferenceExpressionParserPostProcessor and InstantiationExpressionParserPostProcessor.
  2. Updated non-model-level ExpressionEvaluator and associated ExpressionUtil methods to explicitly add result parameters when programmatically constructing FeatureReferenceExpressions, ConstructorExpressions and InvocationExpressions, since these are no longer added during transformation.

Establish the semantic baseline for feature-reference, constructor and
invocation results before separating consultation from materialization.
@adaussy
adaussy requested a review from seidewitz October 19, 2026 09:22
@seidewitz seidewitz self-assigned this Oct 19, 2026
@seidewitz seidewitz added this to the 2026-09 milestone Oct 19, 2026
Moved result-adding code from conditional in
ExpressionParserPostProcessor to new post-processor classes.

@seidewitz seidewitz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

To save time, I made the following change myself:

  • Removed the code in ExpressionParserPostProcessor that conditionally added a result parameter.
  • Added FeatureReferenceParserPostProcessor and InstantiationExpressionParserPostprocessor, which unconditionally added a rsult parameter.

All tests still pass.

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.

2 participants