Skip to content

Invalid result when importing constraint definition whose result expression uses locally-defined parameters #2109

@pcdavid

Description

@pcdavid

Steps to reproduce

  1. Create a new project
  2. From the Explorer, on the main Package1, select New object from text
  3. Enter the text below and validate.
import ScalarValues::*;
import NumericalFunctions::*;

constraint def MassConstraint {
    in totalMass : Real; 
    in partMasses : Real[0..*];
        
    totalMass == sum(partMasses)
}

Expected result

The new constraint def is imported without errors and the result model is conform to the text.

Actual result

The import process shows 2 errors, which seem to indicate that when paring the totalMass == sum(partMasses) result expression, the two locally-defined features totalMass and partMasses are not resolved.

Unable to resolve name 'totalMass' for reference 'memberElement' on element '[Membership] Package1::MassConstraint::<ResultExpressionMembership>::<OperatorExpression>::<ParameterMembership>::<Feature>::<FeatureValue>::<FeatureReferenceExpression>::<Membership>'
Unable to resolve name 'partMasses' for reference 'memberElement' on element '[Membership] Package1::MassConstraint::<ResultExpressionMembership>::<OperatorExpression>::<ParameterMembership>::<Feature>::<FeatureValue>::<InvocationExpression>::<ParameterMembership>::<Feature>::<FeatureValue>::<FeatureReferenceExpression>::<Membership>'

Indeed, in the resulting model, for the result expression we see the equivalent of <unresolved Feature Reference Expression> == sum(<unresvoled Feature Reference Expression>).

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions