Skip to content

Say what a string parses to when it is not the entity asked for - #2574

Merged
Rafael-SOWNet merged 3 commits into
masterfrom
variable-from-a-string-says-what-it-parsed-to
Nov 27, 2026
Merged

Rafael-SOWNet merged 3 commits into
masterfrom
variable-from-a-string-says-what-it-parsed-to

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Fixes #2567.

Entity.Variable v0 = "v0" threw CannotParseInstanceException saying only that no variable could be parsed from v0. v0 parses as v ^ 0, because a digit written against a name is its power (#1503, on 3.0), so a physics formula with v0 in it loses the v0 without an error. Changing that reading is #1503's job; this PR changes only what the message says.

The message now says what the string parsed to. For a name with a digit against it, it also says that the variable with that index is spelled v_0. Every implicit conversion from a string goes through the same FromString, so Matrix, Set and the rest say what they parsed to as well.

Entity.Variable v = ... 2.9.0 this branch
"v0" Cannot parse an instance of Variable from `v0` Cannot parse an instance of Variable from `v0`: it parses as `v ^ 0`: a digit written against a name is its power, and `v_0` is the variable with that index
"alpha1" ... from `alpha1` ...: it parses as `alpha ^ 1`: ..., and `alpha_1` is the variable with that index
"x + 1" ... from `x + 1` ...: it parses as `x + 1`
"x^2" ... from `x^2` ...: it parses as `x ^ 2`

Complex.Parse and Boolean keep their own message, which CircleTest pins.

Local checks:

  • the suite: 21,533 passed;
  • the MCP, Terminal, Interactive and F# suites;
  • AOT: 83 passed, and the smoke test published with AngouriMathPublishAot=true;
  • all nine harnesses, with the baselines matching;
  • the solver cross-checks and scalecheck: identical to master except timings.

🤖 Generated with Claude Code

Rafael-SOWNet and others added 3 commits November 26, 2026 22:58
Entity.Variable v0 = "v0" threw CannotParseInstanceException saying only that
no variable could be parsed from v0. It parses as v ^ 0, because a digit
written against a name is its power (#1503), so a physics formula with v0 in
it loses the v0 without an error. The message now says what the string parsed
to, and for a name with a digit against it, that the variable with that index
is spelled v_0. Every implicit conversion from a string goes through the same
FromString, so Matrix and Set say what they parsed to as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.72%. Comparing base (213af16) to head (ef45253).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2574      +/-   ##
==========================================
+ Coverage   86.71%   86.72%   +0.01%     
==========================================
  Files         344      344              
  Lines       74884    74889       +5     
  Branches    21856    21857       +1     
==========================================
+ Hits        64937    64950      +13     
+ Misses       5374     5365       -9     
- Partials     4573     4574       +1     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.23% <100.00%> (+0.01%) ⬆️
fsharp 32.79% <ø> (ø)
interactive 40.09% <ø> (ø)

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

Files with missing lines Coverage Δ
...gouriMath/Convenience/StringToEachClass.Classes.cs 93.75% <100.00%> (+2.08%) ⬆️
...rces/AngouriMath/Core/Exceptions/ParseException.cs 100.00% <100.00%> (ø)

... and 7 files with indirect coverage changes

🚀 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 bcd0067 into master Nov 27, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AngouriMath Nov 27, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the variable-from-a-string-says-what-it-parsed-to branch November 27, 2026 01:50
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.

Entity.Variable v0 = "v0" throws without saying that v0 parses as v ^ 0

1 participant