Thread class sort members through CIclass; keep SClass sorts package-independent#1054
Open
nanavati wants to merge 1 commit into
Open
Thread class sort members through CIclass; keep SClass sorts package-independent#1054nanavati wants to merge 1 commit into
nanavati wants to merge 1 commit into
Conversation
…independent A class exported without (..) appears in its package's signature as CIclass, which carried no member names. An importing package's MakeSymTab.getTI therefore rebuilt the class tycon's TIstruct SClass sort from the superclass preds alone -- an impoverished payload, divergent from the defining compile's (field names ++ superclass ids). Abstract structs never had this problem: their signature form keeps the fields, merely invisible. For abstract classes, SymTab.addTypes has papered over the divergence forever via pickBetter's "abstract typeclasses have hidden methods" length comparison, so the impoverished form was tolerated -- but the sort payload of the same qualified tycon differed between the defining compile and its importers, depending on which package's view you happened to hold. Thread the defining package's sort member list (field names ++ superclass ids, exactly as getTI computes it for Cclass) through CIclass: GenSign records it both when exporting a class abstractly (genDefSign) and when embedding a used-but-unexported class (classToIClass, from the symtab's own TypeInfo), and the importer's getTI/getCls use it verbatim for the TypeInfo sort and the Class tyConOf. The fields themselves stay hidden: nothing new enters the field table, and TypeAnalysis's typeclass analysis now skips sort members without a FieldInfo instead of internal-erroring on them. CIclass gains a field, so the .bo signature encoding changes: bump the .bo header tag to bsc-bo-20260715-3 (and the .ba tag in lockstep to bsc-ba-20260715-3). Validated: full install-src build, plus green localchecks in bsc.typechecker/dontcare, bsc.typechecker/typeclasses, and bsc.bluetcl/commands. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vjo7EmAfHvZTWPDJ923FVz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
GenSign emits classes exported without
(..)asCIclass, which carried no membernames, so an importing package's
MakeSymTab.getTIrebuilt the class tycon's sort fromthe superclass list alone — an empty
TIstruct SClass. The defining package meanwhilecarries the full member list. Thread the defining package's sort member list (field
names ++ superclass ids, exactly as
getTIcomputes it forCclass) throughCIclass:GenSign records it both when exporting a class abstractly and when embedding a
used-but-unexported class (
classToIClass, from the symtab's ownTypeInfo), and theimporter's
getTI/getClsuse it verbatim for theTypeInfosort and the ClasstyConOf. The members stay hidden: nothing new enters the field table, andTypeAnalysis.analyzeNonNumTConnow skips sort members without aFieldInfoinstead ofinternal-erroring on them. The .bo header tag is bumped for the
CIclassencodingchange.
Why
A tycon's sort payload should not depend on which package is looking at it. Abstract
structs already satisfy this (their signature form keeps the fields, merely invisible);
abstract classes did not. The base compiler papers over the divergence in
SymTab.addTypes(pickBetter's "abstract typeclasses have hidden methods" lengthcomparison), so the empty form was tolerated but never load-bearing. The IType interning
stack (#1048) enforces one sort payload per qualified name
(one-tycon-per-qualified-name) and ICEs on the divergence (first seen:
Prelude::AppendTuple''compiling bsc.verilog/splitports/ShallowSplit.bs).Validation
bsc.verilog/splitports localcheck fully green (317 passes), plus bsc.bluetcl/commands
and bsc.typechecker/dontcare spot checks, under the interning stack's checked build; the
full stack records fullparallel 20281/0/134.
Stack
Standalone on main. Last of four independent fixes (#1051 (ATF canonical ids), #1052 (listcons SDataCon sort), #1053 (S0015 field position), #1054 (this)) below the reworked #1048.