You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
semantic/codegen: a Sharpy type's import clone (alias or re-export) is not its declaration at every consumer — nested type SPY0909, alias-vs-direct type identity SPY0220, warm-incremental interface materialization SPY0909 #2402
An import of a Sharpy type, whether aliased (from core import Box as B) or through a re-exporter (from lib1 import Box where lib1 did from core import Box), binds a clone TypeSymbol. Since b7f365060 (P21i F1, #2389) that clone carries OriginSymbol back to its declaration. But the consumers below still treat the clone as a separate type with its own (missing) facts. Every consumer should resolve the clone to the declaration it names: its layout facts, its type identity and its materialized interfaces.
Cells (found by the P21i final refutation pass, verified by the lead with the HEAD binary @ 60bd27738 unless noted)
#
Consumer
Program
Observed
Expected
1
nested type through an import clone
core.spy: class Box: / class Inner: v: int = 11; main.spy: from core import Box as B + print(B.Inner().v). Also from lib1 import Box; Box.Inner() (re-exporter, only when the entry sorts before lib1), import lib1; lib1.Box.Inner(), and the annotation i: Box.Inner
SPY0909 TypeSyntaxMapper "layout fact missing (#2102, Rule 2): no namespace recorded for type 'Box' (TypeSymbol, hasCodeGenInfo=False …)"
prints 11
2
type identity of an alias next to the direct import
from core import Box as B + from core import Box + c: Box = B(); also f(B()) where f(b: Box), and c: core.Box = B()
SPY0220 "Cannot assign type 'B' to variable of type 'Box'", in both orders
entry aa.spy: from lib1 import Box, Impl, where lib1 re-exports an interface and its implementer from core. Cold build is OK, and so is the warm build after touching lib1. The next build (no-op, or touch the entry) fails
SPY0909 "TypeSymbol 'Impl' has 2 interface(s) but SemanticBinding.GetInterfaces() holds 1 (materialization inconsistency)", i.e. cache poisoning. The zz-order and direct-only controls stay green. Measured by the verification pass (scratchpad/verify2 O4); not re-run by the lead.
every build is green
Related, already tracked: emission of an aliased type in isinstance, a match pattern, or a @static member access is #1928 (cell posted there).
The one cell that moved because of b7f365060: the dual import from lib1 import Box + from core import Box + Box.Inner() with the entry sorting first was SPY0204 before, and is now cell 1's ICE. The defect exists without the dual import.
Batching 2026-10-31 @ 2c42408 — charter .claude/plans/remediation-round-2026-09-20-batching.md §3.20i, P21k — one name, one meaning at every consumer: residue (order 6c⁹, directly after P21j, before P69; full (b, c, d)). This issue is the class tracker and lands FIRST.Ruling R-JY (owner, 2026-10-31): (a) new group P21k {#2402 FIRST · #1928 · #2403 · #2408}.
Contract: a module binding's RECORDED identity is what every consumer reads — a type's import clone (alias, re-exporter, aliasing re-exporter, two-hop) resolves to its declaration for layout facts (nested types), type identity (assignability, argument passing) and materialized interfaces (warm builds), and is emitted under the declaration's qualified name (#1928's cells). Lane / reach: ice · program. Generator: REQUIRED FIRST — clone kind {alias, re-exporter, aliasing re-exporter, two-hop} × consumer {nested-type access, annotation, identity compare, isinstance, match head, static member, warm incremental} × route {run, project}, emit-and-run against the direct-import twin, allowlist ratchet. The warm cell (cell 3) stays here; P28's harness replays the result later. The fact the cure reads exists since P21i (Symbol.DeclarationRoot, OriginSymbol, the defining-module identity R-JK). Rejected: (b) scatter — #2402 + #1928 to P16 (row 33), #2403 to P26 (row 24), #2408 alone (months out for program-reach ICEs whose cure facts were just built). Two-way: P16's and P26's generators later gain the arm P21k drains. No seam hypothesis — the plan measures the seam.
Batching 2026-11-13 @ dbb17ee — charter docs/process/rounds/remediation-round-2026-09-20-batching.md §3.20i, P21k — one name, one meaning at every consumer: residue (order 6c⁹).
Cell moved here from #2680 (enum comparison residue): the failing part is the import alias, not the comparison. Measured by the reviewer of PR #2679 with run @ 2d3b05b, the same at the base 428cb7b.
Cell
Program
Observed
Expected
Lane
Reach
Found by
Notes
alias clone × identity compare, enum
from lib import Color as C c: C = C.GREEN print(c == C.GREEN)
This class's clause (i): an alias clone is emitted under the declaration's qualified name in every position. The consumer axis gains an enum member read under ==.
New spellings of cells 1 and 2, from P77 (#2742) review 7. Measured at the #2742 tip 9e39086; the reviewer reports the same at that PR's previous tip, 985b5e3.
Cell 2 (alias next to the direct import), through a subclass of the alias. In lib: class Shape with a @virtual name. In main: from lib import Shape as LShape + import lib + class Plain(LShape). Then a: lib.Shape = Plain() is SPY0220 "Cannot assign type 'Plain' to variable of type 'Shape'", at main.spy:16. With only the alias import (no import lib), a: LShape = Plain() runs.
What #2742 moves, for reference: ProjectCompiler.Phases now points an aliased Sharpy type's OriginSymbol at this compilation's own declaration. This is the rule P21i D5 applies to aliased variables. The static-value resolver then binds the declaration's field, and the emitter spells the owner by its OriginalImportName. As a result CC.s read, store, +=, out and CC.q.append(…) run, in sync code and across await. On dev20909f7, print(CC.s) is SPY0908 CS0234 (measured). The change reaches only the static-value binding: the layout-fact and type-identity consumers in cells 1–2 still see the clone.
Reproduction sweep, 2026-11-16: PARTIAL (at least one cell is right today and at least one is not).
Re-measured against dev @ d81425f with a Debug sharpyc, about eight cells per issue; CPython 3.15.2 where python is the standard. Copied at batching call 46 (2026-11-19) from docs/process/rounds/sweep-2026-11-16.md. Not re-run since: P77 merged after the sweep, so a plan re-measures before relying on a row.
Today: Nested type through an alias or a re-exporter 'from' import is still SPY0909 (TypeSyntaxMapper: no namespace recorded for type 'Box'); alias-vs-direct identity is still SPY0220; the enum alias cell is still SPY0908 CS0234. One sub-variant now works: 'import lib1; lib1.Box.Inner()' prints 11. The warm-incremental cell did not reproduce with my reconstruction (inconclusive).
reproduces — type identity: from core import Box as B + from core import Box; c: Box = B(): error[SPY0220]: Cannot assign type 'B' to variable of type 'Box' @5:5
reproduces — type identity at an argument: f(B()) where f(b: Box): error[SPY0220]: Cannot pass argument of type 'B' to parameter of type 'Box' @8:13
inconclusive — warm incremental build: entry aa.spy imports an interface and its implementer through re-exporter lib1; cold, touch lib1, no-op, touch entry: all five builds 'Build succeeded.' in both reconstructions (Library output type; the issue gives no program text and its lead did not re-run it)
Activity
antonsynd commentedon Oct 31, 2026
Batching 2026-10-31 @ 2c42408 — charter
.claude/plans/remediation-round-2026-09-20-batching.md§3.20i, P21k — one name, one meaning at every consumer: residue (order 6c⁹, directly after P21j, before P69; full (b, c, d)). This issue is the class tracker and lands FIRST. Ruling R-JY (owner, 2026-10-31): (a) new group P21k {#2402 FIRST · #1928 · #2403 · #2408}.Contract: a module binding's RECORDED identity is what every consumer reads — a type's import clone (alias, re-exporter, aliasing re-exporter, two-hop) resolves to its declaration for layout facts (nested types), type identity (assignability, argument passing) and materialized interfaces (warm builds), and is emitted under the declaration's qualified name (#1928's cells). Lane / reach: ice · program. Generator: REQUIRED FIRST — clone kind {alias, re-exporter, aliasing re-exporter, two-hop} × consumer {nested-type access, annotation, identity compare, isinstance, match head, static member, warm incremental} × route {run, project}, emit-and-run against the direct-import twin, allowlist ratchet. The warm cell (cell 3) stays here; P28's harness replays the result later. The fact the cure reads exists since P21i (
Symbol.DeclarationRoot,OriginSymbol, the defining-module identity R-JK). Rejected: (b) scatter — #2402 + #1928 to P16 (row 33), #2403 to P26 (row 24), #2408 alone (months out for program-reach ICEs whose cure facts were just built). Two-way: P16's and P26's generators later gain the arm P21k drains. No seam hypothesis — the plan measures the seam.antonsynd commentedon Nov 13, 2026
Batching 2026-11-13 @ dbb17ee — charter
docs/process/rounds/remediation-round-2026-09-20-batching.md§3.20i, P21k — one name, one meaning at every consumer: residue (order 6c⁹).Cell moved here from #2680 (enum comparison residue): the failing part is the import alias, not the comparison. Measured by the reviewer of PR #2679 with
run@ 2d3b05b, the same at the base 428cb7b.from lib import Color as Cc: C = C.GREENprint(c == C.GREEN)True(CPython 3.15.2)==.Generated by Claude Code
antonsynd commentedon Nov 19, 2026
New spellings of cells 1 and 2, from P77 (#2742) review 7. Measured at the #2742 tip 9e39086; the reviewer reports the same at that PR's previous tip, 985b5e3.
@static. Inlib:class LC:/class N:/@static/t: int = 3. In main:from lib import LC as CCand thenprint(CC.N.t). Observed SPY0909 TypeSyntaxMapper "layout fact missing (tests: LayoutFactConsumerScan roster guard is vacuous; P14c residue (stale fixture comment, 5 unwritten fixtures) #2102) … no namespace recorded for type 'LC'". The annotation form fails the same way:from lib import Outer as O2withx: O2.Inner = ….lib:class Shapewith a@virtual name. In main:from lib import Shape as LShape+import lib+class Plain(LShape). Thena: lib.Shape = Plain()is SPY0220 "Cannot assign type 'Plain' to variable of type 'Shape'", at main.spy:16. With only the alias import (noimport lib),a: LShape = Plain()runs.What #2742 moves, for reference:
ProjectCompiler.Phasesnow points an aliased Sharpy type'sOriginSymbolat this compilation's own declaration. This is the rule P21i D5 applies to aliased variables. The static-value resolver then binds the declaration's field, and the emitter spells the owner by itsOriginalImportName. As a resultCC.sread, store,+=,outandCC.q.append(…)run, in sync code and acrossawait. Ondev20909f7,print(CC.s)is SPY0908 CS0234 (measured). The change reaches only the static-value binding: the layout-fact and type-identity consumers in cells 1–2 still see the clone.Generated by Claude Code
antonsynd commentedon Nov 19, 2026
Reproduction sweep, 2026-11-16: PARTIAL (at least one cell is right today and at least one is not).
Re-measured against
dev@ d81425f with a Debugsharpyc, about eight cells per issue; CPython 3.15.2 where python is the standard. Copied at batching call 46 (2026-11-19) fromdocs/process/rounds/sweep-2026-11-16.md. Not re-run since: P77 merged after the sweep, so a plan re-measures before relying on a row.Today: Nested type through an alias or a re-exporter 'from' import is still SPY0909 (TypeSyntaxMapper: no namespace recorded for type 'Box'); alias-vs-direct identity is still SPY0220; the enum alias cell is still SPY0908 CS0234. One sub-variant now works: 'import lib1; lib1.Box.Inner()' prints 11. The warm-incremental cell did not reproduce with my reconstruction (inconclusive).
Cells (controls left out):
c < sacross enum types is CS0019 behind SPY0908,object == enumandColor? == Colorare SPY0222 #2680): enum alias clone, from lib import Color as C; c: C = C.GREEN; print(c == C.GREEN): error[SPY0908]: ... (CS0234: The type or namespace name 'C' does not exist in the namespace 'SharpyApp.Lib') @4:37 and @5:40Generated by Claude Code