Skip to content

ISyntaxCheck: build ATF equivalences from canonical qualified tycons#1051

Open
nanavati wants to merge 1 commit into
B-Lang-org:mainfrom
nanavati:atf-canonical-ids
Open

ISyntaxCheck: build ATF equivalences from canonical qualified tycons#1051
nanavati wants to merge 1 commit into
B-Lang-org:mainfrom
nanavati:atf-canonical-ids

Conversation

@nanavati

@nanavati nanavati commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

What

ISyntaxCheck.atfEqsFromDict builds associated-type-function tycons from raw symtab
enumeration keys. The symtab type map holds one entry per visible alias of a type — for
the current package's own decls, both the qualified name and the bare one, sharing a
single TypeInfo — so each dict addition also produced an equivalence keyed by an
unqualified ATF tycon (first seen: Rep of Prelude's Generic, during the Prelude's
own compile).

Build the ATF tycon from ti_qual_id and keep one entry per ATF by matching only the
canonical alias.

Why

Every other ITCon producer feeds from CTypes canonicalized by MakeSymTab.trCType',
which substitutes the qualified ti_qual_id; this was the one site synthesizing tycons
outside that layer. A bare-named equivalence key is latently unsound — qualEq lets an
unqualified id match any package's same-named ATF — and it breaks the
one-tycon-per-qualified-name invariant that the IType interning stack (#1048) turns into
a hard assertion. With the origin fixed, #1048 retires its tolerance paths for
unqualified tycons.

Validation

Found by the interning stack's checked build (-trace-itype-intern, since removed);
that checked library build is green with this fix, and the full stack records
fullparallel 20281 passes / 0 unexpected failures / 134 expected failures. Standalone on
main the change is output-neutral: the equivalence set merely loses its
duplicate/unqualified keys.

Stack

Standalone on main. First of four independent fixes (#1051 (this), #1052 listcons SDataCon
sort, #1053 (S0015 field position), #1054 (CIclass sort members)) that the reworked #1048
(IType interning) stacks on, below #1045#1046#1047.

ISyntaxCheck.atfEqsFromDict built associated-type-function tycons
from raw getAllTypes enumeration keys.  The symtab type map holds
one entry per visible alias of a type -- for the current package's
own decls both the qualified name and the bare one, sharing a
single TypeInfo -- so each dict addition also manufactured a
duplicate equivalence keyed by an unqualified ATF tycon (first
seen: Rep alongside Prelude.Rep, during the Prelude's own compile).

Every other ITCon producer feeds from CTypes canonicalized by
MakeSymTab.trCType', which substitutes the qualified ti_qual_id, so
real ATF applications always carry qualified tycon Ids.  The
unqualified duplicates could never match them in eqType: they sat
in the equivalence classes as silently inert entries.

Build the ATF tycon from ti_qual_id and keep one entry per ATF by
matching only the canonical alias (atfId == qatfId).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vjo7EmAfHvZTWPDJ923FVz
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.

1 participant