Skip to content

Check complex type values when validating assignments#1108

Merged
mint-thompson merged 2 commits intomasterfrom
cimpl-969-assign-complex-type
Jun 28, 2022
Merged

Check complex type values when validating assignments#1108
mint-thompson merged 2 commits intomasterfrom
cimpl-969-assign-complex-type

Conversation

@mint-thompson
Copy link
Collaborator

Completes task CIMPL-969.

When validating the a complex type value used in an AssignmentRule, the value may be an InstanceDefinition. Do not assign the value if it would conflict with existing values within the complex type. Assignment of complex values is all-or-nothing: if a conflict exists on part of the complex value, no parts of the complex value are assigned. An error is reported on the line where the Instance is assigned, and the error message refers to the specific value within the Instance that has a conflict.

The test for the "not the first type" is there as a guard against some prior logic involving type[0].code that caused problems for me during development. That logic has been removed, but I kept the test in just in case something similar comes up later.

There is some duplicated code for restoring values in checkAssignInlineInstance, but I felt that this implementation made more sense than adding new parameters for the existing key and value.

When validating the a complex type value used in an AssignmentRule, the
value may be an InstanceDefinition. Do not assign the value if it would
conflict with existing values within the complex type. Assignment of
complex values is all-or-nothing: if a conflict exists on part of the
complex value, no parts of the complex value are assigned. An error is
reported on the line where the Instance is assigned, and the error
message refers to the specific value within the Instance that has a
conflict.
Copy link
Collaborator

@jafeltra jafeltra left a comment

Choose a reason for hiding this comment

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

Neato!

@mint-thompson mint-thompson merged commit 86cc90d into master Jun 28, 2022
@mint-thompson mint-thompson deleted the cimpl-969-assign-complex-type branch June 28, 2022 16:06
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.

3 participants