Skip to content

Fix: mapped-type conversions on the resynchronized pile (G4 for #40) - #50

Open
jsboige wants to merge 4 commits into
resync/endjin-main-964f177from
fix/40-mapped-type-conversion
Open

jsboige wants to merge 4 commits into
resync/endjin-main-964f177from
fix/40-mapped-type-conversion

Conversation

@jsboige

@jsboige jsboige commented Nov 25, 2026

Copy link
Copy Markdown

What and why

G4 follow-up for fork #40 on the resynchronized pile. On endjin/main 964f17704e, a constraint that converts a value to a mapped type — t.X == (ExactReal)2.5 — raises NotImplementedException in VisitConvert. The upstream correction is endjin#129 (OPEN, base main); this branch takes that line by cherry-pick (62e1bb1) and adds the piece the fork needs.

The fork-specific second half

The cherry-pick alone does not fix this pile. Theorem.TranslateConstraint keeps the fork-only PartialEvaluator.PartialEval pre-pass: on the cast, the host folds (ExactReal)2.5 into a Constant<ExactReal>, and the visitor refuses that value before VisitConvert — the line endjin#129 corrects — is ever reached. The fork's residual defect therefore has a different signature than upstream's.

ExpressionVisitor.MentionsMappedTypeConversion scans for a conversion whose target carries a TheoremVariableTypeMappingAttribute (Theorem.MappedType(node.Type) != node.Type), and the constraint is translated without the fold, the same shape as the existing exception-closure skip. An arbitrary instance of the mapped type stays unsupported, as endjin#129's fourth test asserts.

Measurements

state head net10.0 net8.0
5071d6f + endjin#129 cherry-picked, no guard 62e1bb1 475 total / 2 failed / 473 passed not run
this branch adb7338 475 / 0 / 475 — build 0 warnings, 0 errors 475 / 0 / 475 — build 0 warnings, 0 errors
  • Red signature: System.NotSupportedException: Unsupported constant Z3.Linq.Tests.MappedTypeConversionTests+ExactReal at ExpressionVisitor.VisitConstantValue; the 2 failing tests are Honour mapped types on conversion targets endjin/Z3.Linq#129's constant-cast and arithmetic pair — Solve_ConstantCastToMappedType_TranslatesUsingTheMappedSort (159 ms) and Solve_MappedSymbolsAndConstantsInArithmetic_RelateThem (152 ms).
  • Green legs run as bin/Release/<tfm>/Z3.Linq.Tests.exe (MSTest/MTP): 5s 686ms at adb7338 on net10.0, 4s 595ms on net8.0.
  • The net8.0 leg was measured with Z3.Linq.Tests and Z3.Linq.Examples temporarily multi-targeted in a probe worktree, not committed: upstream is net10.0-only by solutions/Directory.Build.props, while Z3.Linq.csproj already replaces it with net8.0;net10.0.

Scope

🤖 Generated with Claude Code

Resolve mapped target types before selecting a conversion sort. Accept only the typed identity operator promised by the mapping and keep arbitrary mapped instances unsupported.

Add red/green coverage for cast constants, arithmetic and constructor read-back.

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

Lane: myia-po-2023:CoursIA
The resynchronized pile keeps the fork-only PartialEvaluator.PartialEval pre-pass in
Theorem.TranslateConstraint. On a constraint such as t.X == (ExactReal)2.5 the fold turns
the cast into a constant of the mapped type, which the visitor refuses, while the
conversion node itself translates to the sort the mapping declares. The line
cherry-picked from endjin#129 is therefore never reached on this pile.

A constraint that mentions a conversion to a mapped type is now translated without the
fold, the same shape as the existing exception-closure skip.

Measured on 5071d6f with endjin#129 cherry-picked: 475 tests, 2 failures without the
guard; 475/475 on net10.0 and 475/475 on net8.0 with it (the net8.0 leg on a probe-only
multi-target scaffold, not committed).

See jsboige/CoursIA#19237
See endjin#129

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

Lane: myia-po-2023:CoursIA
The #40 row now names endjin#129 (OPEN) as the upstream correction and the fork-side fold
guard as the second half of the fix. The net8.0 leg is stated as measured, on a probe-only
multi-target scaffold, instead of pending; upstream is net10.0 by construction.

See jsboige/CoursIA#19237

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

Lane: myia-po-2023:CoursIA
@jsboige

jsboige commented Nov 27, 2026

Copy link
Copy Markdown
Author

[ACTION] Pile remontée après le merge de #42 et la mise à jour de #49

  • Resynchronize fork with endjin/main 964f177 #49 (resync/endjin-main-964f177) : update-branch fait par la lane — la branche porte désormais main à jour (tête de fusion 87dbb66, « Merge branch 'main' into resync/endjin-main-964f177 »), ce qui lève le rouge « Automerge & Label » constaté par ai-01 (merge de Fix(ci,#41): Automerge & Label ne rougit plus sans identifiants d'application #42 à 09:06Z, garde des identifiants dependjinbot + épinglage par SHA).
  • Fix: mapped-type conversions on the resynchronized pile (G4 for #40) #50 (cette PR) : la branche resynchronisée est remontée ici (tête 0e52c06), donc le diff de cette PR ne contient plus la resynchronisation — seulement la correction des conversions de types mappés et sa documentation. Aucun conflit : l'unique contenu apporté par la remontée est .github/workflows/build.yml et .github/workflows/dependabot_approve_and_label.yml.
  • Base de cette PR inchangée (resync/endjin-main-964f177), les deux PR restent empilées dans le même ordre.

Le build est relancé sur la nouvelle tête par le push ; je lis le verdict au prochain cycle et je corrige ici si une jambe tombe. Rien d'autre n'est attendu de vous sur cette PR pour l'instant.

Lane myia-po-2023:CoursIA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants