Repository navigation
A piecewise of Iverson brackets and provided integers compiles in LINQ - #2246
Merged
Merged
Conversation
#2242 widened an Iverson bracket, an int?, and a provided integer, a long?, to double before a function took it. A piecewise's cases did not pass through that widening, so a piecewise with such a case still threw KeyNotFoundException, alone, under a function or nested in another piecewise: MaxType, which picks the type the cases are taken in, has no int? or long?. sin(piecewise(iverson(x > 0) provided x > 0, sin(2))) was one. HandlePiecewise now widens each numeric case as a function's operand is widened. On 2.6.0 an Iverson bracket did not compile at all, and a provided integer in a piecewise over double threw KeyNotFoundException too: piecewise(piecewise(-1 provided x > 0, 3) provided x > 0, x) + x at 1. The #2237 line in BREAKING-CHANGES.md now says which of the two threw, and takes in the piecewise. PiecewiseOfNullableCompilationTest compares seven such expressions, under both compilers, with evaluation. All seven fail on master. Part of #2237. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2246 +/- ##
=======================================
Coverage 86.71% 86.71%
=======================================
Files 310 310
Lines 67782 67782
Branches 19663 19663
=======================================
Hits 58777 58777
Misses 4893 4893
Partials 4112 4112
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
#2242 widened an Iverson bracket (
int?) and aprovidedinteger (long?) todoublebefore a function takes them. Apiecewise's cases skipped that widening, so a piecewise with such a case still threwKeyNotFoundExceptionin the LINQ compiler, alone, under a function or nested in another piecewise:MaxTypehas noint?orlong?.HandlePiecewisenow widens each numeric case the same way.Compile<double, double>("x")sin(piecewise(iverson(x > 0) provided x > 0, sin(2)))at 2UncompilableNodeExceptionKeyNotFoundException0.8415, as evaluatedpiecewise(piecewise(-1 provided x > 0, 3) provided x > 0, x) + xat 1KeyNotFoundExceptionKeyNotFoundException0, as evaluatedPiecewiseOfNullableCompilationTestchecks seven such expressions under both compilers against evaluation. All seven fail on master. The #2237 line inBREAKING-CHANGES.mdnow separates the two cases: on 2.6.0 theprovidedinteger threw, and the Iverson bracket was not compiled at all. It also covers the piecewise now.Suite 18163 passed; the Mcp, Terminal and InteractiveWrapper suites and the AOT smoke test pass.
Part of #2237.
🤖 Generated with Claude Code