Repository navigation
Conversation
ChangelogNo changelog entry. Semantic Diff1 commit · Full page Keep numbered existential names distinct from other existential names1babc35 · cknitt + Claude · Nov 03, 2026, 18:25 UTC
Diagnostic modified (comparing existentials) type rec a2 = A2('a): a2
type rec a1 = A1('a1): a1
type rec a3 = A3('a): a3
let f = (A2(y), A1(x), A3(z)) => z == x
-This has type: \"$a1/1011"
-But it's being compared to something of type: \"$a1/1013"
+This has type: $a1
+But it's being compared to something of type: $a2 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9200 +/- ##
=======================================
Coverage 81.73% 81.73%
=======================================
Files 458 458
Lines 65292 65296 +4
=======================================
+ Hits 53364 53368 +4
Misses 11928 11928
🚀 New features to boost your workflow:
|
Why:
A numbered name can equal the base name of another existential, as
$a1 for the second 'a and for 'a1, and the printer then falls back to
internal name/stamp names. Names already given in the binding are
now skipped.
Diagnostic modified (comparing existentials):
Example:
type rec a2 = A2('a): a2
type rec a1 = A1('a1): a1
type rec a3 = A3('a): a3
let f = (A2(y), A1(x), A3(z)) => z == x
Before (text):
This has type: \"$a1/1011"
But it's being compared to something of type: \"$a1/1013"
After (text):
This has type: $a1
But it's being compared to something of type: $a2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gGhHjzBTXqSo8Dckpb
Signed-off-by: Christoph Knittel <ck@cca.io>
f1fe83d to
1babc35
Compare
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Developer playground preview: https://rescript-lang.github.io/rescript/dev-playground/?version=pr-9200 |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Fixes #9180. This fixes a regression from #9080, which is unreleased, so there is no changelog entry.
Since #9080, existential types are named after their type variable and numbered when the name is taken:
$a,$a1, … The counter is kept per base name, so a numbered name can equal the base name of another existential. Inthe existential of
'a1and the second one of'aare both named$a1, and the error falls back to the internal names\"$a1/1011"and\"$a1/1013". The same happens for anonymous existentials, which are named after their constructor ($Any1for the secondAnyand forAny1).get_new_abstract_namenow also remembers the names it has given in the current binding and skips a candidate that is already taken, as OCaml 5 does (it checks the environment instead). The example now prints$a1and$a2. The per-name counter stays the starting point, so the common case does no extra work.The constructor stays out of the name, as #9080 decided; it is still named when an existential escapes.
Tests
super_errors/gadt_existential_numbered_name: the example above, a numbered name equal to the base name of a later existential.super_errors/gadt_existential_numbered_constructor: anonymous existentials ofAnyandAny1, where the base name of the later one is already taken ($Any1vs$Any11).🤖 Generated with Claude Code
https://claude.ai/code/session_01Kbf3gGhHjzBTXqSo8Dckpb