Skip to content

A piecewise of Iverson brackets and provided integers compiles in LINQ - #2246

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
a-piecewise-of-iverson-brackets-compiles
Oct 30, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
a-piecewise-of-iverson-brackets-compiles

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

#2242 widened an Iverson bracket (int?) and a provided integer (long?) to double before a function takes them. A piecewise's cases skipped that widening, so a piecewise with such a case still threw KeyNotFoundException in the LINQ compiler, alone, under a function or nested in another piecewise: MaxType has no int? or long?. HandlePiecewise now widens each numeric case the same way.

Compile<double, double>("x") 2.6.0 master this branch
sin(piecewise(iverson(x > 0) provided x > 0, sin(2))) at 2 UncompilableNodeException KeyNotFoundException 0.8415, as evaluated
piecewise(piecewise(-1 provided x > 0, 3) provided x > 0, x) + x at 1 KeyNotFoundException KeyNotFoundException 0, as evaluated

PiecewiseOfNullableCompilationTest checks seven such expressions under both compilers against evaluation. All seven fail on master. The #2237 line in BREAKING-CHANGES.md now separates the two cases: on 2.6.0 the provided integer 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

#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>
@Rafael-SOWNet Rafael-SOWNet moved this from Todo to In review in AngouriMath Oct 30, 2026
@Rafael-SOWNet Rafael-SOWNet added this to the 2.7.0 milestone Oct 30, 2026
@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.71%. Comparing base (5f1e85a) to head (4abf311).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@           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           
Flag Coverage Δ
cpp 37.77% <ø> (ø)
fsharp 32.97% <ø> (ø)
interactive 40.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ctions/Compilation/IntoLinq/CompilationProtocol.cs 92.45% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Rafael-SOWNet
Rafael-SOWNet merged commit 0e791f5 into master Oct 30, 2026
36 checks passed
@Rafael-SOWNet
Rafael-SOWNet deleted the a-piecewise-of-iverson-brackets-compiles branch October 30, 2026 15:37
@github-project-automation github-project-automation Bot moved this from In review to Done in AngouriMath Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant