Repository navigation
Fix equality-chain branches and tuple foreach targets - #700
Merged
Merged
Conversation
Contributor
Author
Don't thank me, thank the LSP. I have found so many issues like this by just working with the compiler adapter LSP - do try it! |
lagergren
enabled auto-merge (squash)
October 14, 2026 05:59
lagergren
added a commit
that referenced
this pull request
Oct 14, 2026
The equality-chain and tuple foreach target cases in TestAstExpressions are covered by testEqualityChains in misc.x and testForEachTupleTargets in loop.x, which came in with #700; keep only the coverage unique to this module.
lagergren
added a commit
that referenced
this pull request
Oct 14, 2026
The equality-chain and tuple foreach target cases in TestAstExpressions are covered by testEqualityChains in misc.x and testForEachTupleTargets in loop.x, which came in with #700; keep only the coverage unique to this module.
lagergren
added a commit
that referenced
this pull request
Oct 15, 2026
The equality-chain and tuple foreach target cases in TestAstExpressions are covered by testEqualityChains in misc.x and testForEachTupleTargets in loop.x, which came in with #700; keep only the coverage unique to this module.
lagergren
added a commit
that referenced
this pull request
Oct 15, 2026
The equality-chain and tuple foreach target cases in TestAstExpressions are covered by testEqualityChains in misc.x and testForEachTupleTargets in loop.x, which came in with #700; keep only the coverage unique to this module.
lagergren
added a commit
that referenced
this pull request
Oct 19, 2026
The equality-chain and tuple foreach target cases in TestAstExpressions are covered by testEqualityChains in misc.x and testForEachTupleTargets in loop.x, which came in with #700; keep only the coverage unique to this module.
lagergren
added a commit
that referenced
this pull request
Oct 20, 2026
The equality-chain and tuple foreach target cases in TestAstExpressions are covered by testEqualityChains in misc.x and testForEachTupleTargets in loop.x, which came in with #700; keep only the coverage unique to this module.
lagergren
added a commit
that referenced
this pull request
Oct 21, 2026
The equality-chain and tuple foreach target cases in TestAstExpressions are covered by testEqualityChains in misc.x and testForEachTupleTargets in loop.x, which came in with #700; keep only the coverage unique to this module.
lagergren
added a commit
that referenced
this pull request
Oct 26, 2026
The equality-chain and tuple foreach target cases in TestAstExpressions are covered by testEqualityChains in misc.x and testForEachTupleTargets in loop.x, which came in with #700; keep only the coverage unique to this module.
lagergren
added a commit
that referenced
this pull request
Oct 26, 2026
The equality-chain and tuple foreach target cases in TestAstExpressions are covered by testEqualityChains in misc.x and testForEachTupleTargets in loop.x, which came in with #700; keep only the coverage unique to this module.
lagergren
added a commit
that referenced
this pull request
Oct 27, 2026
The equality-chain and tuple foreach target cases in TestAstExpressions are covered by testEqualityChains in misc.x and testForEachTupleTargets in loop.x, which came in with #700; keep only the coverage unique to this module.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Why?
left == 3 == rightorleft == Null == right, can take the wrong conditional branch.How?
These fixes were found during the AST cleanup in #693 and are extracted here directly from master for independent review. The constant-folding fix remains separate in #699; this PR does not depend on it.
Changes
javatools/src/main/java/org/xvm/compiler/ast/CmpChainExpression.java: correct conditional jumps for equality chains containing a constant.javatools/src/main/java/org/xvm/compiler/ast/ForEachStatement.java: use the current tuple element's assignment target.manualTests/src/main/x/misc.x: exercise all matching/mismatching integer and nullable operand combinations as Boolean values and normal/negated conditions.manualTests/src/main/x/loop.x: check tuple assignment to properties, mutable array elements, and mixed local/property targets.lang/dsl/src/main/resources/templates/grammar.js.templateandlang/generated-examples/grammar.js: accept existing local, property and indexed tuple targets, with the ambiguity declaration needed to distinguish foreach from tuple assignment.Both regressions were reproduced before their respective fixes: the equality test took the wrong branch, and the tuple test failed with a null-pointer exception in
ForEachStatement.emitList. With the fixes, all 23 sequential manual-test modules pass. A fresh XDK test run reports 53 passed, eight existing skips, and no failures;spotlessCheckalso passes.The grammar fix passes generation, all 1,032 source-corpus files, 50 DSL tests and 43 native Tree-sitter adapter tests, with no failures or skips. Both the generating template and the checked-in grammar example are updated.
Reproduce the manual-suite verification from the repository root:
./gradlew :manualTests:clean \ -PincludeBuildManualTests=true -PincludeBuildAttachManualTests=true ./gradlew :manualTests:runSequential \ -PincludeBuildManualTests=true -PincludeBuildAttachManualTests=true --no-build-cacheRun the clean command separately and wait for it to finish so the manual tests are recompiled with the selected compiler.