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 const/static member read through an instance receiver is CS0176 behind SPY0908 #2147
A static or constant member reached through an instance receiver must either lower to type-qualified access or be refused by the checker with a real diagnostic. Today the checker accepts it and the emitter writes instance access, so C# refuses it (SPY0908 CS0176) @ 05824d5. The spec (statements.md "Class-Level Constants") says m.PI "works but discouraged". #1794 was the struct-field twin (closed).
Contract: ONE member-shape table {static-ness, self presence, accessor kind, default body, host kind} — MemberClassification — is read by the checker, every validator and the emitter, so a static member reached through an instance, a self-less @static interface method, a lambda parameter named self, an interface default accessor body, or a setter parameter annotation is decided in Semantic and emitted from that decision, never refused by Roslyn. Generator FIRST: an emit-and-Roslyn-compile sweep over host × member kind × body × receiver × self position (the ILCompiles harness shape), allowlist ratchet. This cell: a const/static member reached through an instance receiver lowers to type-qualified access from the recorded member kind (statements.md: "works but discouraged"); matrix member kind {const, static field, static method, static property} × receiver {instance local, self, call result} × host {class, struct}, under run. Lane / reach: ice · program. Class tracker:#2051. No seam hypothesis — the plan measures the seam.
Cell: a @static PROPERTY read through an instance receiver (found by P21h's re-verify)
This is the property-kind sibling of this issue's const/static-field cells: member access through an instance doesn't check a property's staticness, so the generated C# hits CS0176.
CS0176 through an instance receiver: 96 allowlist row(s) drain with this issue.
Measured by the name-resolution differential harness (P77a, #2421) @ 5f8a4c4e2. Each row is a generated cell in src/Sharpy.Compiler.Tests/Conformance/name-resolution-differential-allowlist.txt. The rows pin the verdict class: a fix turns them green, the ratchet then reports them STALE, and they are deleted with the fix.
family
class
rule
code
rows
Read
Ice
N7
SPY0908, CS0176
96
These are the self.x cells from every self-bearing body (method, __init__, accessor get and set, nested def and lambda in a method, nested class method): the receiver self column of this issue's matrix, over const, @static property and @static method. Inherited receivers are in the declaring-type cells.
Drain set after P77b (name-resolution differential, branch remote/p77b-implement-plan @ 0c0bdcf)
110 rows of src/Sharpy.Compiler.Tests/Conformance/name-resolution-differential-allowlist.txt cite this issue (96 at the plan base 2279c0d), all read Ice. The P77b axes generated the new cells, and each was re-ratcheted by direction. When the cure lands, every one of these rows must drain: a stale row fails the sweep.
New route in H4 (55e7c8f, axis 7): CS1673 at a StaticMethod position.
To list them: grep -n '# #2147' src/Sharpy.Compiler.Tests/Conformance/name-resolution-differential-allowlist.txt
Drain set @ 87ac3853e (P77b, PR #2453 merged into dev): 128 allowlist row(s) cite this issue.
Measured from src/Sharpy.Compiler.Tests/Conformance/name-resolution-differential-allowlist.txt @ 87ac3853e (origin/dev; the name-resolution differential harness, pool 8889, allowlist 2595 rows, 19 cited issues). Each row is a generated cell that pins its verdict class: the fix for this issue turns the cell green, the ratchet then reports the row STALE, and the row is deleted with the fix. This comment supersedes the P77a drain-set comment of 2026-11-05 on this issue (where one exists) and any drain-set comment from the reverted first P77b attempt; the counts here are the merged ones. Family is the first segment of the cell id; the lane is the row's own.
IrCollectionMutation calls the getter and Extend and skips the setter, at every statement position (so it is not P85's class, whose contract is position uniformity). Observable only with a side-effecting setter; the printed count is a COMPARED surface. Axis 8 has no collection × InstanceProperty cell, and P85's generator keeps the collection family off property targets, so this cell is this matrix's: member kind {property with setter} × operator family {collection}. lane:silent-wrong · reach:program.
More cells of this class: a static PROPERTY or static METHOD used through an instance. Measured on dev @ 20909f7 and on PR #2742 @ f792078, with the same result on both (independent review of #2742).
Program
Observed
Expected
class D: @static property s: int = 5 / print(D().s)
SPY0908 (CS0176 'D.S' cannot be accessed with an instance reference)
class C: @static s: int = 1 / class D(C): @static property s: int = 5 / print(D().s)
dev: 1 (silently wrong: the base's field wins over D's own property); #2742: CS0176 behind SPY0908
5 (CPython 3.15 MRO)
The instance route rewrites a static FIELD read to D.S (with SPY0459), but not a static property or method. The third row was a silently wrong value on dev. #2742's first-declaration binding makes it a compile error, and this issue's fix makes it run.
Cell from P77 (#2742) review 6: a generic class's @static read through an instance. Measured with the built binary at dev20909f7 and the #2742 tip 9e39086.
class G[T]: / @static / s: int = 5 / def main() -> None: / print(G[int]().s): SPY0908 CS0305 Using the generic type 'G<T>' requires 1 type arguments, the same at both. Expected 5. The instance route records the open generic as the owner, so the emitter spells G.S. The same happens through a closed subclass: class M[T](C): @static s: int = 5 / class L(M[int]) / L().s.
This is the generic-owner spelling of this issue's instance-receiver read. Its store twin (self.s inside a generic) is on #2435 (comment 6994934758). StaticValueRedeclarationTests on #2742 excludes the cell GenericIntermediateBase × Field × InstanceRead, citing #2435.
Activity
docs(spec): statements — let/const declaration keywords, Stage 1 tran…
antonsynd commentedon Sep 30, 2026
Batching 2026-09-30 @ db8e05b — charter
.claude/plans/remediation-round-2026-09-20-batching.md§3.25, P30 — member-shape/self/static totality (order N19; generator FIRST).Contract: ONE member-shape table {static-ness,
selfpresence, accessor kind, default body, host kind} —MemberClassification— is read by the checker, every validator and the emitter, so a static member reached through an instance, aself-less@staticinterface method, a lambda parameter namedself, an interface default accessor body, or a setter parameter annotation is decided in Semantic and emitted from that decision, never refused by Roslyn. Generator FIRST: an emit-and-Roslyn-compile sweep over host × member kind × body × receiver ×selfposition (theILCompilesharness shape), allowlist ratchet. This cell: a const/static member reached through an instance receiver lowers to type-qualified access from the recorded member kind (statements.md: "works but discouraged"); matrix member kind {const, static field, static method, static property} × receiver {instance local,self, call result} × host {class, struct}, underrun. Lane / reach: ice · program. Class tracker: #2051. No seam hypothesis — the plan measures the seam.antonsynd commentedon Oct 29, 2026
Cell: a
@staticPROPERTY read through an instance receiver (found by P21h's re-verify)This is the property-kind sibling of this issue's const/static-field cells: member access through an instance doesn't check a property's staticness, so the generated C# hits CS0176.
run@ 9aae969 (measured)run@ 735d84d (P21h, measured)C.aIt is pre-existing and P21h doesn't change it.
antonsynd commentedon Nov 5, 2026
CS0176 through an instance receiver: 96 allowlist row(s) drain with this issue.
Measured by the name-resolution differential harness (P77a, #2421) @
5f8a4c4e2. Each row is a generated cell insrc/Sharpy.Compiler.Tests/Conformance/name-resolution-differential-allowlist.txt. The rows pin the verdict class: a fix turns them green, the ratchet then reports them STALE, and they are deleted with the fix.N7These are the
self.xcells from every self-bearing body (method,__init__, accessor get and set, nested def and lambda in a method, nested class method): the receiverselfcolumn of this issue's matrix, over const,@staticproperty and@staticmethod. Inherited receivers are in the declaring-type cells.All 96 rows
5f8a4c4e2and the allowlist file are on localdevuntil the next push.test(p77a): name-resolution differential harness, RED at base, allowl…
test(p77a): verify round: the harness reads what it claimed to read (#…
test(p77b): axis 7 - the struct host at every body position (plan D2 …
test(p77b): axis 8 - the attribute STORE target (plan D2 axis 8, R-KU…
antonsynd commentedon Nov 6, 2026
Drain set after P77b (name-resolution differential, branch
remote/p77b-implement-plan@ 0c0bdcf)110 rows of
src/Sharpy.Compiler.Tests/Conformance/name-resolution-differential-allowlist.txtcite this issue (96 at the plan base 2279c0d), allreadIce. The P77b axes generated the new cells, and each was re-ratcheted by direction. When the cure lands, every one of these rows must drain: a stale row fails the sweep.New route in H4 (55e7c8f, axis 7): CS1673 at a StaticMethod position.
To list them:
grep -n '# #2147' src/Sharpy.Compiler.Tests/Conformance/name-resolution-differential-allowlist.txtGenerated by Claude Code
test(p77b): restore READ's outers and the builtins under ReadOuter (D…
test(p77b): R-KX and R-LI, a read above a same-scope declaration is m…
test(p77b): R-KY, a store over a def or type name is must-refuse N6-t…
test(p77b): R-KZ, a match or as capture reused after its arm is must-…
test(p77b): R-LA, a construct target reusing a builtin's name is must…
test(p77b): R-LH, a bare store over a method's name is must-refuse SP…
test(p77b): R-LF's seeds and the global-creates-binding door; two unr…
test(p77b): N3 cycle x route, through a def and in every spelling an …
test(p77b): the struct host at every body position, R-KT's refusal ke…
test(p77b): the report lists the axes named closed, beside each roste…
test(p77b): the refuter's findings: the walrus ruling, @static throug…
antonsynd commentedon Nov 7, 2026
Drain set @
87ac3853e(P77b, PR #2453 merged intodev): 128 allowlist row(s) cite this issue.Measured from
src/Sharpy.Compiler.Tests/Conformance/name-resolution-differential-allowlist.txt@87ac3853e(origin/dev; the name-resolution differential harness, pool 8889, allowlist 2595 rows, 19 cited issues). Each row is a generated cell that pins its verdict class: the fix for this issue turns the cell green, the ratchet then reports the row STALE, and the row is deleted with the fix. This comment supersedes the P77a drain-set comment of 2026-11-05 on this issue (where one exists) and any drain-set comment from the reverted first P77b attempt; the counts here are the merged ones. Family is the first segment of the cell id; the lane is the row's own.All 128 row(s)
Generated by Claude Code
antonsynd commentedon Nov 8, 2026
Cell (receiver × member-kind matrix, property write side) — measured @ b5bd254 with
sharpyc run, python 3.13.18; found while verifying P85 (plan-5cfc2b, #2439).A collection augmented store through a property with a custom setter never runs the setter:
m(), setter calls[2, 3] 1(after init)[1, 2, 3] 2IrCollectionMutationcalls the getter andExtendand skips the setter, at every statement position (so it is not P85's class, whose contract is position uniformity). Observable only with a side-effecting setter; the printed count is a COMPARED surface. Axis 8 has no collection × InstanceProperty cell, and P85's generator keeps the collection family off property targets, so this cell is this matrix's: member kind {property with setter} × operator family {collection}. lane:silent-wrong · reach:program.Generated by Claude Code
antonsynd commentedon Nov 18, 2026
More cells of this class: a static PROPERTY or static METHOD used through an instance. Measured on
dev@ 20909f7 and on PR #2742 @ f792078, with the same result on both (independent review of #2742).class D: @static property s: int = 5/print(D().s)5class D: @static def m() -> int: return 6/print(D().m())6class C: @static s: int = 1/class D(C): @static property s: int = 5/print(D().s)1(silently wrong: the base's field wins over D's own property); #2742: CS0176 behind SPY09085(CPython 3.15 MRO)The instance route rewrites a static FIELD read to
D.S(with SPY0459), but not a static property or method. The third row was a silently wrong value ondev. #2742's first-declaration binding makes it a compile error, and this issue's fix makes it run.lane:ice · reach:program
Generated by Claude Code
antonsynd commentedon Nov 19, 2026
Cell from P77 (#2742) review 6: a generic class's
@staticread through an instance. Measured with the built binary atdev20909f7 and the #2742 tip 9e39086.class G[T]:/@static/s: int = 5/def main() -> None:/print(G[int]().s): SPY0908 CS0305Using the generic type 'G<T>' requires 1 type arguments, the same at both. Expected5. The instance route records the open generic as the owner, so the emitter spellsG.S. The same happens through a closed subclass:class M[T](C): @static s: int = 5/class L(M[int])/L().s.This is the generic-owner spelling of this issue's instance-receiver read. Its store twin (
self.sinside a generic) is on #2435 (comment 6994934758).StaticValueRedeclarationTestson #2742 excludes the cell GenericIntermediateBase × Field × InstanceRead, citing #2435.Generated by Claude Code