fix: update Apply pattern match arity for auto-TCO strict field#751
Merged
stephenamar-db merged 1 commit intodatabricks:masterfrom Apr 11, 2026
Merged
Conversation
Motivation: The auto-TCO commit (ecdd0b6) added a `strict: Boolean` field to Apply, Apply0, Apply1, Apply2, and Apply3 case classes. The hasSelfRefExpr pattern matches in Materializer were not updated, causing compilation failure on Scala 2.13.18 and runtime MatchError on Scala 3.3.7 (caught by wildcard, leading to incorrect code paths for lazy reverse arrays). Modification: Added wildcard for the new `strict` field in all five Apply pattern matches in Materializer.hasSelfRefExpr. Result: Fixes Scala 2.13.18 compilation and the lazy_reverse_correctness test failure (which was caused by MatchError falling through to incorrect materialization path).
Contributor
Author
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.
Motivation
The auto-TCO commit (ecdd0b6, PR #694) added a
strict: Booleanfield toApply,Apply0,Apply1,Apply2, andApply3case classes. ThehasSelfRefExprpattern matches inMaterializerwere not updated, causing:wrong number of arguments for pattern sjsonnet.Expr.ApplyMatchErroron Scala 3.3.7: The pattern match silently fell through to the wildcard case, causing incorrect materialization paths for lazy reverse arrays (lazy_reverse_correctness.jsonnetfailure)Modification
Added wildcard for the new
strictfield in all five Apply pattern matches inMaterializer.hasSelfRefExpr:Apply(_, v, args, _, _)→Apply(_, v, args, _, _, _)Apply0(_, v, _)→Apply0(_, v, _, _)Apply1(_, v, a1, _)→Apply1(_, v, a1, _, _)Apply2(_, v, a1, a2, _)→Apply2(_, v, a1, a2, _, _)Apply3(_, v, a1, a2, a3, _)→Apply3(_, v, a1, a2, a3, _, _)Result
lazy_reverse_correctness.jsonnet)