Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not show counterintuitive placement for testKind=expression #1283

Conversation

jadams-tresys
Copy link
Contributor

The counterintuitive placement warning should only be displayed for asserts/disciminators that have testKind=expression.

DAFFODIL-2912

Copy link
Member

@stevedlawrence stevedlawrence left a comment

Choose a reason for hiding this comment

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

+1, minor suggestion to make it just a little cleaner

@@ -164,9 +165,10 @@ abstract class SequenceGroupTermBase(xml: Node, lexicalParent: SchemaComponent,
protected final lazy val checkIfNonEmptyAndDiscrimsOrAsserts: Unit = {
val msg = "Counterintuitive placement detected. Wrap the discriminator or assert " +
"in an empty sequence to evaluate before the contents."
if (groupMembers.nonEmpty && discriminatorStatements.nonEmpty)
// Only show warning if the testKind=expression, see DFDL spec Section 9.5 Evaluation Order for Statement Annotations
if (groupMembers.nonEmpty && discriminatorStatements.filter(_.testKind == TestKind.Expression).nonEmpty)
Copy link
Member

Choose a reason for hiding this comment

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

Might be a little more clear to do discriminatorStatements.exists(_.testKind == TestKind.Expression)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. I always forget about exists()

@jadams-tresys jadams-tresys force-pushed the DAFFODIL-2912-counterintuitive_placement branch from 7b4143f to b3202f6 Compare August 23, 2024 13:13
The counterintuitive placement warning should only be displayed for
asserts/disciminators that have testKind=expression.

DAFFODIL-2912
@jadams-tresys jadams-tresys force-pushed the DAFFODIL-2912-counterintuitive_placement branch from b3202f6 to 0599a80 Compare August 23, 2024 13:28
@jadams-tresys jadams-tresys merged commit d26c634 into apache:main Aug 23, 2024
11 checks passed
Copy link
Contributor

@mbeckerle mbeckerle left a comment

Choose a reason for hiding this comment

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

+1

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