From c2e968a3e2c65a360e4ca733007d3a8c9730fe88 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 03:48:56 +0000 Subject: [PATCH 01/22] process(plan): plan-777361 (P78) draft MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Draft of the P78 plan (N1/N2/N4/N7: scope decides meaning; #2423 #2398 #2432; charter §3.20l, full (c)). Stage 0 is specified and not landed: it waits on the owner's answers listed with the plan pull request. Measured @ e24aaf9f0; check_plan_refs: RESULT OK, body 19,426 / 20,480. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01LGMKZVcFYGqQRfHgd16DLa --- docs/process/plans/plan-777361.md | 145 ++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 docs/process/plans/plan-777361.md diff --git a/docs/process/plans/plan-777361.md b/docs/process/plans/plan-777361.md new file mode 100644 index 000000000..59714d8e3 --- /dev/null +++ b/docs/process/plans/plan-777361.md @@ -0,0 +1,145 @@ + + +# P78 — N1/N2/N4/N7: scope decides meaning + +## Context + +Rules N1, N2, N4 and N7 of `docs/design/name-resolution.md` (charter §3.20l): #2423 (tracker), #2398, #2432. The rule table #2487 is the group's generator row (R-LO); #2426 closes here. + +## Current State + +`sharpyc run` (Debug) @ e24aaf9f0; python is CPython 3.15.2. +- **Order decides (N1).** A function reading a module variable declared below it, and a module initializer reading a later one, are SPY0200 (python `3`; NameError by order only). `@static a: int = b + 1` above `b` is SPY0200 bare and runs `5` as `H.b`; an instance initializer splits the same way. +- **Kind decides (N2, N4).** Under a module binding of the name, a later `@static` yields (`64`, as python), a later literal `const` outranks (`3`, python `10`; in a parameter default `2`, python `7`), a later computed `const` is SPY0618. +- **A forward read is untyped.** `b: bool = ` is SPY0908 CS0029; at the earlier order SPY0220. +- **Bodies (#2398).** A nested type's initializer reading the enclosing type's `@static` or instance field: SPY0909. A lambda in an initializer: the method-body steer. `@static def len()` then `v: int = len()`: SPY0224. An interface or union parameter default: SPY0200 + SPY0401. A parameter `x` called as `x()` under a module `def x`: `12` (python `1`). +- **Constant positions (#2432).** Enum member `RED = x` / `= x()`: CS0133. A default through a `@static property`, `math.pi`, `socket.AF_INET`: CS1736. `= 1 < 2 < 3`: SPY0401 (python `True`). +- **No initializer (R-QI).** Module `x: int` and `@static t: int`, read: `0` (python NameError). +- **Instruments.** `NameResolutionDifferentialTests`, `ClassBodyReadPositionMatrixTests`, `StaticInitializerOrderMatrixTests` and the `ConstantPositionValidator` tests: 299/0/0 (sweep 7 m 29 s; pool 8951 = `CellBudget`; python agrees on 8951). Allowlist rows: 1117 / 6 / 27 cite #2423 / #2398 / #2432. #2423's by rule: N2 343, instance-at-initializer 250, N1-type-error 97, N1-innermost 96, N1 90, N1-nesting 61, N7 32, seeds 27, SPY0401 25, N1+N3 24, N2-module 24, R-Y 20, N3 10, others 18. Scorecard: seed 2377, outside 572. The sweep is one test: R-QH's split has not landed. + +## Scope + +- **Group:** P78 (chores: none). #2432 stays in (R-KV lets the author split it): 27 of 1150 rows, on `TypeBodyMembership` and the interface/union cell #2398 shares. +- **Tier:** full (c: the seam is under `Semantic/`) — from charter §3.20l +- **Alone:** no — verdicts, not layout; no snapshot moves (A12) +- **Gates:** 1 +- **Filing:** findings ledger; the lead files by class (contract §10) +- **Override:** none + +## Defect Class + +- **Violated contract:** what a module-level or class-level name means, the type a read of it has, and whether the read is legal are one answer for every binding kind, declaration order, spelling and reading position; where python's top-to-bottom reading means something else the read is refused under one code; a constant position refuses a non-constant itself. +- **Meta-class:** silent wrong behavior; position/route missing a shared check; SPY0908 as a net (#2432, the untyped forward read) → **standard cure:** one resolution seam per scope, a semantic-time refusal, the conformance sweep. +- **Known member cells:** #2423, #2398, #2432; the folded #2415 (C08) and #2416 method-group cells; R-QI's cells (#2427, comment 6967863739). +- **Sibling cells this plan must also cover:** none listed; see Generator. +- **Lane / reach:** false-refusal + silent-wrong + ice · program; **fidelity-scope row:** "which programs run vs. are refused" and "value of an expression", both COMPARED. +- **Standing harness that should have caught it:** `NameResolutionDifferentialTests` (it does: 1150 rows). `ClassBodyReadPositionMatrixTests` is the hand control (R-KF) for the one axis the generator cannot judge: steer text and diagnostic count per position × host. +- **Generator:** stage 0 (§2.1), in `NameResolutionDifferentialTests` (R-LO: the executor) — **not landed at this draft**; it waits on the owner's answers to the questions in the plan pull request, and no pass runs before it lands. **S0a:** the #2487 table as data beside the allowlist: rows of axis classes → tag and rule id, each axis a typed `NameCell` property; every cell matches exactly one row, whose tag and rule are the cell's and what the sweep judges by; every row has a cell; `RuleAxes` is deleted. **S0b:** the cells the pool lacks (0 of its 8951 programs carry any): R-QI's binding kind × initializer; `b: bool = ` per binding kind; a parameter or loop target in callee position; #2432's expression kinds {Stdlib module attribute, comparison chain}; a later `__init__` overload. Excluded, each by a named exclusion: the project route (A3's hand controls) and message text (the hand control). Counts and known-red rows: measured at the stage-0 sha. +- **Owner rulings:** R-KD, R-KF, R-KG, R-KJ, R-KV, R-LJ, R-LO, R-PM, R-QE, R-QI (charter §4); #2432's call-43 and call-45 cells (§3.20l). + +## Adversarial Review (pre-mortem) + +- **Alternative root cause:** "bodies are checked in textual order" — refuted: the same function reads a later `const`, `def`, class and module property (`3`, `4`); only the variable's symbol is missing. The `bool` probe shows the second cause: a symbol that exists is still untyped until its declaration is checked (D2). +- **Alternative layer:** scoping has no `.spy`, dunder or protocol spelling; D8's module-attribute arm is rung 3. +- **How the fix could be inert:** D1 without D2 prints `3` and leaves CS0029; F2's yield one branch above the N2 refusal keeps `64`; a callee site left on its own lookup keeps `12`. +- **Before/after by direction:** newly refused and `worked`, each ruled: the N2 cells (`6`, `64`, `3`, `2`; R-KD, R-KJ); a module initializer under a later same-named declaration (`7`, python `2`; R-LJ); a module or `@static` declaration with no initializer (R-QI; a regex census of 4,384 `.spy` files finds none). Unruled, the owner's: an unused alias to a missing type (D10). Newly running: every order-only refusal. A8 is the record. +- **Blast radius:** every project and sweep of the commit gate; Stdlib.Tests (the `.spy` stdlib's module variables), cold/warm and `FrontEndParityTests` first. +- **Generated artifacts touched:** none may move: spy-stdlib C#, spy-test C# and `.expected.cs` are regenerated after T1 and T4 and an empty diff is the guard (A12); the oracle ledger follows `docs/deviations.yaml` at T11. + +## Design Decisions + +Python is evidence where it runs the same program: a NameError by order only becomes a running program (N1 + N3), a different meaning a refusal (N2). D7 and D8 are the tie-breaks' compile error over a silent default or a C# error. No rule below reads a builtin or type name; a rung applies only in D8. +- **D1 (module variables are declared before any read; Semantic).** `NameResolver.ResolveDeclaration` declares every module-level `VariableDeclaration`, annotated or `auto`, as it does a `const` (a module `let` stays SPY0340, P21b); `TypeChecker.CheckVariableDeclaration` completes that symbol and creates none at module level. A second declaration of the name keeps today's verdict (#2125, P21b). Predicates: no module-level `VariableSymbol` is created by `TypeChecker`; a module's export of a variable is its declared symbol on a cold and a warm build, so `ImportedStaticFacts.ImportedStorage` is deleted. +- **D2 (a read is typed whatever the order; Semantic).** The annotated module variables join `CheckModule`'s const type pre-pass. A module-level or type-level value with no annotation is checked on its first read, in its own declaration's scope state, under an in-progress mark; a read that re-enters its own inference is SPY0240 with the annotate steer. Predicate: no read of a declared module-level or type-level name is `Unknown` because of where the declaration stands. +- **D3 (one class-body rule: N1, N2, N4, N7).** `TryResolveClassBodySiblingRead` decides a bare read of a member its type body declares by four facts only — the member's level (`const` / `@static`, or instance), its order against the reader (earlier, or at-or-after), whether a binding outside the body holds the name (module, enclosing scope, import, builtin), and the position. Earlier: the member. At-or-after with an outer binding: SPY0619, in every position and for every member kind, instance included — N2 is judged before the kind refusal and before SPY0401. At-or-after with none: the member, a forward read (N3); a self read is the cycle graph's SPY0278. Where N2 does not apply an instance member keeps its kind refusal and never yields, a parameter default keeps SPY0401 for a non-constant, and an inherited member keeps R1 (b). Deleted: F1's refusal, F2's yield, the `const` exemption in `IsDeclaredLater`, `ReportAmbiguousLaterConstReads`, SPY0618. Predicate: the verdict never reads `IsConstant`, the compile-time fact or the spelling. +- **D4 (bodies do not see class names: N1, R-KG).** `Scope.ResolveName` crosses a type body from a nested type's body as it does from a function-like scope, so no enclosing type's symbol binds there. `ClassifyClassBodyReadPosition` names three more positions — a nested type's body, a lambda in an initializer, a comprehension's body (all but its first iterable) — each with its own phrase in the one SPY0200 steer (`Outer.s` where that compiles, no steer where nothing does). With an outer binding the read is that binding (R-Y), recorded through `SetModuleAccessCrossesClassMember` for an imported name as for a module variable. Predicate: every scope kind between a read and a type body is classified, with no default arm. +- **D5 (one callee resolver).** A bare callee resolves by the scope walk a bare read uses — local, parameter, class-body sibling at a class-body position, module, builtin — and dispatches on the symbol it bound. The 33 direct `LookupFunctionOverloads` / `BuiltinRegistry.GetFunction` / `GetFunctionOverloads` sites in `TypeChecker*.cs` go behind it; a census test pins the remainder at the helper's own. A constructor's overload set is the whole body's. +- **D6 (N2 at module level; R-LJ).** A module-level initializer or property default that reads, at load, a builtin or imported name its module also declares at or after the reader is SPY0619. A function body is not such a position. +- **D7 (R-QI).** A module variable, a `@static` field, and a module or `@static` auto-property with no initializer is SPY0620 at its declaration; the steer names `x: T = ` and `x: T | None = None`. Untouched: an instance field, a local `x: T`, a property with accessor bodies. +- **D8 (#2432; Validation).** `ConstantPositionValidator` judges an enum member's value (a new `AdmissionTable` row) and pushes interface and union hosts on `_enclosingTypes`. `IsMemberConstAdmissible` answers for every member access the checker bound, by what the member is: true for a `const` whose fact is true through any receiver, for an enum member and its `.value`, and — rung 3, since a constant in a referenced assembly has no Sharpy symbol — for a CLR literal field read through `ClrTypeBridge`; false for a `@static` field, property or method, own or inherited. The shape rule keeps only what the checker did not bind. A `ComparisonChain` is admitted when each link is. Predicate: no expression a constant position admits is CS0133 or CS1736, and no constant it admits today is refused. **Open, the owner's:** the harness tags 9 such cells must-refuse (rows citing #2423: an enum member's `.value`, a literal `const` through a subclass name; each runs, and python prints the same where it runs); D8 keeps them running, so their tags move only on the owner's word. +- **D9 (codes).** SPY0619 (N2; the text carries both readings and the qualified spelling) and SPY0620 (R-QI), each with its `DiagnosticExplanations` entry; SPY0618 retires. SPY0200 stays where no binding is visible at the position. In the table a read at-or-after its member under an outer binding is N2's whatever its target or position (381 cells leave `kind:instance-at-initializer`, 169 leave `SPY0401`), N2 and N2-module admit SPY0619 alone, and `kind:enum-member-constant` SPY0401. +- **D10 (open, the owner's).** `type K0 = nosuch`, unused, compiles and runs today; it is refused at the alias (SPY0202) only on the owner's word, and until then it is no cell of this plan. +- **Out of contract:** a read above a same-scope local (R-KX, P80); a store without `global` (P79); a walrus over `let` (P21b); `ALSO = RED` (#2069, P23); an untyped `@static property` read (#2417); the #2397 rows (P16); `T !E` above its `E` (its row cites #2249, P52); `from m import x` as a live alias (N6). + +## Implementation + +### Phase 1: Names are order-free and typed (N1) + +**Goal:** a module-level name has one symbol and one type from every position. + +**Acceptance:** +- **A1.** #2423's module-level rows under N1, N1-nesting and N3 drain (143) — **M1:** declare only annotated variables → the `auto` cells red +- **A2.** S0b's `bool` cells are SPY0220 at both orders — **M2:** drop the first-read check → CS0029 +- **A3.** One symbol: `StaticStorageFactsRoundTripTests` and `ColdWarmBuildDifferentialTests` hold a variable's export equal to its declared symbol, cold and warm, with a project control per importer form — **M3:** create the symbol in `CheckVariableDeclaration` again → the cold cell red +- **A4.** The 96 local rows (N1-innermost) and the module-level N1-type-error and N1-arity rows (46) drain, and S0b's callee cells print python's value — **M4:** send one site back to `LookupFunctionOverloads` → red, and the census pin red + +#### Tasks + +- **T1. Declare module variables (D1)** — `NameResolver.Declarations.cs`, `NameResolver.Members.cs`, `TypeChecker.Statements.cs`, `ProjectCompiler.Phases.cs`, `StaticStorageFacts.cs`; then regenerate (A12). (A1, A3) +- **T2. Types before reads (D2)** — `TypeChecker.cs`, `TypeChecker.Statements.cs`, `TypeChecker.Definitions.cs`. (A2) +- **T3. One callee resolver (D5)** — `TypeChecker.Expressions.Access.Calls.cs`, `TypeChecker.Expressions.Access.Calls.Overloads.cs`, the census in `DispatchSiteInventoryTests`. (A4) + +### Phase 2: Ambiguity and bodies (N2, N4, N7, R-KG, R-QI) + +**Goal:** one verdict and one code per read. + +**Acceptance:** +- **A5.** #2423's type-level rows under N2, instance-at-initializer, N1-type-error, N7, N1+N3, N1 and SPY0401 (742) and its N2-module rows (24) drain, C08's pin in `StaticInitializerOrderMatrixTests` moves to SPY0619, and no cell under N2 or N2-module answers with another code — **M5:** restore F2's yield → `64`; restore the `const` exemption → `3`; report under SPY0200 → red; let a function body count for D6 → its controls red +- **A6.** The 6 #2398 rows and #2423's R-Y, N1-methods and R-KG rows (30) drain; the hand control, with scope {own body, nested type at one and two levels, lambda in an initializer, comprehension body} × host {class, struct, interface, union}, holds one diagnostic whose phrase is its position's — **M6:** drop D4's crossing → SPY0909; give the lambda the method-body text → red +- **A7.** S0b's R-QI cells are SPY0620; their controls (an initializer; an instance field set in `__init__`; a local `x: T`; an accessor-bodied property) run — **M7:** skip `@static` → red; include instance fields → the control red +- **A8.** Direction record: every fixture, spec block and `.spy` stdlib module newly SPY0619 or SPY0620, each with its prior behaviour; none `worked` outside the rulings named above + +#### Tasks + +- **T4. The class-body rule (D3)** — `TypeChecker.ClassScopeRule.cs`, `TypeBodyMembership.cs`; then regenerate (A12). (A5) +- **T5. Bodies and nested types (D4)** — `Scope.cs`, `SymbolTable.cs`, `TypeChecker.ClassScopeRule.cs`. (A6) +- **T6. N2 at module level (D6)** — `TypeChecker.Expressions.cs`. (A5) +- **T7. No-initializer refusal (D7)** — `TypeChecker.Statements.cs`, `TypeChecker.Definitions.cs`. (A7) +- **T8. Codes (D9)** — `DiagnosticCodes.cs`, `DiagnosticExplanations.Semantic.cs`; the harness's `AdmittedRefusals`. (A5, A7) +- **T9. Hand control** — `ClassBodyReadPositionMatrixTests`: its literal copy of the contract becomes D3 and D4. (A6) + +### Phase 3: Constant positions (#2432) + +**Goal:** a constant position's verdict is the checker's. + +**Acceptance:** +- **A9.** The 27 #2432 rows drain to SPY0401; D8's 9 open rows keep running; S0b's cells: `math.pi` runs, a non-literal module attribute is SPY0401, a chain is admitted exactly when its links are — **M9:** answer null for a bound non-constant member → CS1736; skip the enum row → CS0133; admit every chain → `0 < 2 in [1, 2]` reaches C# +- **A10.** An interface or union parameter default draws one diagnostic — **M10:** drop either push → two + +#### Tasks + +- **T10. The validator (D8)** — `ConstantPositionValidator.cs`, `ConstantDefaultClassifier.cs`, `ConstEligibility.cs`. (A9, A10) + +### Phase 4: Spec and record + +**Acceptance:** +- **A11.** `docs/language_specification/variable_scoping.md` is rewritten around N1–N7: each rule's example executed, each printing something else with its rule off; an `error` block per refusal; the F1, F2, R-JJ and SPY0618 texts gone; touched files drained (R-BG). `docs/language_specification/variable_declaration.md` § Bare Declarations states D7. `docs/deviations.yaml`: `class-body-bare-name-read` is N1 and N2's text. `docs/design/name-resolution.md`: the *Today* notes of N1, N2 and N4 removed, the table named as the source. `check_spec_blocks.sh` green +- **A12.** `regen: no diff` after T1 and after T4, for spy-stdlib C#, spy-test C# and `.expected.cs`; `FrontEndParityTests` green +- Allowlists drain, each row in the commit that turns it green: every #2423, #2398 and #2432 row and every S0b row; `allowlist_rows_seed` lowered with `--lower` + +#### Tasks + +- **T11. Spec, deviation row, design doc** — the files A11 names. (A11) + +## Testing Strategy + +- Fixtures: one `.spy` + `.expected` per rule and one `.error` per refusal (SPY0619 in a class body and at module level, SPY0620, SPY0200 with each D4 phrase, SPY0401 at an enum member), each with its running control: the same read qualified, the same declaration with an initializer. +- Change of axis beyond the issues: host {struct, interface, union}; reader {property default, synthesized-constructor field}; outer {import, builtin, enclosing function}; the project route (A3). +- Outputs discriminate: member and outer values differ in every cell; an initializer's default is never a member's value. +- Spec: A11, a deliverable of equal weight. +- Blast radius and regeneration: A12, early, never at push time. + +## Issues to Close + +- #2423 — closed by T1–T9; **close criterion:** A1–A8 @ sha, 0 rows citing it +- #2398 — closed by T5, T9, T10; **close criterion:** A6 and A10 @ sha +- #2432 — closed by T10; **close criterion:** A9 @ sha +- #2426 — closed by T11; **close criterion:** A11 @ sha +- #2487 — closed by stage 0 and T11; **close criterion:** S0a's totality test and its two mutations @ the stage-0 sha, and A11's pointer + +## Class trackers this plan may post cells to + +- #2427 — the name-resolution principle +- #2457 — the harness's residue (P77c) +- #2486 — the rule tables +- #2397, #2417, #2069, #2249 — neighbouring classes named under Out of contract From 811c30aee2e9bb58388e547f7f4bdb5573ab47fc Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 03:51:34 +0000 Subject: [PATCH 02/22] process(plan): plan-777361 (P78) draft, measured corrections Corrections to the draft from measurements @ e24aaf9f0: math.pi and socket.AF_INET are module variables of the .spy stdlib, so D8 refuses them (SPY0401) and subprocess.PIPE is the admitted control; N2 at module level covers every read at load of a builtin name; a redeclared import stays SPY0204; a nested type is a class-level member in D3; the 32 N7 rows on a nested type through self or an alias are R-LQ's (P16), an owner question; N1-arity names its code. check_plan_refs: RESULT OK, body 19,880 / 20,480. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01LGMKZVcFYGqQRfHgd16DLa --- docs/process/plans/plan-777361.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/process/plans/plan-777361.md b/docs/process/plans/plan-777361.md index 59714d8e3..b121f73f8 100644 --- a/docs/process/plans/plan-777361.md +++ b/docs/process/plans/plan-777361.md @@ -51,14 +51,14 @@ Rules N1, N2, N4 and N7 of `docs/design/name-resolution.md` (charter §3.20l): # Python is evidence where it runs the same program: a NameError by order only becomes a running program (N1 + N3), a different meaning a refusal (N2). D7 and D8 are the tie-breaks' compile error over a silent default or a C# error. No rule below reads a builtin or type name; a rung applies only in D8. - **D1 (module variables are declared before any read; Semantic).** `NameResolver.ResolveDeclaration` declares every module-level `VariableDeclaration`, annotated or `auto`, as it does a `const` (a module `let` stays SPY0340, P21b); `TypeChecker.CheckVariableDeclaration` completes that symbol and creates none at module level. A second declaration of the name keeps today's verdict (#2125, P21b). Predicates: no module-level `VariableSymbol` is created by `TypeChecker`; a module's export of a variable is its declared symbol on a cold and a warm build, so `ImportedStaticFacts.ImportedStorage` is deleted. - **D2 (a read is typed whatever the order; Semantic).** The annotated module variables join `CheckModule`'s const type pre-pass. A module-level or type-level value with no annotation is checked on its first read, in its own declaration's scope state, under an in-progress mark; a read that re-enters its own inference is SPY0240 with the annotate steer. Predicate: no read of a declared module-level or type-level name is `Unknown` because of where the declaration stands. -- **D3 (one class-body rule: N1, N2, N4, N7).** `TryResolveClassBodySiblingRead` decides a bare read of a member its type body declares by four facts only — the member's level (`const` / `@static`, or instance), its order against the reader (earlier, or at-or-after), whether a binding outside the body holds the name (module, enclosing scope, import, builtin), and the position. Earlier: the member. At-or-after with an outer binding: SPY0619, in every position and for every member kind, instance included — N2 is judged before the kind refusal and before SPY0401. At-or-after with none: the member, a forward read (N3); a self read is the cycle graph's SPY0278. Where N2 does not apply an instance member keeps its kind refusal and never yields, a parameter default keeps SPY0401 for a non-constant, and an inherited member keeps R1 (b). Deleted: F1's refusal, F2's yield, the `const` exemption in `IsDeclaredLater`, `ReportAmbiguousLaterConstReads`, SPY0618. Predicate: the verdict never reads `IsConstant`, the compile-time fact or the spelling. +- **D3 (one class-body rule: N1, N2, N4, N7).** `TryResolveClassBodySiblingRead` decides a bare read of a member its type body declares by four facts only — the member's level (`const`, `@static` or nested type; or instance), its order against the reader (earlier, or at-or-after), whether a binding outside the body holds the name (module, enclosing scope, import, builtin), and the position. Earlier: the member. At-or-after with an outer binding: SPY0619, in every position and for every member kind, instance included — N2 is judged before the kind refusal and before SPY0401. At-or-after with none: the member, a forward read (N3); a self read is the cycle graph's SPY0278. Where N2 does not apply an instance member keeps its kind refusal and never yields, a parameter default keeps SPY0401 for a non-constant, and an inherited member keeps R1 (b). Deleted: F1's refusal, F2's yield, the `const` exemption in `IsDeclaredLater`, `ReportAmbiguousLaterConstReads`, SPY0618. Predicate: the verdict never reads `IsConstant`, the compile-time fact or the spelling. - **D4 (bodies do not see class names: N1, R-KG).** `Scope.ResolveName` crosses a type body from a nested type's body as it does from a function-like scope, so no enclosing type's symbol binds there. `ClassifyClassBodyReadPosition` names three more positions — a nested type's body, a lambda in an initializer, a comprehension's body (all but its first iterable) — each with its own phrase in the one SPY0200 steer (`Outer.s` where that compiles, no steer where nothing does). With an outer binding the read is that binding (R-Y), recorded through `SetModuleAccessCrossesClassMember` for an imported name as for a module variable. Predicate: every scope kind between a read and a type body is classified, with no default arm. - **D5 (one callee resolver).** A bare callee resolves by the scope walk a bare read uses — local, parameter, class-body sibling at a class-body position, module, builtin — and dispatches on the symbol it bound. The 33 direct `LookupFunctionOverloads` / `BuiltinRegistry.GetFunction` / `GetFunctionOverloads` sites in `TypeChecker*.cs` go behind it; a census test pins the remainder at the helper's own. A constructor's overload set is the whole body's. -- **D6 (N2 at module level; R-LJ).** A module-level initializer or property default that reads, at load, a builtin or imported name its module also declares at or after the reader is SPY0619. A function body is not such a position. +- **D6 (N2 at module level; R-LJ).** A read evaluated at load — a module-level or class-level initializer or default — of a builtin name its module declares at or after the reader is SPY0619. A function body is not such a position. An import its module redeclares stays SPY0204 at the declaration, whatever reads it. - **D7 (R-QI).** A module variable, a `@static` field, and a module or `@static` auto-property with no initializer is SPY0620 at its declaration; the steer names `x: T = ` and `x: T | None = None`. Untouched: an instance field, a local `x: T`, a property with accessor bodies. - **D8 (#2432; Validation).** `ConstantPositionValidator` judges an enum member's value (a new `AdmissionTable` row) and pushes interface and union hosts on `_enclosingTypes`. `IsMemberConstAdmissible` answers for every member access the checker bound, by what the member is: true for a `const` whose fact is true through any receiver, for an enum member and its `.value`, and — rung 3, since a constant in a referenced assembly has no Sharpy symbol — for a CLR literal field read through `ClrTypeBridge`; false for a `@static` field, property or method, own or inherited. The shape rule keeps only what the checker did not bind. A `ComparisonChain` is admitted when each link is. Predicate: no expression a constant position admits is CS0133 or CS1736, and no constant it admits today is refused. **Open, the owner's:** the harness tags 9 such cells must-refuse (rows citing #2423: an enum member's `.value`, a literal `const` through a subclass name; each runs, and python prints the same where it runs); D8 keeps them running, so their tags move only on the owner's word. -- **D9 (codes).** SPY0619 (N2; the text carries both readings and the qualified spelling) and SPY0620 (R-QI), each with its `DiagnosticExplanations` entry; SPY0618 retires. SPY0200 stays where no binding is visible at the position. In the table a read at-or-after its member under an outer binding is N2's whatever its target or position (381 cells leave `kind:instance-at-initializer`, 169 leave `SPY0401`), N2 and N2-module admit SPY0619 alone, and `kind:enum-member-constant` SPY0401. -- **D10 (open, the owner's).** `type K0 = nosuch`, unused, compiles and runs today; it is refused at the alias (SPY0202) only on the owner's word, and until then it is no cell of this plan. +- **D9 (codes).** SPY0619 (N2; the text carries both readings and the qualified spelling) and SPY0620 (R-QI), each with its `DiagnosticExplanations` entry; SPY0618 retires. SPY0200 stays where no binding is visible at the position. In the table a read at-or-after its member under an outer binding is N2's whatever its target or position (381 cells leave `kind:instance-at-initializer`, 169 leave `SPY0401`), N2 admits SPY0619 alone, N2-module SPY0619 and D6's SPY0204, `kind:enum-member-constant` SPY0401, and `N1-arity` names its code. +- **D10 (open, the owner's).** `type K0 = nosuch`, unused, compiles and runs today; it is refused at the alias (SPY0202) only on the owner's word, and until then it is no cell of this plan. The 32 N7 rows citing #2423 are `self.N()` / `A.N()` on a nested type, which R-LQ gave P16 (#2397): re-cited there on the owner's word, else D3 admits them. - **Out of contract:** a read above a same-scope local (R-KX, P80); a store without `global` (P79); a walrus over `let` (P21b); `ALSO = RED` (#2069, P23); an untyped `@static property` read (#2417); the #2397 rows (P16); `T !E` above its `E` (its row cites #2249, P52); `from m import x` as a live alias (N6). ## Implementation @@ -84,7 +84,7 @@ Python is evidence where it runs the same program: a NameError by order only bec **Goal:** one verdict and one code per read. **Acceptance:** -- **A5.** #2423's type-level rows under N2, instance-at-initializer, N1-type-error, N7, N1+N3, N1 and SPY0401 (742) and its N2-module rows (24) drain, C08's pin in `StaticInitializerOrderMatrixTests` moves to SPY0619, and no cell under N2 or N2-module answers with another code — **M5:** restore F2's yield → `64`; restore the `const` exemption → `3`; report under SPY0200 → red; let a function body count for D6 → its controls red +- **A5.** #2423's type-level rows under N2, instance-at-initializer, N1-type-error, N1+N3, N1 and SPY0401 (710) and its N2-module rows (24) drain, C08's pin in `StaticInitializerOrderMatrixTests` moves to SPY0619, and no cell under N2 answers with another code — **M5:** restore F2's yield → `64`; restore the `const` exemption → `3`; report under SPY0200 → red; let a function body count for D6 → its controls red - **A6.** The 6 #2398 rows and #2423's R-Y, N1-methods and R-KG rows (30) drain; the hand control, with scope {own body, nested type at one and two levels, lambda in an initializer, comprehension body} × host {class, struct, interface, union}, holds one diagnostic whose phrase is its position's — **M6:** drop D4's crossing → SPY0909; give the lambda the method-body text → red - **A7.** S0b's R-QI cells are SPY0620; their controls (an initializer; an instance field set in `__init__`; a local `x: T`; an accessor-bodied property) run — **M7:** skip `@static` → red; include instance fields → the control red - **A8.** Direction record: every fixture, spec block and `.spy` stdlib module newly SPY0619 or SPY0620, each with its prior behaviour; none `worked` outside the rulings named above @@ -103,7 +103,7 @@ Python is evidence where it runs the same program: a NameError by order only bec **Goal:** a constant position's verdict is the checker's. **Acceptance:** -- **A9.** The 27 #2432 rows drain to SPY0401; D8's 9 open rows keep running; S0b's cells: `math.pi` runs, a non-literal module attribute is SPY0401, a chain is admitted exactly when its links are — **M9:** answer null for a bound non-constant member → CS1736; skip the enum row → CS0133; admit every chain → `0 < 2 in [1, 2]` reaches C# +- **A9.** The 27 #2432 rows drain to SPY0401; D8's 9 open rows keep running; S0b's cells: `subprocess.PIPE`, a CLR literal, runs (`-1` today); `math.pi` and `socket.AF_INET`, module variables of the `.spy` stdlib, are SPY0401 (python runs them: a ledger cell, Stdlib's); a chain is admitted exactly when its links are — **M9:** answer null for a bound non-constant member → CS1736; skip the enum row → CS0133; admit every chain → `0 < 2 in [1, 2]` reaches C# - **A10.** An interface or union parameter default draws one diagnostic — **M10:** drop either push → two #### Tasks @@ -131,7 +131,7 @@ Python is evidence where it runs the same program: a NameError by order only bec ## Issues to Close -- #2423 — closed by T1–T9; **close criterion:** A1–A8 @ sha, 0 rows citing it +- #2423 — closed by T1–T9; **close criterion:** A1–A8 @ sha, 0 rows citing it (D8's 9 and D10's 32 by their answers) - #2398 — closed by T5, T9, T10; **close criterion:** A6 and A10 @ sha - #2432 — closed by T10; **close criterion:** A9 @ sha - #2426 — closed by T11; **close criterion:** A11 @ sha From e5991c88709e7afed6ef200f7109b298b527bfef Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 03:52:27 +0000 Subject: [PATCH 03/22] process(plan): plan-777361 (P78) draft, #2426's open items in A11 A11 names what #2426 still owes at its close (its comments of 2026-11-06 and 2026-11-07). check_plan_refs: RESULT OK, body 20,090 / 20,480. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01LGMKZVcFYGqQRfHgd16DLa --- docs/process/plans/plan-777361.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/process/plans/plan-777361.md b/docs/process/plans/plan-777361.md index b121f73f8..d2422d96c 100644 --- a/docs/process/plans/plan-777361.md +++ b/docs/process/plans/plan-777361.md @@ -113,7 +113,7 @@ Python is evidence where it runs the same program: a NameError by order only bec ### Phase 4: Spec and record **Acceptance:** -- **A11.** `docs/language_specification/variable_scoping.md` is rewritten around N1–N7: each rule's example executed, each printing something else with its rule off; an `error` block per refusal; the F1, F2, R-JJ and SPY0618 texts gone; touched files drained (R-BG). `docs/language_specification/variable_declaration.md` § Bare Declarations states D7. `docs/deviations.yaml`: `class-body-bare-name-read` is N1 and N2's text. `docs/design/name-resolution.md`: the *Today* notes of N1, N2 and N4 removed, the table named as the source. `check_spec_blocks.sh` green +- **A11.** `docs/language_specification/variable_scoping.md` is rewritten around N1–N7: each rule's example executed, each printing something else with its rule off; an `error` block per refusal; the F1, F2, R-JJ and SPY0618 texts gone; touched files drained (R-BG). `docs/language_specification/variable_declaration.md` § Bare Declarations states D7. `docs/deviations.yaml`: `class-body-bare-name-read` is N1 and N2's text. `docs/design/name-resolution.md`: the *Today* notes of N1, N2 and N4 removed, the table named as the source. #2426's other open items (the block-scope list's `match` case and loop-`else` bodies, the `case x:` constant-pattern row, the walrus and `let` texts) are fixed, or marked pending with the issue that owns each. `check_spec_blocks.sh` green - **A12.** `regen: no diff` after T1 and after T4, for spy-stdlib C#, spy-test C# and `.expected.cs`; `FrontEndParityTests` green - Allowlists drain, each row in the commit that turns it green: every #2423, #2398 and #2432 row and every S0b row; `allowlist_rows_seed` lowered with `--lower` From ff40b21a91043a99567ffa53506bc008b569424f Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 04:52:03 +0000 Subject: [PATCH 04/22] test(conformance): P78 stage 0: re-cite 32 nested-type rows to #2397 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stage 0 of plan-777361 (P78; contract §11), first commit. Test code and its allowlist only: no product path. 32 rows of name-resolution-differential-allowlist.txt cited #2423 and are `self.N()` / `A.N()` on a nested type: rule N7, tagged must-run, refused SPY0203 (22 through `self.`, 10 through an alias). R-LQ admits that call and gave it to P16, so the cell is #2397's (the owner's ruling of 2026-11-20, #2423 comment 7030074628: "the 32 N7 rows citing #2423 that are `self.N()` / `A.N()` on a nested type are R-LQ's (P16) and are re-cited to #2397"; the cell is posted on #2397, comment 7030092843). A row's cite is the route's, so the route gains the arm: a false refusal of an N7 read whose target is a nested type is #2397 (NameResolutionDifferentialTests.ImplementingIssue). The sweep holds every row to its route, so a row re-cited by hand alone is red. Rows: 2377 unchanged; citing #2423 1117 -> 1085, citing #2397 207 -> 239. No baseline moves. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01LGMKZVcFYGqQRfHgd16DLa --- .../NameResolutionDifferentialTests.cs | 4 ++ ...name-resolution-differential-allowlist.txt | 64 +++++++++---------- 2 files changed, 36 insertions(+), 32 deletions(-) diff --git a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.cs b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.cs index 5eb7e478c..30c97af5c 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.cs @@ -593,6 +593,10 @@ private static string ImplementingIssue(NameCell cell, VerdictClass verdict, Sha // A nested-scope `def` over a same-function `def` of the name is SPY0204: #1974's question, whose B-rules admit nested shadowing. if (cell.Rule == "#1974") return "#1974"; + // `self.N()` / `A.N()` on a nested type is refused as no such member (SPY0203). R-LQ admits it, in P16: the cell is + // #2397's (the owner's ruling of 2026-11-20, #2423 comment 7030074628). + if (cell.Target == BindingKind.NestedType && cell.Rule == "N7") + return "#2397"; // A read refused at a module initializer is refused because a later module VARIABLE is not visible yet (SPY0200): N1's // order-free resolution is the cure, and values-ready (#2422) cannot make a name visible (owner, 2026-11-16, #2422 // comment 6920337855). diff --git a/src/Sharpy.Compiler.Tests/Conformance/name-resolution-differential-allowlist.txt b/src/Sharpy.Compiler.Tests/Conformance/name-resolution-differential-allowlist.txt index e9259c2f4..fab6071e6 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/name-resolution-differential-allowlist.txt +++ b/src/Sharpy.Compiler.Tests/Conformance/name-resolution-differential-allowlist.txt @@ -1096,31 +1096,31 @@ read/ModuleVar/StaticMethodBody/Later/Bare/outer=None FalseRefusal # #2423 false read/ModuleVar/StaticPropertyDefault/Later/Bare/outer=None FalseRefusal # #2423 false-refusal read/NestedType/AccessorGetBody/Earlier/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/AccessorGetBody/Earlier/Bare/outer=None Ice # #2397 ice -read/NestedType/AccessorGetBody/Earlier/SelfDot/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/AccessorGetBody/Earlier/SelfDot/outer=None FalseRefusal # #2397 false-refusal read/NestedType/AccessorGetBody/Later/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/AccessorGetBody/Later/Bare/outer=None Ice # #2397 ice -read/NestedType/AccessorGetBody/Later/SelfDot/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/AccessorGetBody/Later/SelfDot/outer=None FalseRefusal # #2397 false-refusal read/NestedType/AccessorSetBody/Earlier/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/AccessorSetBody/Earlier/Bare/outer=None Ice # #2397 ice -read/NestedType/AccessorSetBody/Earlier/SelfDot/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/AccessorSetBody/Earlier/SelfDot/outer=None FalseRefusal # #2397 false-refusal read/NestedType/AccessorSetBody/Later/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/AccessorSetBody/Later/Bare/outer=None Ice # #2397 ice -read/NestedType/AccessorSetBody/Later/SelfDot/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/AccessorSetBody/Later/SelfDot/outer=None FalseRefusal # #2397 false-refusal read/NestedType/ComprehensionElement/Earlier/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/ComprehensionElement/Earlier/Bare/outer=None Ice # #2397 ice -read/NestedType/ComprehensionElement/Earlier/SelfDot/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/ComprehensionElement/Earlier/SelfDot/outer=None FalseRefusal # #2397 false-refusal read/NestedType/ComprehensionElement/Later/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/ComprehensionElement/Later/Bare/outer=None Ice # #2397 ice read/NestedType/ComprehensionElement/Later/Qualified/outer=None Ice # #2397 ice -read/NestedType/ComprehensionElement/Later/SelfDot/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/ComprehensionElement/Later/SelfDot/outer=None FalseRefusal # #2397 false-refusal read/NestedType/ComprehensionIterable/Earlier/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/ComprehensionIterable/Earlier/Bare/outer=None Ice # #2397 ice -read/NestedType/ComprehensionIterable/Earlier/SelfDot/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/ComprehensionIterable/Earlier/SelfDot/outer=None FalseRefusal # #2397 false-refusal read/NestedType/ComprehensionIterable/Later/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/ComprehensionIterable/Later/Bare/outer=None Ice # #2397 ice read/NestedType/ComprehensionIterable/Later/Qualified/outer=None Ice # #2397 ice -read/NestedType/ComprehensionIterable/Later/SelfDot/outer=None FalseRefusal # #2423 false-refusal -read/NestedType/ConstInitializer/Earlier/Alias/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/ComprehensionIterable/Later/SelfDot/outer=None FalseRefusal # #2397 false-refusal +read/NestedType/ConstInitializer/Earlier/Alias/outer=None FalseRefusal # #2397 false-refusal read/NestedType/ConstInitializer/Earlier/Bare/outer=ModuleClass SilentWrong # #2423 silent-wrong read/NestedType/ConstInitializer/Earlier/Bare/outer=ModuleComputedConst Ice # #2397 ice read/NestedType/ConstInitializer/Earlier/Bare/outer=ModuleDef Ice # #2397 ice @@ -1131,7 +1131,7 @@ read/NestedType/ConstInitializer/Earlier/Bare/outer=ModuleStruct SilentWrong # # read/NestedType/ConstInitializer/Earlier/Bare/outer=ModuleTypeAlias Ice # #2397 ice read/NestedType/ConstInitializer/Earlier/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/ConstInitializer/Earlier/Bare/outer=None Ice # #2397 ice -read/NestedType/ConstInitializer/Later/Alias/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/ConstInitializer/Later/Alias/outer=None FalseRefusal # #2397 false-refusal read/NestedType/ConstInitializer/Later/Bare/outer=ModuleClass SilentWrong # #2423 missing-refusal read/NestedType/ConstInitializer/Later/Bare/outer=ModuleComputedConst Ice # #2397 ice read/NestedType/ConstInitializer/Later/Bare/outer=ModuleDef Ice # #2397 ice @@ -1164,21 +1164,21 @@ read/NestedType/DataclassInitFieldInitializer/Later/Bare/outer=ModuleStruct Sile read/NestedType/DataclassInitFieldInitializer/Later/Bare/outer=ModuleTypeAlias Ice # #2397 ice read/NestedType/DataclassInitFieldInitializer/Later/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/DataclassInitFieldInitializer/Later/Bare/outer=None Ice # #2397 ice -read/NestedType/FunctionBody/Earlier/Alias/outer=None FalseRefusal # #2423 false-refusal -read/NestedType/FunctionBody/Later/Alias/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/FunctionBody/Earlier/Alias/outer=None FalseRefusal # #2397 false-refusal +read/NestedType/FunctionBody/Later/Alias/outer=None FalseRefusal # #2397 false-refusal read/NestedType/GeneratorBody/Earlier/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/GeneratorBody/Earlier/Bare/outer=None Ice # #2397 ice -read/NestedType/GeneratorBody/Earlier/SelfDot/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/GeneratorBody/Earlier/SelfDot/outer=None FalseRefusal # #2397 false-refusal read/NestedType/GeneratorBody/Later/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/GeneratorBody/Later/Bare/outer=None Ice # #2397 ice -read/NestedType/GeneratorBody/Later/SelfDot/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/GeneratorBody/Later/SelfDot/outer=None FalseRefusal # #2397 false-refusal read/NestedType/InitBody/Earlier/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/InitBody/Earlier/Bare/outer=None Ice # #2397 ice -read/NestedType/InitBody/Earlier/SelfDot/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/InitBody/Earlier/SelfDot/outer=None FalseRefusal # #2397 false-refusal read/NestedType/InitBody/Later/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/InitBody/Later/Bare/outer=None Ice # #2397 ice -read/NestedType/InitBody/Later/SelfDot/outer=None FalseRefusal # #2423 false-refusal -read/NestedType/InstanceFieldInitializer/Earlier/Alias/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/InitBody/Later/SelfDot/outer=None FalseRefusal # #2397 false-refusal +read/NestedType/InstanceFieldInitializer/Earlier/Alias/outer=None FalseRefusal # #2397 false-refusal read/NestedType/InstanceFieldInitializer/Earlier/Bare/outer=ModuleClass SilentWrong # #2423 silent-wrong read/NestedType/InstanceFieldInitializer/Earlier/Bare/outer=ModuleComputedConst Ice # #2397 ice read/NestedType/InstanceFieldInitializer/Earlier/Bare/outer=ModuleDef Ice # #2397 ice @@ -1189,7 +1189,7 @@ read/NestedType/InstanceFieldInitializer/Earlier/Bare/outer=ModuleStruct SilentW read/NestedType/InstanceFieldInitializer/Earlier/Bare/outer=ModuleTypeAlias Ice # #2397 ice read/NestedType/InstanceFieldInitializer/Earlier/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/InstanceFieldInitializer/Earlier/Bare/outer=None Ice # #2397 ice -read/NestedType/InstanceFieldInitializer/Later/Alias/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/InstanceFieldInitializer/Later/Alias/outer=None FalseRefusal # #2397 false-refusal read/NestedType/InstanceFieldInitializer/Later/Bare/outer=ModuleClass SilentWrong # #2423 missing-refusal read/NestedType/InstanceFieldInitializer/Later/Bare/outer=ModuleComputedConst Ice # #2397 ice read/NestedType/InstanceFieldInitializer/Later/Bare/outer=ModuleDef Ice # #2397 ice @@ -1222,24 +1222,24 @@ read/NestedType/InstancePropertyDefault/Later/Bare/outer=ModuleVar Ice # #2397 i read/NestedType/InstancePropertyDefault/Later/Bare/outer=None Ice # #2397 ice read/NestedType/LambdaImmediate/Earlier/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/LambdaImmediate/Earlier/Bare/outer=None Ice # #2397 ice -read/NestedType/LambdaImmediate/Earlier/SelfDot/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/LambdaImmediate/Earlier/SelfDot/outer=None FalseRefusal # #2397 false-refusal read/NestedType/LambdaImmediate/Later/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/LambdaImmediate/Later/Bare/outer=None Ice # #2397 ice read/NestedType/LambdaImmediate/Later/Qualified/outer=None Ice # #2397 ice -read/NestedType/LambdaImmediate/Later/SelfDot/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/LambdaImmediate/Later/SelfDot/outer=None FalseRefusal # #2397 false-refusal read/NestedType/LambdaPassed/Earlier/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/LambdaPassed/Earlier/Bare/outer=None Ice # #2397 ice -read/NestedType/LambdaPassed/Earlier/SelfDot/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/LambdaPassed/Earlier/SelfDot/outer=None FalseRefusal # #2397 false-refusal read/NestedType/LambdaPassed/Later/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/LambdaPassed/Later/Bare/outer=None Ice # #2397 ice -read/NestedType/LambdaPassed/Later/SelfDot/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/LambdaPassed/Later/SelfDot/outer=None FalseRefusal # #2397 false-refusal read/NestedType/LambdaStored/Earlier/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/LambdaStored/Earlier/Bare/outer=None Ice # #2397 ice -read/NestedType/LambdaStored/Earlier/SelfDot/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/LambdaStored/Earlier/SelfDot/outer=None FalseRefusal # #2397 false-refusal read/NestedType/LambdaStored/Later/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/LambdaStored/Later/Bare/outer=None Ice # #2397 ice -read/NestedType/LambdaStored/Later/SelfDot/outer=None FalseRefusal # #2423 false-refusal -read/NestedType/MethodBody/Earlier/Alias/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/LambdaStored/Later/SelfDot/outer=None FalseRefusal # #2397 false-refusal +read/NestedType/MethodBody/Earlier/Alias/outer=None FalseRefusal # #2397 false-refusal read/NestedType/MethodBody/Earlier/Bare/outer=ModuleComputedConst Ice # #2397 ice read/NestedType/MethodBody/Earlier/Bare/outer=ModuleDef Ice # #2397 ice read/NestedType/MethodBody/Earlier/Bare/outer=ModuleEnum Ice # #2397 ice @@ -1248,8 +1248,8 @@ read/NestedType/MethodBody/Earlier/Bare/outer=ModuleProperty Ice # #2397 ice read/NestedType/MethodBody/Earlier/Bare/outer=ModuleTypeAlias Ice # #2397 ice read/NestedType/MethodBody/Earlier/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/MethodBody/Earlier/Bare/outer=None Ice # #2397 ice -read/NestedType/MethodBody/Earlier/SelfDot/outer=None FalseRefusal # #2423 false-refusal -read/NestedType/MethodBody/Later/Alias/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/MethodBody/Earlier/SelfDot/outer=None FalseRefusal # #2397 false-refusal +read/NestedType/MethodBody/Later/Alias/outer=None FalseRefusal # #2397 false-refusal read/NestedType/MethodBody/Later/Bare/outer=ModuleComputedConst Ice # #2397 ice read/NestedType/MethodBody/Later/Bare/outer=ModuleDef Ice # #2397 ice read/NestedType/MethodBody/Later/Bare/outer=ModuleEnum Ice # #2397 ice @@ -1258,17 +1258,17 @@ read/NestedType/MethodBody/Later/Bare/outer=ModuleProperty Ice # #2397 ice read/NestedType/MethodBody/Later/Bare/outer=ModuleTypeAlias Ice # #2397 ice read/NestedType/MethodBody/Later/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/MethodBody/Later/Bare/outer=None Ice # #2397 ice -read/NestedType/MethodBody/Later/SelfDot/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/MethodBody/Later/SelfDot/outer=None FalseRefusal # #2397 false-refusal read/NestedType/NestedClassMethodBody/Earlier/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/NestedClassMethodBody/Earlier/Bare/outer=None Ice # #2397 ice read/NestedType/NestedClassMethodBody/Later/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/NestedClassMethodBody/Later/Bare/outer=None Ice # #2397 ice read/NestedType/NestedDefInMethod/Earlier/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/NestedDefInMethod/Earlier/Bare/outer=None Ice # #2397 ice -read/NestedType/NestedDefInMethod/Earlier/SelfDot/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/NestedDefInMethod/Earlier/SelfDot/outer=None FalseRefusal # #2397 false-refusal read/NestedType/NestedDefInMethod/Later/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/NestedDefInMethod/Later/Bare/outer=None Ice # #2397 ice -read/NestedType/NestedDefInMethod/Later/SelfDot/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/NestedDefInMethod/Later/SelfDot/outer=None FalseRefusal # #2397 false-refusal read/NestedType/ParameterDefault/Earlier/Bare/outer=ModuleEnum Ice # #2397 ice read/NestedType/ParameterDefault/Later/Bare/outer=ModuleEnum Ice # #2397 ice read/NestedType/StaticInitializer/ComprehensionElement/Earlier/Bare/outer=ModuleDef Ice # #2397 ice @@ -1283,7 +1283,7 @@ read/NestedType/StaticInitializer/ComprehensionIterable/Earlier/Bare/outer=None read/NestedType/StaticInitializer/ComprehensionIterable/Later/Bare/outer=ModuleDef Ice # #2397 ice read/NestedType/StaticInitializer/ComprehensionIterable/Later/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/StaticInitializer/ComprehensionIterable/Later/Bare/outer=None Ice # #2397 ice -read/NestedType/StaticInitializer/Earlier/Alias/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/StaticInitializer/Earlier/Alias/outer=None FalseRefusal # #2397 false-refusal read/NestedType/StaticInitializer/Earlier/Bare/outer=ModuleClass SilentWrong # #2423 silent-wrong read/NestedType/StaticInitializer/Earlier/Bare/outer=ModuleComputedConst Ice # #2397 ice read/NestedType/StaticInitializer/Earlier/Bare/outer=ModuleDef Ice # #2397 ice @@ -1300,7 +1300,7 @@ read/NestedType/StaticInitializer/Lambda/Earlier/Bare/outer=None Ice # #2397 ice read/NestedType/StaticInitializer/Lambda/Later/Bare/outer=ModuleDef Ice # #2397 ice read/NestedType/StaticInitializer/Lambda/Later/Bare/outer=ModuleVar Ice # #2397 ice read/NestedType/StaticInitializer/Lambda/Later/Bare/outer=None Ice # #2397 ice -read/NestedType/StaticInitializer/Later/Alias/outer=None FalseRefusal # #2423 false-refusal +read/NestedType/StaticInitializer/Later/Alias/outer=None FalseRefusal # #2397 false-refusal read/NestedType/StaticInitializer/Later/Bare/outer=ModuleClass SilentWrong # #2423 missing-refusal read/NestedType/StaticInitializer/Later/Bare/outer=ModuleComputedConst Ice # #2397 ice read/NestedType/StaticInitializer/Later/Bare/outer=ModuleDef Ice # #2397 ice From 59ac995da8a9572c064b5c7561e8f04777d7596f Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 04:52:32 +0000 Subject: [PATCH 05/22] test(conformance): P78 stage 0: the #2487 rule table replaces RuleAxes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stage 0 of plan-777361 (P78; contract §11), second commit: the binding and scoping rule table (#2487, R-LO) as data, read by NameResolutionDifferentialTests in place of its hand-written RuleAxes predicates. Test code, its data and the scorecard baseline only: no product path, and no hook was needed. The table: Conformance/name-resolution-rules.txt, 186 rows over 44 rules. A row is ` axis=value,... axis!=value,...`. The case -> expected map is row -> (tag, rule); the generator still computes a cell's tag and rule beside its model and its python prediction, and the two must agree cell by cell. Totality (RuleTable_EveryCellHasOneRow_AndEveryRowACell, and the sweep through ClosedSetFailures): every generated cell matches exactly ONE row, that row's tag and rule are the cell's, and every row has a cell; a value the table names on an axis is a member of the axis's enumeration, or (the four text axes) is carried by a cell. A per-rule predicate could not say "exactly one": 2733 of the 8951 cells fit a second rule's RuleAxes predicate (#2457 cell 1), so an arm retagged to such a rule stayed green. Axes (RuleTableAxes), each a typed property of the cell or a typed part of its key: - family (Family); target, outer (BindingKind); position (ReadPosition); relation (DeclaringRelation); form (StoreForm); construct (LocalTarget); timing (ReadTimings); declaration (DeclarationShapes); typeAt (TypePosition): the cell's properties, each roster already held to the compiler by Rosters.cs; - order, spelling, nesting, readForm, receiver, resultForm, storeSpelling: the enum VALUE the generator passed to CellId, kept by the new CellKey. No axis is read back from the id's text (RuleAxes split the id on `/` for these); - classes (@TypeLevel, @Initializer, ...): the image of the roster or predicate the generator itself branches on; - hand lists, closed by the pool and not by an enumeration: route (a sub-generator's label), mark (the other text labels of a key), shape and deviation. They are the generator's own strings; a value the table names that no cell carries is red. The rows were DERIVED, not written from the rules: the pool was split on the axes until each part carried one tag and rule, and parts that differ on one axis were merged. They state what the generator does today, are exclusive on the pool by construction, and are edited by hand from here (the plan's T8 rewrites the ones its D9 names). Verdicts moved against RuleAxes: nine cells, on the owner's ruling of 2026-11-20 (#2423 comment 7030074628, item 2: "Must-run (Recommended)"), each a must-refuse cell whose program runs: read/ModuleEnum/{ParameterDefault,DataclassFieldInitializer, StructFieldInitializer,EnumMemberValue}/{Earlier,Later}/Bare/outer=None (an enum member's `.value`; now N1 at the earlier order, N3 at the later) and read/ClassLiteralConst/ParameterDefault/base/H.x (a literal const through a subclass name; now N7). Their nine rows are deleted (each passes), the census moves by those cells, the judged later/ earlier pairs go 1276 -> 1280, and `scorecard_metrics.py --lower` takes allowlist_rows_seed 2377 -> 2368. No other cell's tag, rule, model, python prediction or source differs from the base (the pool was dumped before and after and compared). CellBudget stays 8951. RuleAxes and its id-token helpers are deleted; the admitted-codes directions it carried stay as AdmittedRuleFailures. Mutations (contract §2), in a worktree at this commit's tree (8d787960968c0e428380b0ea7b1ed6b84f3c9f84), each restored with cp and confirmed with cmp: - totality, a row: the first N2 row deleted -> the fact red, 32 cells match no row (1 failed); - totality, the cell's side: the generator's N2 arm retagged SPY0401, the compensated swap #2457 measured green -> the fact red, 600 cells differ from their row (1 failed); both restored -> 1 passed; - a passing cell listed as known-red (`read/StaticField/ StaticInitializer/Earlier/Bare/outer=None SilentWrong # #2423 silent-wrong`) -> NameResolutionDifferential_Sweep red, "STALE: delete the row", allowlist 2369, stale 1 (1 failed); restored -> 1 passed. FullyQualifiedName~NameResolutionDifferentialTests at this tree: 233/0/0 (measured; sweep 438 s, pool 8951, python agrees on 8951, allowlist 2368, non-allowlisted 0). Not done here: docs/design/gap-discovery-contracts.md still names RuleAxes (a doc path; the plan's T11). Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01LGMKZVcFYGqQRfHgd16DLa --- build_tools/scorecard-baseline.json | 2 +- .../NameResolutionDifferentialTests.Axes.cs | 24 +- .../NameResolutionDifferentialTests.Census.cs | 10 +- .../NameResolutionDifferentialTests.Checks.cs | 166 +------- ...ameResolutionDifferentialTests.Families.cs | 36 +- ...meResolutionDifferentialTests.Generator.cs | 7 +- .../NameResolutionDifferentialTests.Read.cs | 47 +-- ...meResolutionDifferentialTests.RuleTable.cs | 353 ++++++++++++++++++ .../NameResolutionDifferentialTests.cs | 13 +- ...name-resolution-differential-allowlist.txt | 9 - .../Conformance/name-resolution-rules.txt | 214 +++++++++++ 11 files changed, 658 insertions(+), 223 deletions(-) create mode 100644 src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.RuleTable.cs create mode 100644 src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt diff --git a/build_tools/scorecard-baseline.json b/build_tools/scorecard-baseline.json index fc371e29e..811cbb06d 100644 --- a/build_tools/scorecard-baseline.json +++ b/build_tools/scorecard-baseline.json @@ -2,5 +2,5 @@ "procedure_bytes": 145560, "claude_md_bytes": 9304, "allowlist_rows_outside_seed": 572, - "allowlist_rows_seed": 2377 + "allowlist_rows_seed": 2368 } diff --git a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Axes.cs b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Axes.cs index 378e21e40..5a9206707 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Axes.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Axes.cs @@ -170,7 +170,7 @@ string Program(bool twin) var expected = Run(python, 5, first ? "N1" : "N1-nesting"); return new NameCell { - Id = CellId("read", "comprehension", family, shape, slot, nesting, order), + Key = CellId("read", "comprehension", family, shape, slot, nesting, order), Family = Family.Read, Source = Program(twin: false), TwinSource = family == "dict-spread-comprehension" ? Program(twin: true) : null, @@ -239,7 +239,7 @@ string Program(bool twin) var moduleOuter = outer == BindingKind.ModuleVar; return new NameCell { - Id = CellId("store", "walrus-in-comprehension", family, shape, slot, $"outer={outer}"), + Key = CellId("store", "walrus-in-comprehension", family, shape, slot, $"outer={outer}"), Family = Family.Store, Source = Program(twin: false), TwinSource = family == "dict-spread-comprehension" ? Program(twin: true) : null, @@ -440,7 +440,7 @@ void Helper(string read) var expected = Cycle(PyOutcome.Name(python), "N3-cycle"); return new NameCell { - Id = CellId("read", "cycle", spelling, pair, through, a, b), + Key = CellId("read", "cycle", spelling, pair, through, a, b), Family = Family.Read, Source = Join(lines) + MainBlock($"print({print})"), Tag = expected.Tag, @@ -505,7 +505,7 @@ private static NameCell OrderObservationCell(BindingKind kind, Order order) var model = instance ? JoinOut("main", $"init {kind}", value) : JoinOut($"init {kind}", "main", value); return new NameCell { - Id = CellId("read", "order-observation", kind, order), + Key = CellId("read", "order-observation", kind, order), Family = Family.Read, Source = Program(decl), TwinSource = instance ? Program(twinDecl) : null, @@ -801,7 +801,7 @@ private static NameCell SiblingNestedTypeCell(Spelling spelling, ReadPosition po : Run(method ? PyOutcome.Ran(Value) : PyOutcome.Name("O"), Value, "N7"); return new NameCell { - Id = CellId("read", "sibling", spelling, position, order), + Key = CellId("read", "sibling", spelling, position, order), Family = Family.Read, Source = Join(new[] { "class O:" }.Concat(body)) + MainBlock(method ? "print(O.J().r())" : "print(O.J.r)"), Tag = expected.Tag, @@ -879,7 +879,7 @@ private static IEnumerable AliasTypePositionCells() string Program(string reader, string[] main) => (order == Order.Earlier ? r.Target + Alias + reader : reader + r.Target + Alias) + MainBlock(main); yield return new NameCell { - Id = CellId("read", "type-position-alias", r.Label, order), + Key = CellId("read", "type-position-alias", r.Label, order), Family = Family.Read, Source = Program(r.Reader, r.Main), TwinSource = r.Twin == null ? null : Program(r.Twin, r.TwinMain ?? r.Main), @@ -906,7 +906,7 @@ private static IEnumerable ResultValueFormCells() const string Reads = "print(r().unwrap())"; yield return new NameCell { - Id = CellId("read", "result-form", ResultValueForm.BareValue, order), + Key = CellId("read", "result-form", ResultValueForm.BareValue, order), Family = Family.Read, Source = Program("def r() -> int !Later:\n return Later().v\n", Reads), TwinSource = Program("def r() -> int:\n return Later().v\n", "print(r())"), @@ -921,7 +921,7 @@ private static IEnumerable ResultValueFormCells() yield return new NameCell { - Id = CellId("read", "result-form", ResultValueForm.Err, order), + Key = CellId("read", "result-form", ResultValueForm.Err, order), Family = Family.Read, Source = (order == Order.Earlier ? LaterError + "def r() -> int !Later:\n return Err(Later())\n" : "def r() -> int !Later:\n return Err(Later())\n" + LaterError) + MainBlock("match r():", " case Ok(v):", " print(v)", " case Err(e):", " print(\"err\")"), @@ -1011,7 +1011,7 @@ private static NameCell DeclarationCell(DeclarationShapes shape, StoreSpelling s var (host, call) = Host(body, stmts); return new NameCell { - Id = CellId("store", "declaration", shape, s, body), + Key = CellId("store", "declaration", shape, s, body), Family = Family.Store, Source = Join(module.Concat(host)) + MainBlock(call.Concat(later).ToArray()), Tag = e.Tag, @@ -1104,7 +1104,7 @@ private static NameCell StructHostCell(BindingKind target, ReadPosition body, Ne var refused = spelling == Spelling.SelfDot && closure && target is not (BindingKind.StaticField or BindingKind.StaticMethod); return cell with { - Id = CellId("read", "struct", target, body, nesting == Nesting.Direct ? null : nesting, order, spelling), + Key = CellId("read", "struct", target, body, nesting == Nesting.Direct ? null : nesting, order, spelling), Tag = refused ? SharpyTag.MustRefuse : cell.Tag, Model = refused ? null : cell.Model, Rule = refused ? "R-KT" : cell.Rule, @@ -1225,7 +1225,7 @@ private static NameCell AttributeStoreCell(AttributeReceiver receiver, BindingKi return new NameCell { - Id = CellId("store", "attribute", receiver, member, form, body), + Key = CellId("store", "attribute", receiver, member, form, body), Family = Family.Store, Source = WithHelpers(Join(lines) + MainBlock(call.ToArray())), Tag = expected.Tag, @@ -1357,7 +1357,7 @@ private static NameCell AugmentedInitCell(string host, StoreNesting position, Au return new NameCell { - Id = CellId(new object?[] { "store", "attribute", "augmented", host, body, position }.Concat(spelled).Append(tuple ? null : slots).ToArray()), + Key = CellId(new object?[] { "store", "attribute", "augmented", host, body, position }.Concat(spelled).Append(tuple ? null : slots).ToArray()), Family = Family.Store, Source = Join(lines2) + MainBlock(call), Tag = expected.Tag, diff --git a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Census.cs b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Census.cs index 63b6eae9f..370892498 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Census.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Census.cs @@ -31,20 +31,20 @@ public partial class NameResolutionDifferentialTests [(Family.Read, SharpyTag.MustRefuse, "R-KG")] = 15, [(Family.Read, SharpyTag.MustRefuse, "R-KT")] = 12, [(Family.Read, SharpyTag.MustRefuse, "R1(b)")] = 45, - [(Family.Read, SharpyTag.MustRefuse, "SPY0401")] = 460, + [(Family.Read, SharpyTag.MustRefuse, "SPY0401")] = 453, [(Family.Read, SharpyTag.MustRefuse, "kind:SPY0212")] = 4, [(Family.Read, SharpyTag.MustRefuse, "kind:SPY0290")] = 302, - [(Family.Read, SharpyTag.MustRefuse, "kind:enum-member-constant")] = 16, + [(Family.Read, SharpyTag.MustRefuse, "kind:enum-member-constant")] = 14, [(Family.Read, SharpyTag.MustRefuse, "kind:instance-at-initializer")] = 803, [(Family.Read, SharpyTag.MustRefuse, "kind:result-wrap")] = 2, [(Family.Read, SharpyTag.MustRefuseOrThrow, "N3-cycle")] = 193, [(Family.Read, SharpyTag.MustRun, "A3")] = 32, - [(Family.Read, SharpyTag.MustRun, "N1")] = 926, + [(Family.Read, SharpyTag.MustRun, "N1")] = 930, [(Family.Read, SharpyTag.MustRun, "N1+N3")] = 81, [(Family.Read, SharpyTag.MustRun, "N1-innermost")] = 189, [(Family.Read, SharpyTag.MustRun, "N1-nesting")] = 148, - [(Family.Read, SharpyTag.MustRun, "N3")] = 105, - [(Family.Read, SharpyTag.MustRun, "N7")] = 917, + [(Family.Read, SharpyTag.MustRun, "N3")] = 109, + [(Family.Read, SharpyTag.MustRun, "N7")] = 918, [(Family.Read, SharpyTag.MustRun, "R-Y")] = 410, [(Family.Seed, SharpyTag.MayRefuse, "seed")] = 1, [(Family.Seed, SharpyTag.MustRefuse, "seed")] = 62, diff --git a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Checks.cs b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Checks.cs index b79cd4488..4a49fe68d 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Checks.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Checks.cs @@ -608,7 +608,7 @@ public void ModelPairing_TheLaterOrderPrintsWhatTheEarlierOrderPrints() // coverage claim on the models: most of them python or Sharpy reads as well, and the sweep's judgedPairsReadByNothingElse says how many the pairing alone holds. judged.Count.Should().BeGreaterThanOrEqualTo(1000, "D3.2's floor, ahead of the literal so that it can be the assertion that fails"); pairs.Should().Be(1741); - judged.Count.Should().Be(1276); + judged.Count.Should().Be(1280); } /// Why no check reads a model, each a key of . @@ -778,160 +778,20 @@ public void PatternKindRoster_EveryNote_HasAFalsifier() } // ------------------------------------------------------------------------------------------- // - // D3.4: a rule's cite is an axis predicate + // D3.4: a rule's cite is a row of the rule table (NameResolutionDifferentialTests.RuleTable.cs) // ------------------------------------------------------------------------------------------- // - private static bool IsTypeLevel(BindingKind k) => NameResolutionRosters.TypeLevelKinds.Contains(k); - - private static bool IsInstanceLevel(BindingKind k) => NameResolutionRosters.InstanceKinds.Contains(k); - private static bool IsModuleKind(BindingKind k) => NameResolutionRosters.ModuleLevelKinds.Contains(k); private static bool IsPositionLocal(BindingKind k) => NameResolutionRosters.PositionLocalKinds.Contains(k); private static bool IsNamedOuter(BindingKind k) => k is BindingKind.Builtin or BindingKind.ImportedName; - private static bool IsVisibleModuleOuter(BindingKind k) => IsModuleKind(k) || IsNamedOuter(k); - - /// A segment of the cell's id: the order and spelling tokens the generator writes there and no property carries. - private static bool Spelled(NameCell c, string token) => c.Id.Split('/').Contains(token); - - private static bool ThroughAMember(NameCell c) => Spelled(c, nameof(Spelling.Qualified)) || Spelled(c, nameof(Spelling.Alias)) || Spelled(c, nameof(Spelling.SelfDot)) - || c.Id.Contains("/base/H.x", StringComparison.Ordinal) || c.Id.Contains("/base/B.x", StringComparison.Ordinal) || c.Id.Contains("/base/self.x", StringComparison.Ordinal); - - private static bool Nested(NameCell c) => Spelled(c, nameof(Nesting.Lambda)) || Spelled(c, nameof(Nesting.ComprehensionIterable)) || Spelled(c, nameof(Nesting.ComprehensionElement)); - - /// READ's module-level split: a read at load time at the later order is N3's. The nesting is the id's token, the one place the cell keeps it. - private static bool ModuleReadAtLoadLater(NameCell c) => Spelled(c, nameof(Order.Later)) && c.Position is ReadPosition p - && ModuleReadAtLoad(p, Spelled(c, nameof(Nesting.Lambda)) ? Nesting.Lambda : Spelled(c, nameof(Nesting.ComprehensionIterable)) ? Nesting.ComprehensionIterable : Spelled(c, nameof(Nesting.ComprehensionElement)) ? Nesting.ComprehensionElement : Nesting.Direct); - - /// A class body's bare read that sees the member: an initializer at the earlier order (the later order is N2's, or N1+N3's with no outer). - private static bool ClassBodySeesTheMember(NameCell c) => c.Relation == DeclaringRelation.Self && Spelled(c, nameof(Order.Earlier)) && c.Position is ReadPosition p && IsInitializer(p); - - /// A position evaluated while the program loads, so a read can see a value before it is ready. - private static bool AtLoad(NameCell c) => c.Position is ReadPosition.ModuleInitializer or ReadPosition.ModulePropertyInitializer - or ReadPosition.StaticInitializer or ReadPosition.ConstInitializer or ReadPosition.StaticPropertyDefault; - - /// D3.4: what each rule says, as a predicate on the axes of the cell citing it, so a rule retagged to one admitting the same codes is red here and not only in the census. - /// Every rule in the pool has an entry and every entry has a cell. The tag is on the axes: MustRun and MustRefuse under one rule are its two arms. - internal static readonly IReadOnlyDictionary> RuleAxes = new Dictionary>(StringComparer.Ordinal) - { - // N1: the innermost binding that means the read. - ["N1"] = c => c.Tag == SharpyTag.MustRun && (c.Family == Family.Read - ? !IsPositionLocal(c.Outer) && !ThroughAMember(c) && !(c.Position == ReadPosition.ModuleInitializer && Nested(c) && !Spelled(c, nameof(Nesting.Lambda))) - && (IsTypeLevel(c.Target) ? ClassBodySeesTheMember(c) || c.Relation == DeclaringRelation.Enclosing : !ModuleReadAtLoadLater(c)) - : c.Family == Family.Local && c.Construct == LocalTarget.Comprehension), - ["N1+N3"] = c => c.Family == Family.Read && c.Tag == SharpyTag.MustRun && IsTypeLevel(c.Target) && c.Outer == BindingKind.None - && (Spelled(c, nameof(Order.Later)) || c.Relation == DeclaringRelation.Other), - ["N1-arity"] = c => c.Family == Family.Read && c.Tag == SharpyTag.MustRefuse && c.Outer == BindingKind.Builtin && Spelled(c, "arity-mismatch") && !Spelled(c, "int"), - ["N1-innermost"] = c => c.Tag == SharpyTag.MustRun && (c.Family == Family.Read ? IsLocalOuter(c.Outer) : c.Family == Family.Local && IsPositionLocal(c.Target) && !Spelled(c, "let-in")), - ["N1-methods"] = c => c.Family == Family.Read && c.Tag == SharpyTag.MustRefuse && c.Outer == BindingKind.None && (IsTypeLevel(c.Target) || IsInstanceLevel(c.Target)) - && Spelled(c, nameof(Spelling.Bare)) && c.Relation is DeclaringRelation.Self or DeclaringRelation.Sibling, - ["N1-nesting"] = c => c.Family == Family.Read && c.Tag == SharpyTag.MustRun && IsModuleKind(c.Target) && c.Outer == BindingKind.None - && (c.Position == ReadPosition.ComprehensionElement ? c.Id.StartsWith("read/comprehension/", StringComparison.Ordinal) : c.Position == ReadPosition.ModuleInitializer && Nested(c)), - // The read reaches the outer, and the read is ill-typed. A class body that sees its own later member is N2's, and any binding or import under a builtin's name read at load is N2-module's. - ["N1-type-error"] = c => c.Family == Family.Read && c.Tag == SharpyTag.MustRefuse && IsVisibleModuleOuter(c.Outer) && !ThroughAMember(c) - && !Spelled(c, "arity-mismatch") && !Spelled(c, "arity-match") - && (!IsModuleKind(c.Target) || (c.Outer == BindingKind.Builtin && c.Target != BindingKind.ModuleDef && !ModuleReadAtLoadLater(c))) - && (!IsTypeLevel(c.Target) || c.Relation != DeclaringRelation.Self || Spelled(c, nameof(Order.Earlier)) || Nested(c) || c.Position is not ReadPosition p || !IsInitializer(p)), - - // N2: a class body's read of an outer name it later declares. - ["N2"] = c => c.Family == Family.Read && c.Tag == SharpyTag.MustRefuse && IsTypeLevel(c.Target) && IsVisibleModuleOuter(c.Outer) && c.Position is ReadPosition p && IsInitializer(p) - && !Spelled(c, nameof(Order.Earlier)), - ["N2-module"] = c => c.Family == Family.Read && c.Tag == SharpyTag.MustRefuse && IsModuleKind(c.Target) && IsNamedOuter(c.Outer) && Spelled(c, nameof(Order.Later)) && !Spelled(c, "arity-mismatch"), - - // N3: the later order prints what the earlier prints, and a cycle has no order to print. - ["N3"] = c => c.Family == Family.Read && c.Tag == SharpyTag.MustRun && c.Outer == BindingKind.None - && (c.Id.StartsWith("read/order-observation/", StringComparison.Ordinal) || (IsModuleKind(c.Target) && (ModuleReadAtLoadLater(c) || c.Id.StartsWith("read/str/", StringComparison.Ordinal)))), - ["N3-cycle"] = c => c.Family == Family.Read && c.Tag == SharpyTag.MustRefuseOrThrow && c.Outer == BindingKind.None && AtLoad(c), - - // N5: a local is visible from its binding, in its block. - ["N5"] = c => c.Family == Family.Local - ? c.Tag == SharpyTag.MustRun - ? c.Outer == BindingKind.None || (c.Outer == BindingKind.ModuleVar && Spelled(c, "inside")) - : c.Tag == SharpyTag.MustRefuse && !Spelled(c, "self") && (c.Outer == BindingKind.None || IsTypeLevel(c.Outer)) - : c.Family == Family.Store && !IsAttributeStore(c) && c.Declaration == null && (c.Outer is BindingKind.None or BindingKind.Builtin - ), - ["N5-block-scope"] = c => c.Family == Family.Local && c.Tag == SharpyTag.MustRun && Spelled(c, "let-in") && c.Outer != BindingKind.None, - ["N5-declared-later"] = c => c.Family == Family.Local && c.Tag == SharpyTag.MustRefuse && IsPositionLocal(c.Target) && c.Target != BindingKind.LocalDef - && (Spelled(c, "above") || Spelled(c, "L28") || c.Timing is ReadTimings.SameBlockAbove or ReadTimings.BackEdge), - ["N5-self"] = c => c.Family == Family.Local && c.Tag == SharpyTag.MustRefuse && c.Target == BindingKind.LambdaTypedLocal && Spelled(c, "self"), - - // N6: a store over a binding reaches it only through a declaration, and a declaration needs one it can write. - ["N6"] = c => c.Family == Family.Store && c.Deviation == null && c.Form is StoreForm.Assign or StoreForm.Augmented or StoreForm.Walrus - && (c.Outer is BindingKind.ModuleVar or BindingKind.ModuleProperty or BindingKind.EnclosingLocal || IsNamedOuter(c.Outer)) - && (c.Tag == SharpyTag.MustRun) == (Spelled(c, "global") || Spelled(c, "nonlocal") || c.Declaration != null), - ["N6-declaration"] = c => c.Family == Family.Store && c.Tag == SharpyTag.MustRefuse && c.Declaration != null, - ["N6-same-function"] = c => c.Family == Family.Store && c.Tag == SharpyTag.MustRun && c.Outer == BindingKind.LocalVar && c.Target == BindingKind.LocalVar, - ["N6-type-kind"] = c => c.Family == Family.Store && c.Tag == SharpyTag.MustRefuse && IsNonWritableByMeaning(c.Outer), - - // N7: a member through a spelling that names its owner. - ["N7"] = c => c.Tag == SharpyTag.MustRun && (c.Family == Family.Read - ? ThroughAMember(c) || Spelled(c, nameof(Spelling.Call)) || Spelled(c, "GenericReceiver") || (c.TypeAt != null && c.Target == BindingKind.ModuleTypeAlias) - || (c.Id.StartsWith("read/str/", StringComparison.Ordinal) && IsTypeLevel(c.Target)) - : c.Family == Family.Store && IsAttributeStore(c) && c.Form is StoreForm.Assign or StoreForm.Augmented), - - ["#1974"] = c => c.Tag == SharpyTag.MustRun && (c.Family == Family.Store ? c.Form == StoreForm.LetOrVar - : c.Family == Family.Local && c.Outer == BindingKind.LocalVar && Spelled(c, "let-in")), - ["A3"] = c => c.Family == Family.Read && c.Tag == SharpyTag.MustRun && c.Relation == DeclaringRelation.Base && Spelled(c, nameof(Spelling.Bare)) && IsModuleKind(c.Outer), - ["P52"] = c => c.Family == Family.TypeMember && c.Tag == SharpyTag.MustRun && c.Outer == BindingKind.None && IsModuleKind(c.Target), - ["R-BM"] = c => c.Tag == SharpyTag.MustRun && (c.Family == Family.Store ? c.Form == StoreForm.OutLet : c.Family == Family.Local && c.Construct == LocalTarget.OutLet), - ["R-KG"] = c => c.Family == Family.Read && c.Tag == SharpyTag.MustRefuse && IsTypeLevel(c.Target) && c.Outer == BindingKind.None && c.Relation == DeclaringRelation.Enclosing && Spelled(c, nameof(Spelling.Bare)), - // R-KT's closure over a struct's `self`. A @static member reached through self needs no `this`, so both keep the class arm (the lead's ruling on axis 7). - ["R-KT"] = c => c.Family == Family.Read && c.Tag == SharpyTag.MustRefuse && c.Id.StartsWith("read/struct/", StringComparison.Ordinal) && Spelled(c, nameof(Spelling.SelfDot)) - && IsInstanceLevel(c.Target) && (Spelled(c, nameof(Nesting.Lambda)) || (c.Position is ReadPosition closure && NameResolutionRosters.StructClosureBodies.Contains(closure))), - // R-KU: a @static store through what is not its owner's name. - ["R-KU"] = c => c.Family == Family.Store && c.Tag == SharpyTag.MustRefuse && IsAttributeStore(c) && c.Target is BindingKind.StaticField or BindingKind.StaticProperty - && (Spelled(c, nameof(AttributeReceiver.SelfDot)) || Spelled(c, nameof(AttributeReceiver.DerivedType)) || Spelled(c, nameof(AttributeReceiver.InstanceLocal))), - ["R-Y"] = c => c.Family == Family.Read && c.Tag == SharpyTag.MustRun && c.Relation == DeclaringRelation.Self && (IsTypeLevel(c.Target) || IsInstanceLevel(c.Target)) - && IsVisibleModuleOuter(c.Outer) && Spelled(c, nameof(Spelling.Bare)), - ["R1(b)"] = c => c.Family == Family.Read && c.Tag == SharpyTag.MustRefuse && c.Relation == DeclaringRelation.Base && c.Outer == BindingKind.None && Spelled(c, nameof(Spelling.Bare)), - - // S2 / S3: a read past a binding's own visibility, over an outer name that must not silently answer it. - ["S2"] = c => c.Family == Family.Local && c.Tag == SharpyTag.MustRefuse && c.Target == BindingKind.LocalVar && c.Construct != null && c.Outer != BindingKind.None, - // The owner's ruling on a comprehension's walrus over a visible module name read after it (2026-11-06). - ["S2-walrus"] = c => c.Family == Family.Store && c.Tag == SharpyTag.MustRefuse && c.Form == StoreForm.Walrus && c.Outer == BindingKind.ModuleVar && c.Deviation == "walrus-in-comprehension-scope", - ["S3"] = c => c.Family == Family.Local && c.Tag == SharpyTag.MustRefuse && c.Target == BindingKind.LocalDef && Spelled(c, "above"), - - ["SPY0401"] = c => c.Family == Family.Read && c.Tag == SharpyTag.MustRefuse && c.Position is ReadPosition p && IsConstantOnly(p), - ["SPY0606"] = c => c.Family == Family.Store && c.Tag == SharpyTag.MustRefuse && IsTypeLevelMember(c.Outer) && !IsAttributeStore(c), - - ["kind:SPY0212"] = c => c.Family == Family.Read && c.Tag == SharpyTag.MustRefuse && c.Outer == BindingKind.Builtin && c.Target == BindingKind.ModuleClass && Spelled(c, "int"), - // A const target, or a tuple of attribute targets under an augmented operator (python's SyntaxError, P85). - ["kind:SPY0225"] = c => c.Family == Family.Store && c.Tag == SharpyTag.MustRefuse - && (c.Target is BindingKind.ModuleLiteralConst or BindingKind.ModuleComputedConst or BindingKind.ClassLiteralConst or BindingKind.ClassComputedConst - || (IsAttributeStore(c) && c.Form == StoreForm.Augmented && c.Shape == "TupleLiteral")), - ["kind:SPY0290"] = c => c.Tag == SharpyTag.MustRefuse && IsInstanceLevel(c.Target) && (c.Family == Family.Read - ? !Spelled(c, nameof(Spelling.SelfDot)) && (ThroughAMember(c) || Spelled(c, nameof(Spelling.Call))) - : c.Family == Family.Store && IsAttributeStore(c) && (Spelled(c, nameof(AttributeReceiver.TypeName)) || Spelled(c, nameof(AttributeReceiver.Alias)) || Spelled(c, nameof(AttributeReceiver.DerivedType)))), - ["kind:SPY0340"] = c => c.Family == Family.Read && c.Tag == SharpyTag.MayRefuse && c.Target == BindingKind.ModuleLet, - ["kind:SPY0606"] = c => c.Family == Family.Store && c.Tag == SharpyTag.MustRefuse && IsAttributeStore(c) && c.Target is BindingKind.StaticMethod or BindingKind.InstanceMethod, - ["kind:enum-member-constant"] = c => c.Family == Family.Read && c.Tag == SharpyTag.MustRefuse && c.Position == ReadPosition.EnumMemberValue, - ["kind:instance-at-initializer"] = c => c.Family == Family.Read && c.Tag == SharpyTag.MustRefuse && IsInstanceLevel(c.Target) && Spelled(c, nameof(Spelling.Bare)) && c.Position is ReadPosition p && IsInitializer(p), - ["kind:result-wrap"] = c => c.Family == Family.Read && c.Tag == SharpyTag.MustRefuse && c.TypeAt == TypePosition.ResultError, - - ["seed"] = c => c.Family == Family.Seed && c.Id.StartsWith("seed/", StringComparison.Ordinal), - ["unruled:global-creates-binding"] = c => c.Tag == SharpyTag.Unruled && UnruledAxesHold(c), - }; - - internal static bool RuleAxesHold(NameCell c) => RuleAxes.TryGetValue(c.Rule, out var axes) && axes(c); - private static bool RefusalIsAnOutcome(NameCell c) => c.Tag is SharpyTag.MustRefuse or SharpyTag.MustRefuseOrThrow or SharpyTag.MayRefuse; - /// D3.4's three directions: a cell's rule has a predicate and the cell is on its axes, a predicate has a cell, and a rule a refusal could answer to says which codes it admits. A seed carries its own. - internal static IEnumerable RuleAxesFailures(IReadOnlyList pool) + /// A rule a refusal could answer to says which codes it admits, and an entry has such a cell. A seed carries its own. + internal static IEnumerable AdmittedRuleFailures(IReadOnlyList pool) { - foreach (var rule in pool.Select(c => c.Rule).Distinct(StringComparer.Ordinal).Where(r => !RuleAxes.ContainsKey(r))) - yield return $"RuleAxes: rule {rule} is cited and has no predicate"; - foreach (var rule in RuleAxes.Keys.Where(r => pool.All(c => c.Rule != r))) - yield return $"RuleAxes: the predicate for {rule} is carried by no cell"; - - var off = pool.Where(c => RuleAxes.ContainsKey(c.Rule) && !RuleAxesHold(c)).ToList(); - foreach (var c in off.Take(40)) - yield return $"RuleAxes: {c.Id} cites {c.Rule} and its axes are not that rule's (tag {c.Tag}, target {c.Target}, outer {c.Outer}, position {c.Position})"; - if (off.Count > 40) - yield return $"RuleAxes: … {off.Count} cells off their rule's axes in total: {string.Join(", ", off.GroupBy(c => c.Rule).Select(g => $"{g.Key} {g.Count()}"))}"; - var refusing = pool.Where(RefusalIsAnOutcome).ToList(); foreach (var rule in refusing.Where(c => c.SeedRefusalCodes == null).Select(c => c.Rule).Distinct(StringComparer.Ordinal).Where(r => !AdmittedRefusals.ContainsKey(r))) yield return $"AdmittedRefusals: rule {rule} is carried by a cell a refusal could answer and has no entry"; @@ -940,19 +800,17 @@ internal static IEnumerable RuleAxesFailures(IReadOnlyList poo } [Fact] - public void RuleAxes_EveryCiteIsOnItsRulesAxes() + public void RuleTable_EveryCellHasOneRow_AndEveryRowACell() { - var pool = GeneratedCells(); - AssertNoProblems(RuleAxesFailures(pool), "a rule's cite is a claim about the cell's axes, and a refusal under it says which codes it admits"); + if (Environment.GetEnvironmentVariable(RuleTableDumpEnv) is { Length: > 0 } dump) + DumpRuleTableAxes(dump); - // The retag the census alone used to see: if all of a rule's cells fit another rule's predicate, moving them there moves no axis. - var hidden = pool.GroupBy(c => c.Rule, StringComparer.Ordinal) - .SelectMany(q => RuleAxes.Where(r => r.Key != q.Key && q.All(r.Value)).Select(r => $"every cell of {q.Key} fits {r.Key}'s predicate")) - .ToList(); - AssertNoProblems(hidden, "two rules that cannot be told apart by their axes are one rule, or a loose predicate"); + var pool = GeneratedCells(); + AssertNoProblems(RuleTableFailures(pool).Concat(AdmittedRuleFailures(pool)), + "a cell's tag and rule are its one row's, a row no cell matches rules nothing, and a refusal under a rule says which codes it admits"); - // Measured literals: a generator that stopped citing a rule would otherwise pass an emptier check. - RuleAxes.Should().HaveCount(44); + // Measured literals: a table or a generator that stopped citing a rule would otherwise pass an emptier check. + RuleTable().Select(r => r.Rule).Distinct(StringComparer.Ordinal).Should().HaveCount(44); // 29 rules with an entry, and the seeds', which carry their own codes. pool.Where(RefusalIsAnOutcome).Select(c => c.Rule).Distinct(StringComparer.Ordinal).Should().HaveCount(30); } diff --git a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Families.cs b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Families.cs index c129b0e85..377c111bf 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Families.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Families.cs @@ -251,7 +251,7 @@ private static NameCell ModuleStoreCell(StoreSpelling s, BindingKind outer, Read var expected = ExpectStore(s, outer, declared, outerValue, reads); return new NameCell { - Id = CellId("store", s, $"outer={outer}", body, declared ? "global" : "no-decl", order, laterRead ? "later-read" : "no-read", insideIf ? "inside-if" : null), + Key = CellId("store", s, $"outer={outer}", body, declared ? "global" : "no-decl", order, laterRead ? "later-read" : "no-read", insideIf ? "inside-if" : null), Family = Family.Store, Source = WithHelpers(Join(lines) + MainBlock(main.ToArray())), Tag = expected.Tag, @@ -294,7 +294,7 @@ private static NameCell EnclosingStoreCell(StoreSpelling s, ReadPosition body, b var expected = ExpectStore(s, BindingKind.EnclosingLocal, declared, 13, laterRead: true); return new NameCell { - Id = CellId("store", s, "outer=EnclosingLocal", body, declared ? "nonlocal" : "no-decl", insideIf ? "inside-if" : null), + Key = CellId("store", s, "outer=EnclosingLocal", body, declared ? "nonlocal" : "no-decl", insideIf ? "inside-if" : null), Family = Family.Store, Source = WithHelpers(Join(lines) + MainBlock(call.ToArray())), Tag = expected.Tag, @@ -321,7 +321,7 @@ private static NameCell SameFunctionStoreCell(StoreSpelling s, ReadPosition body int value = s == StoreSpelling.Augmented ? 14 : 15; return new NameCell { - Id = CellId("store", s, "outer=LocalVar", body, enclosingBlock ? "enclosing-block" : "same-block"), + Key = CellId("store", s, "outer=LocalVar", body, enclosingBlock ? "enclosing-block" : "same-block"), Family = Family.Store, Source = WithHelpers(Join(host) + MainBlock(call.ToArray())), Tag = SharpyTag.MustRun, @@ -431,7 +431,7 @@ private static IEnumerable GlobalCreatesBindingCells() var main = new List(call) { "print(y)" }; yield return new NameCell { - Id = CellId("store", "declaration", "global-creates-binding", s, body), + Key = CellId("store", "declaration", "global-creates-binding", s, body), Family = Family.Store, Source = Join(host) + MainBlock(main.ToArray()), Tag = SharpyTag.Unruled, @@ -459,7 +459,7 @@ private static NameCell LambdaWalrusCell(BindingKind outer) var value = enclosing ? 13 : 5; return new NameCell { - Id = CellId("store", "lambda-walrus", $"outer={outer}"), + Key = CellId("store", "lambda-walrus", $"outer={outer}"), Family = Family.Store, Source = Join(lines) + MainBlock(call.ToArray()), Tag = SharpyTag.MustRefuse, @@ -480,7 +480,7 @@ private static NameCell WalrusInComprehensionCell(ReadPosition body, BindingKind var moduleOuter = outer == BindingKind.ModuleVar; return new NameCell { - Id = CellId("store", "walrus-in-comprehension", $"outer={outer}", body), + Key = CellId("store", "walrus-in-comprehension", $"outer={outer}", body), Family = Family.Store, Source = Join(lines) + MainBlock(call.ToArray()), Tag = SharpyTag.MustRefuse, @@ -500,7 +500,7 @@ private static IEnumerable BuiltinStoreCells() { NameCell Cell(string label, IReadOnlyList lines, string[] main, Expected e, StoreForm form) => new() { - Id = CellId("store", "builtin", label, name), + Key = CellId("store", "builtin", label, name), Family = Family.Store, Source = Join(lines) + MainBlock(main), Tag = e.Tag, @@ -614,7 +614,7 @@ private static NameCell TypeMemberCell(string label, IEnumerable decl, I : supportText + mainBlock + declText; return new NameCell { - Id = CellId("typemember", kind, label, order == Order.Earlier ? "before" : "after"), + Key = CellId("typemember", kind, label, order == Order.Earlier ? "before" : "after"), Family = Family.TypeMember, Source = source, Tag = SharpyTag.MustRun, @@ -762,7 +762,7 @@ private static List LocalDecl(BindingKind k, ReadName n) } } - private static NameCell LocalProgram(string id, BindingKind binding, BindingKind outer, ReadPosition body, IReadOnlyList stmts, Expected e, string? shape, ReadName n, LocalTarget? construct = null) + private static NameCell LocalProgram(CellKey id, BindingKind binding, BindingKind outer, ReadPosition body, IReadOnlyList stmts, Expected e, string? shape, ReadName n, LocalTarget? construct = null) { var members = outer is BindingKind.StaticMethod or BindingKind.StaticField ? MemberDecl(outer, n) : new List(); var effectiveBody = stmts; @@ -786,7 +786,7 @@ private static NameCell LocalProgram(string id, BindingKind binding, BindingKind lines.AddRange(host); return new NameCell { - Id = id, + Key = id, Family = Family.Local, Source = WithHelpers(Join(lines) + MainBlock(call.ToArray())), Tag = e.Tag, @@ -831,7 +831,7 @@ private static IEnumerable LocalCells() foreach (var u in LocalOuters) foreach (var body in u is BindingKind.StaticMethod or BindingKind.StaticField ? new[] { ReadPosition.MethodBody } : LocalBodies) { - string Id(string read) => CellId("local", k, read, $"outer={u}", body); + CellKey Id(string read) => CellId("local", k, read, $"outer={u}", body); // Read below the binding: the innermost binding, in both languages. yield return LocalProgram(Id("below"), k, u, body, LocalDecl(k, plain).Append($"print({own})").ToList(), Run(value, "N1-innermost"), null, plain) with { Timing = ReadTimings.SameBlockBelow }; @@ -864,7 +864,7 @@ private static IEnumerable LocalCells() { var own = ReadText(FormOf(k), "", n); var builtinCall = ReadText(Form.Call, "", n); - string Id(string read) => CellId("local", k, read, "outer=Builtin", body, name); + CellKey Id(string read) => CellId("local", k, read, "outer=Builtin", body, name); yield return LocalProgram(Id("below"), k, BindingKind.Builtin, body, LocalDecl(k, n).Append($"print({own})").ToList(), Run(BuiltinBindingValue, "N1-innermost"), null, n); var above = new List { $"print({builtinCall})" }; above.AddRange(LocalDecl(k, n)); @@ -1123,7 +1123,7 @@ private static IEnumerable ImportedOuterCells() // The control: the import read with nothing else of the name, the probe every other arm is measured against. yield return WithImport(new NameCell { - Id = CellId("read", BindingKind.ImportedName, ReadPosition.FunctionBody, "control", "outer=ImportedName"), + Key = CellId("read", BindingKind.ImportedName, ReadPosition.FunctionBody, "control", "outer=ImportedName"), Family = Family.Read, Source = MainBlock($"print({ImportedReadText})"), Tag = SharpyTag.MustRun, @@ -1142,7 +1142,7 @@ private static IEnumerable ImportedOuterCells() lines.AddRange(ModuleDecl(t, Imported)); yield return WithImport(new NameCell { - Id = CellId("read", t, ReadPosition.ModuleInitializer, Order.Later, "outer=ImportedName"), + Key = CellId("read", t, ReadPosition.ModuleInitializer, Order.Later, "outer=ImportedName"), Family = Family.Read, Source = Join(lines) + MainBlock("print(r)"), Tag = SharpyTag.MustRefuse, @@ -1181,7 +1181,7 @@ private static IEnumerable ImportedOuterCells() }; yield return WithImport(new NameCell { - Id = CellId("store", s, "outer=ImportedName", body), + Key = CellId("store", s, "outer=ImportedName", body), Family = Family.Store, Source = WithHelpers(Join(lines) + MainBlock(main.ToArray())), Tag = expected.Tag, @@ -1200,7 +1200,7 @@ private static IEnumerable ImportedOuterCells() foreach (var body in LocalBodies) { var own = ReadText(FormOf(k), "", Imported); - string Id(string read) => CellId("local", k, read, "outer=ImportedName", body); + CellKey Id(string read) => CellId("local", k, read, "outer=ImportedName", body); yield return WithImport(LocalProgram(Id("below"), k, BindingKind.ImportedName, body, LocalDecl(k, Imported).Append($"print({own})").ToList(), Run(BuiltinBindingValue, "N1-innermost"), null, Imported)); @@ -1256,7 +1256,7 @@ private static IEnumerable SeedCells() var source = File.ReadAllText(Path.Combine(dir, id + ".spy")); yield return new NameCell { - Id = CellId("seed", id), + Key = CellId("seed", id), Family = Family.Seed, Source = source, Tag = tag, @@ -1368,7 +1368,7 @@ private static IEnumerable ClosedSetFailures(IReadOnlyList poo foreach (var failure in RequiredDeviationFailures(pool).Take(20)) yield return failure; - foreach (var failure in RuleAxesFailures(pool)) + foreach (var failure in RuleTableFailures(pool).Concat(AdmittedRuleFailures(pool))) yield return failure; // N3's cycles are the one question where a throw also keeps the promise. Any other rule under this tag would read a throw as agreement. diff --git a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Generator.cs b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Generator.cs index 760b949d9..453823137 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Generator.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Generator.cs @@ -457,8 +457,11 @@ internal static (List Lines, string Access) PlaceAtModule(ReadPosition p } } - private static string CellId(params object?[] parts) - => string.Join("/", parts.Where(p => p != null).Select(p => Convert.ToString(p, CultureInfo.InvariantCulture)!.Replace(' ', '_'))); + private static CellKey CellId(params object?[] parts) + { + var kept = parts.Where(p => p != null).Select(p => p!).ToArray(); + return new CellKey(string.Join("/", kept.Select(p => Convert.ToString(p, CultureInfo.InvariantCulture)!.Replace(' ', '_'))), kept); + } internal static string MainPrinting(string access, string[]? setup) => MainBlock((setup ?? Array.Empty()).Append($"print({access})").ToArray()); diff --git a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Read.cs b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Read.cs index f3e3201bd..7fcafc288 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Read.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Read.cs @@ -183,7 +183,7 @@ private static NameCell ClassCell( var expected = ExpectClass(t, p, nesting, order, s, outer, n, form); return new NameCell { - Id = CellId("read", t, p, nesting == Nesting.Direct ? null : nesting, order, s, $"outer={outer}", n.IsBuiltin ? n.Name : null), + Key = CellId("read", t, p, nesting == Nesting.Direct ? null : nesting, order, s, $"outer={outer}", n.IsBuiltin ? n.Name : null), Relation = DeclaringRelation.Self, Family = Family.Read, Source = source, @@ -221,7 +221,7 @@ private static NameCell ClassLocalOuterCell(BindingKind t, ReadPosition p, Order var value = ValueOf(outer); return new NameCell { - Id = CellId("read", t, p, order, Spelling.Bare, $"outer={outer}"), + Key = CellId("read", t, p, order, Spelling.Bare, $"outer={outer}"), Family = Family.Read, Source = source, Tag = SharpyTag.MustRun, @@ -359,7 +359,7 @@ private static NameCell QualifiedFromFunctionCell(BindingKind t, Order order, Sp var expected = IsInstance(t) ? Refuse(python, "kind:SPY0290") : Run(python, value, "N7"); return new NameCell { - Id = CellId("read", t, ReadPosition.FunctionBody, order, s, "outer=None"), + Key = CellId("read", t, ReadPosition.FunctionBody, order, s, "outer=None"), Family = Family.Read, Source = source, Tag = expected.Tag, @@ -406,6 +406,10 @@ p is ReadPosition.ModuleInitializer or ReadPosition.ModulePropertyInitializer or private static bool IsCompileTimeModule(BindingKind t) => t is BindingKind.ModuleLiteralConst; + /// A module binding whose read is a constant where a position takes constants only: a literal const, and an enum, + /// read as its member's .value (the owner's ruling of 2026-11-20, #2423 comment 7030074628 item 2: must-run). + private static bool IsConstantModuleRead(BindingKind t) => IsCompileTimeModule(t) || t == BindingKind.ModuleEnum; + private static NameCell ModuleCell(BindingKind t, ReadPosition p, Nesting nesting, Order order, Spelling s) { var n = ReadName.Plain; @@ -469,7 +473,7 @@ string Build(ReadPosition position) rule = "N1-nesting"; if (t == BindingKind.ModuleLet) expected = new Expected(SharpyTag.MayRefuse, Str(value), python, "kind:SPY0340"); - else if ((IsConstantOnly(p) || p == ReadPosition.EnumMemberValue) && !IsCompileTimeModule(t)) + else if ((IsConstantOnly(p) || p == ReadPosition.EnumMemberValue) && !IsConstantModuleRead(t)) expected = Refuse(python, p == ReadPosition.EnumMemberValue ? "kind:enum-member-constant" : "SPY0401"); else expected = Run(python, value, rule); @@ -477,7 +481,7 @@ string Build(ReadPosition position) return new NameCell { - Id = CellId("read", t, p, nesting == Nesting.Direct ? null : nesting, order, s, "outer=None"), + Key = CellId("read", t, p, nesting == Nesting.Direct ? null : nesting, order, s, "outer=None"), Family = Family.Read, Source = source, TwinSource = p == ReadPosition.ModuleAccessorBody ? Build(ReadPosition.FunctionBody).Replace("print(r)", "print(r())", StringComparison.Ordinal) : null, @@ -506,7 +510,7 @@ private static NameCell ModuleLocalOuterCell(BindingKind t, ReadPosition p, Bind var value = ValueOf(outer); return new NameCell { - Id = CellId("read", t, p, Order.Earlier, Spelling.Bare, $"outer={outer}"), + Key = CellId("read", t, p, Order.Earlier, Spelling.Bare, $"outer={outer}"), Family = Family.Read, Source = source, Tag = t == BindingKind.ModuleLet ? SharpyTag.MayRefuse : SharpyTag.MustRun, @@ -565,7 +569,7 @@ private static IEnumerable StrValueCells() { NameCell Cell(BindingKind t, ReadPosition p, string shape, Expected e, IEnumerable lines, string print) => new() { - Id = CellId("read", "str", t, p, shape), + Key = CellId("read", "str", t, p, shape), Family = Family.Read, Source = WithHelpers(Join(lines) + MainBlock(print)), Tag = e.Tag, @@ -644,7 +648,7 @@ private static IEnumerable UnionAndInterfaceReadCells() var all = o == Order.Earlier ? decl.Concat(lines) : lines.Concat(decl); yield return new NameCell { - Id = CellId("read", t, p, o, Spelling.Bare, "outer=None"), + Key = CellId("read", t, p, o, Spelling.Bare, "outer=None"), Family = Family.Read, Source = Join(all) + MainBlock($"print({access})"), Tag = SharpyTag.MustRun, @@ -695,7 +699,7 @@ private static IEnumerable ReadBuiltinModuleCells() var reader = $"def r() -> None:\n print({n.Name})\n"; yield return new NameCell { - Id = CellId("read", BindingKind.ModuleVar, ReadPosition.FunctionBody, o, "PrintedValue", "outer=Builtin", n.Name), + Key = CellId("read", BindingKind.ModuleVar, ReadPosition.FunctionBody, o, "PrintedValue", "outer=Builtin", n.Name), Family = Family.Read, Source = (o == Order.Earlier ? decl + reader : reader + decl) + MainBlock("r()"), Tag = SharpyTag.MustRun, @@ -759,7 +763,7 @@ private static NameCell BuiltinModuleCell(BindingKind t, ReadPosition p, Nesting return new NameCell { - Id = CellId("read", t, p, order, form, "outer=Builtin", n.Name), + Key = CellId("read", t, p, order, form, "outer=Builtin", n.Name), Family = Family.Read, Source = source, Tag = expected.Tag, @@ -788,7 +792,7 @@ private static NameCell BuiltinClassCell(ReadName n, Order order, bool arityMatc : arityMatches ? Run(9, "N1") : Refuse(python, "N1-arity"); return new NameCell { - Id = CellId("read", BindingKind.ModuleClass, ReadPosition.FunctionBody, order, arityMatches ? "arity-match" : "arity-mismatch", "outer=Builtin", n.Name), + Key = CellId("read", BindingKind.ModuleClass, ReadPosition.FunctionBody, order, arityMatches ? "arity-match" : "arity-mismatch", "outer=Builtin", n.Name), Family = Family.Read, Source = Join(lines) + MainBlock("print(r())"), Tag = expected.Tag, @@ -822,7 +826,7 @@ private static IEnumerable GenericReceiverCells() var main = MainBlock($"print({read})"); yield return new NameCell { - Id = CellId("read", kind, ReadPosition.FunctionBody, order, "GenericReceiver", "outer=None"), + Key = CellId("read", kind, ReadPosition.FunctionBody, order, "GenericReceiver", "outer=None"), Family = Family.Read, Source = order == Order.Earlier ? Join(type) + main : main + Join(type), Tag = SharpyTag.MustRun, @@ -881,7 +885,7 @@ private static IEnumerable ReadDeclaringCells() } yield return new NameCell { - Id = CellId("read", t, p, "base", Spelling.Bare, $"outer={u}"), + Key = CellId("read", t, p, "base", Spelling.Bare, $"outer={u}"), Relation = DeclaringRelation.Base, Family = Family.Read, Source = WithHelpers(Join(lines) + MainPrinting(placed.Access, placed.Setup)), @@ -906,12 +910,13 @@ private static IEnumerable ReadDeclaringCells() lines.AddRange(Indent(placed.Members)); bool load = IsInitializer(p); var python = prefix == "H." && load ? PyOutcome.Name("H") : PyOutcome.Ran(value); - var expected = IsConstantOnly(p) && (t != BindingKind.ClassLiteralConst || prefix != "B.") + // A literal const is a constant through its declaring class or a subclass of it (the same ruling, item 2). + var expected = IsConstantOnly(p) && (t != BindingKind.ClassLiteralConst || prefix == "self.") ? Refuse(python, "SPY0401") : Run(python, value, "N7"); yield return new NameCell { - Id = CellId("read", t, p, "base", label), + Key = CellId("read", t, p, "base", label), Relation = DeclaringRelation.Base, Family = Family.Read, Source = WithHelpers(Join(lines) + MainPrinting(placed.Access, placed.Setup)), @@ -939,7 +944,7 @@ private static IEnumerable ReadDeclaringCells() var python = o == Order.Later && IsInitializer(p) ? PyOutcome.Name("B") : PyOutcome.Ran(value); yield return new NameCell { - Id = CellId("read", t, p, "other", o, "B.x"), + Key = CellId("read", t, p, "other", o, "B.x"), Relation = DeclaringRelation.Other, Family = Family.Read, Source = WithHelpers(Join(lines) + MainPrinting(placed.Access, placed.Setup)), @@ -982,7 +987,7 @@ private static IEnumerable ReadDeclaringCells() expected = Refuse(PyOutcome.Other("TypeError"), "N1-type-error"); yield return new NameCell { - Id = CellId("read", t, label, "enclosing", Spelling.Bare, $"outer={u}"), + Key = CellId("read", t, label, "enclosing", Spelling.Bare, $"outer={u}"), Relation = DeclaringRelation.Enclosing, Family = Family.Read, Source = WithHelpers(Join(lines) + MainBlock($"print({access})")), @@ -1003,7 +1008,7 @@ private static IEnumerable ReadDeclaringCells() lines.AddRange(Indent(inner.Select(l => l.Replace("{E}", ReadText(form, "H.", n), StringComparison.Ordinal)))); yield return new NameCell { - Id = CellId("read", t, label, "enclosing", Spelling.Qualified), + Key = CellId("read", t, label, "enclosing", Spelling.Qualified), Relation = DeclaringRelation.Enclosing, Family = Family.Read, Source = WithHelpers(Join(lines) + MainBlock($"print({access})")), @@ -1064,7 +1069,7 @@ private static IEnumerable TypePositionCells() var twinMain = at == TypePosition.ResultError ? new[] { "print(r())" } : main; yield return new NameCell { - Id = CellId("read", "type-position", label, o), + Key = CellId("read", "type-position", label, o), Family = Family.Read, Source = (o == Order.Earlier ? target + reader : reader + target) + MainBlock(main), TwinSource = twin == null ? null : (o == Order.Earlier ? target + twin : twin + target) + MainBlock(twinMain), @@ -1086,7 +1091,7 @@ private static IEnumerable TypePositionCells() const string Reader = "def r() -> str:\n try:\n raise Later()\n except Later as e:\n return \"caught\"\n"; yield return new NameCell { - Id = CellId("read", "type-position", "except-clause", o), + Key = CellId("read", "type-position", "except-clause", o), Family = Family.Read, Source = (o == Order.Earlier ? Raising + Reader : Reader + Raising) + MainBlock("print(r())"), Tag = SharpyTag.MustRun, @@ -1102,7 +1107,7 @@ private static IEnumerable TypePositionCells() const string TryReader = "def boom() -> int:\n raise Later()\ndef r() -> str:\n x = try[Later] boom()\n match x:\n case Ok(v):\n return str(v)\n case Err(e):\n return \"caught\"\n"; yield return new NameCell { - Id = CellId("read", "type-position", "try-exception-type", o), + Key = CellId("read", "type-position", "try-exception-type", o), Family = Family.Read, Source = (o == Order.Earlier ? Raising + TryReader : TryReader + Raising) + MainBlock("print(r())"), TwinSource = "def r() -> str:\n return \"caught\"\n" + MainBlock("print(r())"), diff --git a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.RuleTable.cs b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.RuleTable.cs new file mode 100644 index 000000000..3bfc45fba --- /dev/null +++ b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.RuleTable.cs @@ -0,0 +1,353 @@ +using System.Text.Json; +using Sharpy.TestInfrastructure.Oracles; +using Xunit; + +namespace Sharpy.Compiler.Tests.Conformance; + +/// A cell's id with the values the generator built it from, each still carrying its type. The rule table's key +/// axes read these (): an order or a spelling is the enum +/// value the generator passed, never a token found in the id's text. +internal sealed record CellKey(string Text, IReadOnlyList Parts) +{ + /// The first part of this type, or null when the key spells none. + public T? Part() where T : struct, Enum + { + foreach (var part in Parts) + { + if (part is T value) + return value; + } + return null; + } + + /// The sub-generator's own label: the part after the family where it is text, not an axis value. + public string? Route => Parts.Count > 1 && Parts[1] is string s ? s : null; + + /// The text parts after the route: the generator's labels with no enumeration behind them. An + /// outer= part repeats and is not one. + public IEnumerable Marks => Parts.Skip(2).OfType().Where(s => !s.StartsWith("outer=", StringComparison.Ordinal)); + + public override string ToString() => Text; +} + +/// +/// The binding and scoping rule table (#2487; contract §11's case → expected map): name-resolution-rules.txt, +/// data beside the allowlist. A row is a tag, a rule id and a conjunction of axis constraints. Every generated cell +/// of every pool that reads the table matches exactly one row, and that row's tag and rule are the cell's: a verdict +/// is a function of the axes, so an arm retagged to a rule whose codes also fit is red here, which a per-rule +/// predicate could not see (#2457 cell 1: 2733 of the pool's cells fit a second rule's predicate). Every row has a cell. +/// +public partial class NameResolutionDifferentialTests +{ + private const string RuleTableFileName = "name-resolution-rules.txt"; + + /// Edit-loop only: a path that receives every cell's axis values, one JSON line each after a header line of + /// the axes' universes and classes. It is what a row is written against; no test reads it. + internal const string RuleTableDumpEnv = "NAME_RES_RULE_TABLE_DUMP"; + + /// The value of an axis a cell does not carry. + internal const string Unset = "-"; + + /// An axis of the table. is the enumeration's names, or null for an axis closed by + /// the pools: a value the table names there must be carried by a cell. : a cell carries any + /// number of values, and a constraint asks whether it carries one of the listed. + internal sealed record RuleAxis( + string Name, + Func> Read, + IReadOnlyCollection? Universe, + IReadOnlyDictionary> Classes, + bool SetValued = false); + + internal sealed record RuleConstraint(RuleAxis Axis, bool Negated, IReadOnlySet Values, string Text) + { + public bool Holds(NameCell cell) + { + bool any = false; + foreach (var value in Axis.Read(cell)) + { + if (Values.Contains(value)) + { + any = true; + break; + } + } + return any != Negated; + } + } + + /// A row. null is *: the cell's own tag, which only the seed row may say (a seed's tag + /// is its line in the seed table). + internal sealed record RuleRow(int Line, SharpyTag? Tag, string Rule, IReadOnlyList Constraints, string Text) + { + public bool Matches(NameCell cell) + { + foreach (var constraint in Constraints) + { + if (!constraint.Holds(cell)) + return false; + } + return true; + } + } + + private static IReadOnlySet NamesWhere(Func holds) where T : struct, Enum + => Enum.GetValues().Where(holds).Select(v => v.ToString()).ToHashSet(StringComparer.Ordinal); + + private static IEnumerable One(object? value) => new[] { value?.ToString() ?? Unset }; + + private static RuleAxis EnumAxis(string name, Func read, IReadOnlyDictionary>? classes = null) where T : struct, Enum + => new(name, c => One(read(c)), Enum.GetNames(), classes ?? new Dictionary>()); + + private static RuleAxis KeyAxis(string name) where T : struct, Enum + => EnumAxis(name, c => c.Key?.Part()); + + /// The classes of a binding kind, each the image of the roster or predicate the generator itself branches on. + private static IReadOnlyDictionary> BindingKindClasses() => new Dictionary>(StringComparer.Ordinal) + { + ["Module"] = NamesWhere(NameResolutionRosters.ModuleLevelKinds.Contains), + ["TypeLevel"] = NamesWhere(NameResolutionRosters.TypeLevelKinds.Contains), + ["Instance"] = NamesWhere(NameResolutionRosters.InstanceKinds.Contains), + ["PositionLocal"] = NamesWhere(NameResolutionRosters.PositionLocalKinds.Contains), + ["Named"] = NamesWhere(IsNamedOuter), + ["LocalOuter"] = NamesWhere(IsLocalOuter), + ["NonWritableByMeaning"] = NamesWhere(IsNonWritableByMeaning), + ["TypeLevelMember"] = NamesWhere(IsTypeLevelMember), + ["CallForm"] = NamesWhere(k => FormOf(k) == Form.Call), + ["CtorForm"] = NamesWhere(k => FormOf(k) == Form.Ctor), + ["ValueForm"] = NamesWhere(k => FormOf(k) == Form.Value), + }; + + private static IReadOnlyDictionary> ReadPositionClasses() => new Dictionary>(StringComparer.Ordinal) + { + ["Initializer"] = NamesWhere(IsInitializer), + ["ConstantOnly"] = NamesWhere(IsConstantOnly), + ["StructClosureBody"] = NamesWhere(NameResolutionRosters.StructClosureBodies.Contains), + }; + + /// The table's axes. Each is a typed property of the cell or a typed part of its key, except the three the + /// generator spells as text with no enumeration behind them: route (a sub-generator's label), mark (the + /// other labels of a key) and shape / deviation (an unruled question's name, a docs/deviations.yaml + /// row id). Those are closed by the pools. + internal static IReadOnlyList RuleTableAxes => LazyRuleTableAxes.Value; + + /// Lazy: the classes read rosters other files of this class initialize. + private static readonly Lazy> LazyRuleTableAxes = new(() => new[] + { + EnumAxis("family", c => c.Family), + EnumAxis("target", c => c.Target, BindingKindClasses()), + EnumAxis("outer", c => c.Outer, BindingKindClasses()), + EnumAxis("position", c => c.Position, ReadPositionClasses()), + EnumAxis("relation", c => c.Relation), + EnumAxis("form", c => c.Form), + EnumAxis("construct", c => c.Construct), + EnumAxis("timing", c => c.Timing), + EnumAxis("declaration", c => c.Declaration), + EnumAxis("typeAt", c => c.TypeAt), + KeyAxis("order"), + KeyAxis("spelling"), + KeyAxis("nesting"), + KeyAxis
("readForm"), + KeyAxis("receiver"), + KeyAxis("resultForm"), + KeyAxis("storeSpelling"), + new RuleAxis("route", c => One(c.Family == Family.Seed ? null : c.Key?.Route), null, new Dictionary>()), + new RuleAxis("mark", c => c.Family == Family.Seed ? Array.Empty() : c.Key?.Marks ?? Array.Empty(), null, new Dictionary>(), SetValued: true), + new RuleAxis("shape", c => One(c.Shape), null, new Dictionary>()), + new RuleAxis("deviation", c => One(c.Deviation), null, new Dictionary>()), + }); + + /// The table's rows: <Tag|*> <rule> axis=value,@Class axis!=value …. Constraints on one row conjoin; the + /// values of one constraint are alternatives; - is an axis the cell does not carry; # opens a comment line. + internal static List ParseRuleTable(IEnumerable lines, List problems) + { + var axes = RuleTableAxes.ToDictionary(a => a.Name, StringComparer.Ordinal); + var rows = new List(); + int number = 0; + foreach (var raw in lines) + { + number++; + var line = raw.Trim(); + if (line.Length == 0 || line.StartsWith('#')) + continue; + var fields = line.Split(' ', StringSplitOptions.RemoveEmptyEntries); + SharpyTag? tag = null; + if (fields.Length < 2 || (fields[0] != "*" && !Enum.TryParse(fields[0], out var parsed))) + { + problems.Add($"RuleTable L{number}: '{line}' must be ' axis=value …'"); + continue; + } + if (fields[0] != "*") + tag = Enum.Parse(fields[0]); + + var constraints = new List(); + bool bad = false; + foreach (var field in fields.Skip(2)) + { + bool negated = field.Contains("!=", StringComparison.Ordinal); + var split = field.Split(negated ? "!=" : "=", 2); + if (split.Length != 2 || !axes.TryGetValue(split[0], out var axis)) + { + problems.Add($"RuleTable L{number}: '{field}' names no axis"); + bad = true; + continue; + } + var values = new HashSet(StringComparer.Ordinal); + foreach (var item in split[1].Split(',', StringSplitOptions.RemoveEmptyEntries)) + { + if (item.StartsWith('@')) + { + if (axis.Classes.TryGetValue(item[1..], out var members)) + values.UnionWith(members); + else + { + problems.Add($"RuleTable L{number}: {axis.Name} has no class {item}"); + bad = true; + } + } + else if (item != Unset && axis.Universe != null && !axis.Universe.Contains(item)) + { + problems.Add($"RuleTable L{number}: {item} is no value of {axis.Name}"); + bad = true; + } + else + values.Add(item); + } + if (values.Count == 0) + { + problems.Add($"RuleTable L{number}: '{field}' lists no value"); + bad = true; + } + constraints.Add(new RuleConstraint(axis, negated, values, field)); + } + if (!bad) + rows.Add(new RuleRow(number, tag, fields[1], constraints, line)); + } + return rows; + } + + private static readonly Lazy<(List Rows, List Problems)> LoadedRuleTable = new(() => + { + var problems = new List(); + var path = PythonInterpreter.FindRepoFile("src", "Sharpy.Compiler.Tests", "Conformance", RuleTableFileName); + if (path == null) + return (new List(), new List { $"RuleTable: Conformance/{RuleTableFileName} is missing. It is the table every pool is judged by." }); + return (ParseRuleTable(File.ReadAllLines(path), problems), problems); + }); + + internal static IReadOnlyList RuleTable() => LoadedRuleTable.Value.Rows; + + /// The pools that read the table. A row's cell may be in any of them; a cell's row is checked in its own sweep. + internal static readonly IReadOnlyList<(string Name, Func> Cells)> RuleTablePools = new (string, Func>)[] + { + (nameof(NameResolutionDifferentialTests), GeneratedCells), + }; + + /// The rows that claim a cell. One is the verdict; none or several is a totality failure. + internal static List RowsOf(IReadOnlyList rows, NameCell cell) + { + var matched = new List(1); + foreach (var row in rows) + { + if (row.Matches(cell)) + matched.Add(row); + } + return matched; + } + + /// The table's totality over one pool: every cell has a key, matches exactly one row, and carries that + /// row's tag and rule. Capped per kind, with the count. + internal static IEnumerable RuleTableCellFailures(IReadOnlyList rows, IReadOnlyList pool) + { + var none = new List(); + var several = new List(); + var differs = new List(); + foreach (var cell in pool) + { + if (cell.Key == null) + { + yield return $"RuleTable: {cell.Id} carries no key, so no key axis reads it"; + continue; + } + var matched = RowsOf(rows, cell); + if (matched.Count == 0) + none.Add($"RuleTable: {cell.Id} ({cell.Tag}, {cell.Rule}) matches no row"); + else if (matched.Count > 1) + several.Add($"RuleTable: {cell.Id} ({cell.Tag}, {cell.Rule}) matches rows L{string.Join(", L", matched.Select(r => r.Line))}"); + else if (matched[0].Rule != cell.Rule || (matched[0].Tag ?? cell.Tag) != cell.Tag) + differs.Add($"RuleTable: {cell.Id} is generated {cell.Tag} under {cell.Rule}, and its row L{matched[0].Line} says {matched[0].Tag?.ToString() ?? "*"} under {matched[0].Rule}"); + } + foreach (var group in new[] { none, several, differs }) + { + foreach (var failure in group.Take(25)) + yield return failure; + if (group.Count > 25) + yield return $"RuleTable: … {group.Count} such cells in total"; + } + } + + /// The table's totality over its rows, counted over every pool that reads it: a row has a cell, only the seed + /// row leaves the tag to the cell, and a value named on an axis the pools close is carried by a cell. + internal static IEnumerable RuleTableRowFailures(IReadOnlyList rows, IReadOnlyList cells) + { + foreach (var problem in LoadedRuleTable.Value.Problems) + yield return problem; + foreach (var row in rows) + { + if (row.Tag == null && row.Rule != "seed") + yield return $"RuleTable L{row.Line}: only the seed row may leave the tag to its cell"; + if (!cells.Any(row.Matches)) + yield return $"RuleTable L{row.Line}: no cell of any pool matches '{row.Text}'"; + } + foreach (var axis in RuleTableAxes.Where(a => a.Universe == null)) + { + var carried = cells.SelectMany(axis.Read).ToHashSet(StringComparer.Ordinal); + foreach (var row in rows) + { + foreach (var constraint in row.Constraints.Where(c => c.Axis == axis)) + { + foreach (var value in constraint.Values.Where(v => v != Unset && !carried.Contains(v))) + yield return $"RuleTable L{row.Line}: no cell carries {axis.Name} {value}"; + } + } + } + } + + /// Both directions for this pool, as the sweep and the fact read them. + internal static IEnumerable RuleTableFailures(IReadOnlyList pool) + { + var rows = RuleTable(); + return RuleTableRowFailures(rows, RuleTablePools.SelectMany(p => p.Cells()).ToList()).Concat(RuleTableCellFailures(rows, pool)); + } + + private static void DumpRuleTableAxes(string path) + { + using var writer = new StreamWriter(path); + writer.WriteLine(JsonSerializer.Serialize(new + { + axes = RuleTableAxes.Select(a => new + { + name = a.Name, + universe = a.Universe, + setValued = a.SetValued, + classes = a.Classes.ToDictionary(c => c.Key, c => c.Value.OrderBy(v => v, StringComparer.Ordinal).ToList()), + }), + })); + foreach (var (pool, cells) in RuleTablePools) + { + foreach (var c in cells()) + { + writer.WriteLine(JsonSerializer.Serialize(new + { + pool, + id = c.Id, + tag = c.Tag.ToString(), + rule = c.Rule, + model = c.Model, + python = c.Python.ToString(), + source = c.Source, + axes = RuleTableAxes.ToDictionary(a => a.Name, a => a.Read(c).ToList()), + })); + } + } + } +} diff --git a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.cs b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.cs index 30c97af5c..e5bc55370 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.cs @@ -80,7 +80,18 @@ internal enum VerdictClass /// One generated cell: one Sharpy program, its twin (rendered from the source) and both predictions. internal sealed record NameCell { - public required string Id { get; init; } + private readonly string? _id; + + /// The cell's id. A generated cell's is its 's text; a fact's literal cell sets it alone. + public string Id + { + get => _id ?? Key?.Text ?? throw new InvalidOperationException("a cell carries an id or a key"); + init => _id = value; + } + + /// The values the generator built the id from, each with its type: what the rule table's key axes read + /// (NameResolutionDifferentialTests.RuleTableAxes), so no axis is read back from the id's text. + public CellKey? Key { get; init; } public required Family Family { get; init; } public required string Source { get; init; } public required SharpyTag Tag { get; init; } diff --git a/src/Sharpy.Compiler.Tests/Conformance/name-resolution-differential-allowlist.txt b/src/Sharpy.Compiler.Tests/Conformance/name-resolution-differential-allowlist.txt index fab6071e6..3ab6edfa3 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/name-resolution-differential-allowlist.txt +++ b/src/Sharpy.Compiler.Tests/Conformance/name-resolution-differential-allowlist.txt @@ -569,7 +569,6 @@ read/ClassLiteralConst/ParameterDefault/Later/Bare/outer=ModuleComputedConst Sil read/ClassLiteralConst/ParameterDefault/Later/Bare/outer=ModuleLiteralConst SilentWrong # #2423 missing-refusal read/ClassLiteralConst/ParameterDefault/Later/Bare/outer=ModuleProperty SilentWrong # #2423 missing-refusal read/ClassLiteralConst/ParameterDefault/Later/Bare/outer=ModuleVar SilentWrong # #2423 missing-refusal -read/ClassLiteralConst/ParameterDefault/base/H.x SilentWrong # #2423 missing-refusal read/ClassLiteralConst/StaticInitializer/ComprehensionElement/Earlier/Bare/outer=ModuleDef FalseRefusal # #2423 false-refusal read/ClassLiteralConst/StaticInitializer/ComprehensionElement/Earlier/Bare/outer=ModuleVar SilentWrong # #2423 silent-wrong read/ClassLiteralConst/StaticInitializer/ComprehensionElement/Earlier/Bare/outer=None SilentWrong # #2423 missing-refusal @@ -914,14 +913,6 @@ read/ModuleDef/StaticInitializer/Later/Call/outer=Builtin/abs SilentWrong # #242 read/ModuleDef/StaticInitializer/Later/Call/outer=Builtin/int SilentWrong # #2423 missing-refusal read/ModuleDef/StaticInitializer/Later/Call/outer=Builtin/len SilentWrong # #2423 missing-refusal read/ModuleDef/StaticInitializer/Later/Call/outer=Builtin/max SilentWrong # #2423 missing-refusal -read/ModuleEnum/DataclassFieldInitializer/Earlier/Bare/outer=None SilentWrong # #2423 missing-refusal -read/ModuleEnum/DataclassFieldInitializer/Later/Bare/outer=None SilentWrong # #2423 missing-refusal -read/ModuleEnum/EnumMemberValue/Earlier/Bare/outer=None SilentWrong # #2423 missing-refusal -read/ModuleEnum/EnumMemberValue/Later/Bare/outer=None SilentWrong # #2423 missing-refusal -read/ModuleEnum/ParameterDefault/Earlier/Bare/outer=None SilentWrong # #2423 missing-refusal -read/ModuleEnum/ParameterDefault/Later/Bare/outer=None SilentWrong # #2423 missing-refusal -read/ModuleEnum/StructFieldInitializer/Earlier/Bare/outer=None SilentWrong # #2423 missing-refusal -read/ModuleEnum/StructFieldInitializer/Later/Bare/outer=None SilentWrong # #2423 missing-refusal read/ModuleProperty/ComprehensionElement/Later/Bare/outer=None Ice # #2423 ice read/ModuleProperty/ComprehensionElement/Later/Call/outer=Builtin/abs Ice # #2423 ice read/ModuleProperty/ComprehensionElement/Later/Call/outer=Builtin/int Ice # #2423 ice diff --git a/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt b/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt new file mode 100644 index 000000000..09884f3b2 --- /dev/null +++ b/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt @@ -0,0 +1,214 @@ +# The binding and scoping rule table (#2487): what each generated cell of the name-resolution pools must do, and +# under which rule of docs/design/name-resolution.md (N1…N7, S1…S3, the R-xx rulings and the kind refusals). +# +# A row is ` axis=value,… axis!=value,…`: +# - the tag is MustRun, MustRefuse, MustRefuseOrThrow, MayRefuse or Unruled; `*` (the seed row only) leaves it to +# the seed table; +# - constraints on one row all hold; the values of one constraint are alternatives; `-` is an axis the cell does +# not carry; `@Class` is a class of the axis (NameResolutionDifferentialTests.RuleTable.cs builds each from the +# roster or predicate the generator branches on); `mark` holds when the cell's key carries one of the labels. +# - the axes and where each is read from: RuleTableAxes in the same file. +# +# Totality (RuleTable_EveryCellHasOneRow_AndEveryRowACell, and each sweep): every generated cell matches exactly one +# row, that row's tag and rule are the cell's, and every row has a cell in a pool that reads the table. A verdict +# changes here and in the generator together, or the test is red. +# +# The rows of the P77a pool were transcribed from the generator's Expect functions at the stage-0 commit of +# plan-777361 (P78) by splitting the pool on its axes until each part carries one tag and rule, then merging parts +# that differ on one axis. They are edited by hand from here on. + +# --- Read: 126 rows, 6271 cells --- +MustRun A3 family=Read route=- relation=Base target!=@CallForm,InstanceField,InstanceProperty outer=@Module,@TypeLevelMember,@Named position!=@ConstantOnly order!=Earlier +MustRun N1 family=Read route=- relation!=- spelling=Bare target=@TypeLevel outer=None position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order=Earlier nesting=- +MustRun N1 family=Read route=- relation!=- spelling=Bare target=@TypeLevel outer=None position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order=Earlier nesting=ComprehensionIterable +MustRun N1 family=Read route=- relation!=- spelling=Bare target=ClassLiteralConst outer=None position=@ConstantOnly order=Earlier +MustRun N1 family=Read route=- relation!=Self,Base readForm!=Call target!=@CallForm,@CtorForm,ModuleEnum,InstanceField,InstanceProperty outer=@Module,@TypeLevelMember,@Named position!=@ConstantOnly,ModuleInitializer order!=Earlier +MustRun N1 family=Read route=- relation!=Self,Base readForm=Call target=@NonWritableByMeaning outer=@Module,@TypeLevelMember,@Named position!=@Initializer,ModuleInitializer order!=Earlier +MustRun N1 family=Read route=- relation=- readForm!=Call target!=@ValueForm,InstanceMethod outer=@Module,@TypeLevelMember,@Named position!=@ConstantOnly,ModuleInitializer order!=Earlier mark=arity-match mark!=int +MustRun N1 family=Read route=- relation=- spelling!=Bare target=@NonWritableByMeaning,ModuleVar,ModuleLiteralConst,ModuleComputedConst,ModuleProperty outer=None position=@Initializer order=Earlier +MustRun N1 family=Read route=- relation=- spelling!=Bare target=@NonWritableByMeaning,ModuleVar,ModuleLiteralConst,ModuleComputedConst,ModuleProperty outer=None position=ModuleInitializer order=Earlier +MustRun N1 family=Read route=- relation=- spelling=Bare target!=ModuleLet outer=None position!=@ConstantOnly,ComprehensionElement nesting=Lambda +MustRun N1 family=Read route=- relation=- spelling=Bare target!=ModuleLet outer=None position!=@ConstantOnly,ComprehensionElement,EnumMemberValue order=Earlier nesting=- +MustRun N1 family=Read route=- relation=- spelling=Bare target!=ModuleLet outer=None position!=@Initializer,ComprehensionElement,ModuleInitializer,ModulePropertyInitializer,EnumMemberValue order!=Earlier nesting=- +MustRun N1 family=Read route=- relation=- spelling=Bare target=ModuleLiteralConst,ModuleEnum outer=None position=@ConstantOnly order=Earlier +MustRun N1 family=Read route=- relation=- spelling=Bare target=ModuleLiteralConst,ModuleEnum outer=None position=EnumMemberValue order=Earlier nesting=- +MustRun N1 family=Read route=- relation=- target!=ModuleLet outer=None position=ComprehensionElement +MustRun N1 family=Read route=- spelling!=Qualified readForm!=- target=@NonWritableByMeaning outer=@Module,@TypeLevelMember,@Named position!=@Initializer order=Earlier mark!=arity-mismatch +MustRun N1 family=Read route=- spelling!=Qualified readForm=- target=@NonWritableByMeaning outer=@Module,@TypeLevelMember,@Named position!=@Initializer order=Earlier mark!=arity-mismatch,int +MustRun N1 family=Read route=- spelling!=Qualified readForm=-,Call target!=@TypeLevelMember,@NonWritableByMeaning outer=@Module,@TypeLevelMember,@Named position!=@Initializer order=Earlier mark=PrintedValue +MustRun N1 family=Read route=- spelling!=Qualified readForm=Value target!=@TypeLevelMember,@NonWritableByMeaning outer=@Module,@TypeLevelMember,@Named position!=@Initializer order=Earlier +MustRun N1 family=Read route=- spelling!=Qualified target!=@Instance outer=ModuleVar,ModuleLiteralConst,ModuleComputedConst,ModuleProperty,ModuleUnion,ModuleInterface position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order=Earlier nesting=-,ComprehensionIterable +MustRun N1 family=Read route=- spelling!=Qualified target!=@ValueForm,InstanceMethod outer=@CallForm position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order=Earlier nesting=-,ComprehensionIterable +MustRun N1 family=Read route=- spelling!=Qualified target=@CtorForm,ModuleDef,ModuleEnum,LocalDef,LambdaTypedLocal outer=@CtorForm position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order=Earlier +MustRun N1 family=Read route=- spelling=Bare target=ClassLiteralConst outer=ModuleVar,ModuleLiteralConst,ModuleComputedConst,ModuleProperty,ModuleUnion,ModuleInterface position=@ConstantOnly order=Earlier +MustRun N1 family=Read route=-,comprehension,result-form,type-position relation=- resultForm=-,Err spelling!=Bare target=@NonWritableByMeaning,ModuleVar,ModuleLiteralConst,ModuleComputedConst,ModuleProperty outer=None position!=@Initializer,ComprehensionElement,ModuleInitializer +MustRun N1 family=Read route=order-observation relation=- spelling!=Bare target!=@Module,@TypeLevel outer=None position!=ComprehensionElement +MustRun N1+N3 family=Read route=- relation!=- spelling=Bare target=@TypeLevel outer=None position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order=Later nesting=- +MustRun N1+N3 family=Read route=- relation!=- spelling=Bare target=@TypeLevel outer=None position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order=Later nesting=ComprehensionIterable +MustRun N1+N3 family=Read route=- relation!=- spelling=Bare target=ClassLiteralConst outer=None position=@ConstantOnly order!=-,Earlier +MustRun N1+N3 family=Read route=- relation=Other spelling!=Bare target=@TypeLevel outer=None position!=@ConstantOnly +MustRefuse N1-arity family=Read route=- relation=- readForm!=Call target!=@ValueForm,InstanceMethod outer=@Module,@TypeLevelMember,@Named position!=@ConstantOnly,ModuleInitializer order!=Earlier mark!=arity-match,int +MustRefuse N1-arity family=Read route=- spelling!=Qualified target=@NonWritableByMeaning outer=@Module,@TypeLevelMember,@Named position!=@Initializer order=Earlier mark=arity-mismatch mark!=int +MustRun N1-innermost family=Read route=- relation!=Self target!=@Instance outer=@PositionLocal position!=@ConstantOnly order!=Earlier +MustRun N1-innermost family=Read route=- relation=- spelling=Bare target=@Instance outer!=None position=@Initializer nesting=- +MustRun N1-innermost family=Read route=- relation=- target=@Instance outer!=None position!=@Initializer +MustRun N1-innermost family=Read route=- target!=@Instance,ModuleLet outer=@PositionLocal position!=@ConstantOnly order=Earlier +MustRefuse N1-methods family=Read route=- relation!=- spelling=Bare target!=@TypeLevel outer=None position=@Initializer nesting=ComprehensionElement,Lambda +MustRefuse N1-methods family=Read route=- relation!=- spelling=Bare target=@TypeLevel outer=None position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order=Earlier,Later nesting=ComprehensionElement,Lambda +MustRefuse N1-methods family=Read route=-,sibling,struct relation!=- spelling=Bare outer=None position!=@Initializer order!=- +MustRefuse N1-methods family=Read route=sibling relation!=- spelling=Bare target=@TypeLevel outer=None position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order=Earlier,Later nesting=- +MustRun N1-nesting family=Read route=- relation=- spelling=Bare target!=ModuleLet outer=None position!=@ConstantOnly,ComprehensionElement nesting!=-,Lambda +MustRun N1-nesting family=Read route=comprehension relation=- target!=ModuleLet outer=None position=ComprehensionElement +MustRefuse N1-type-error family=Read route=- relation!=- target=InstanceMethod outer!=@CallForm,@CtorForm,ModuleEnum,None position!=@Initializer +MustRefuse N1-type-error family=Read route=- relation!=-,Self,Base readForm!=Call target!=@ValueForm,InstanceMethod outer=@Module,@TypeLevelMember,@Named position!=@ConstantOnly,ModuleInitializer order!=Earlier +MustRefuse N1-type-error family=Read route=- relation!=Self,Base readForm=Call target!=@NonWritableByMeaning,@Instance outer=@Module,@TypeLevelMember,@Named position!=@Initializer,ModuleInitializer order!=Earlier +MustRefuse N1-type-error family=Read route=- relation=Base target=ModuleDef,StaticMethod,LocalDef,LambdaTypedLocal outer=@Module,@TypeLevelMember,@Named position!=@ConstantOnly order!=Earlier +MustRefuse N1-type-error family=Read route=- relation=Self spelling=Bare target=@CtorForm,ModuleDef,ModuleEnum,LocalDef,LambdaTypedLocal outer!=None position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order!=Earlier nesting=ComprehensionElement,Lambda +MustRefuse N1-type-error family=Read route=- relation=Self spelling=Bare target=StaticMethod outer!=@NonWritableByMeaning,None position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order!=Earlier nesting=ComprehensionElement,Lambda +MustRefuse N1-type-error family=Read route=- relation=Self target!=@ValueForm,InstanceMethod outer=ModuleVar,ModuleLiteralConst,ModuleComputedConst,ModuleProperty,ModuleUnion,ModuleInterface position!=@Initializer order!=Earlier +MustRefuse N1-type-error family=Read route=- relation=Self target=@CtorForm,ModuleDef,ModuleEnum,LocalDef,LambdaTypedLocal outer=ModuleDef position!=@Initializer order!=Earlier +MustRefuse N1-type-error family=Read route=- spelling!=Qualified readForm=-,Call target!=@TypeLevelMember,@NonWritableByMeaning outer=@TypeLevelMember,@Named,ModuleVar,ModuleLiteralConst,ModuleComputedConst,ModuleProperty,ModuleDef position!=@Initializer order=Earlier mark!=PrintedValue +MustRefuse N1-type-error family=Read route=- spelling!=Qualified target!=@CallForm,@CtorForm,ModuleEnum,InstanceField,InstanceProperty outer!=@ValueForm position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order=Earlier nesting=-,ComprehensionIterable +MustRefuse N1-type-error family=Read route=- spelling!=Qualified target!=@Instance outer!=@Module,@PositionLocal,StaticMethod,InstanceMethod,Builtin,None position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order=Earlier +MustRefuse N1-type-error family=Read route=- spelling!=Qualified target!=@ValueForm,InstanceMethod outer=ModuleVar,ModuleLiteralConst,ModuleComputedConst,ModuleProperty,ModuleUnion,ModuleInterface position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order=Earlier nesting=ComprehensionElement,Lambda +MustRefuse N1-type-error family=Read route=- spelling!=Qualified target=@CtorForm,ModuleDef,ModuleEnum,LocalDef,LambdaTypedLocal outer=@CallForm position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order=Earlier nesting=ComprehensionElement,Lambda +MustRefuse N1-type-error family=Read route=- spelling!=Qualified target=@CtorForm,ModuleDef,ModuleEnum,LocalDef,LambdaTypedLocal outer=ModuleEnum position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order=Earlier +MustRefuse N1-type-error family=Read route=- spelling!=Qualified target=StaticMethod outer=@CtorForm,ModuleEnum position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order=Earlier +MustRefuse N1-type-error family=Read route=- spelling!=Qualified target=StaticMethod outer=ModuleVar,ModuleLiteralConst,ModuleComputedConst,ModuleProperty,ModuleUnion,ModuleInterface position!=@Initializer order=Earlier +MustRefuse N1-type-error family=Read route=- spelling=Bare target=ClassLiteralConst outer!=@Module,StaticMethod,InstanceMethod,Builtin,None position=@ConstantOnly order=Earlier +MustRefuse N1-type-error family=Read route=- spelling=Bare target=InstanceMethod outer!=@NonWritableByMeaning,None position=@Initializer nesting=ComprehensionElement,Lambda +MustRefuse N1-type-error family=Read route=- target=ClassLiteralConst outer!=@ValueForm position=@ConstantOnly order=Earlier +MustRefuse N2 family=Read route=- relation!=Base spelling=Bare target=ClassLiteralConst outer!=None position=@ConstantOnly order!=Earlier +MustRefuse N2 family=Read route=- relation=Self spelling=Bare target!=@Instance outer!=None position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order!=Earlier nesting=-,ComprehensionIterable +MustRefuse N2-module family=Read route=- relation!=Self,Base readForm=Call target!=@Instance outer=@Module,@TypeLevelMember,@Named position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order!=Earlier +MustRefuse N2-module family=Read route=- relation!=Self,Base target!=@Instance outer=@Module,@TypeLevelMember,@Named position=ModuleInitializer order!=Earlier +MustRun N3 family=Read route=- relation=- spelling!=Bare target=@NonWritableByMeaning,ModuleVar,ModuleLiteralConst,ModuleComputedConst,ModuleProperty outer=None position=@Initializer order!=Earlier +MustRun N3 family=Read route=- relation=- spelling=Bare target!=ModuleLet outer=None position=ModuleInitializer order=Later nesting=- +MustRun N3 family=Read route=- relation=- spelling=Bare target!=ModuleLet outer=None position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault,ModulePropertyInitializer order!=Earlier nesting=- +MustRun N3 family=Read route=- relation=- spelling=Bare target=ModuleLiteralConst,ModuleEnum outer=None position=@ConstantOnly order!=Earlier +MustRun N3 family=Read route=- relation=- spelling=Bare target=ModuleLiteralConst,ModuleEnum outer=None position=EnumMemberValue order!=Earlier nesting=- +MustRun N3 family=Read route=-,str relation=- spelling!=Bare target=@NonWritableByMeaning,ModuleVar,ModuleLiteralConst,ModuleComputedConst,ModuleProperty outer=None position=ModuleInitializer order!=Earlier +MustRun N3 family=Read route=order-observation relation=- spelling!=Bare target=@NonWritableByMeaning,ModuleVar,ModuleLiteralConst,ModuleComputedConst,ModuleProperty outer=None position!=ComprehensionElement,ModuleInitializer +MustRun N3 family=Read route=order-observation relation=- spelling!=Bare target=@TypeLevel outer=None position!=ComprehensionElement +MustRefuseOrThrow N3-cycle family=Read route=- relation!=- spelling=Bare target=@TypeLevel outer=None position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order=Self,Cycle +MustRefuseOrThrow N3-cycle family=Read route=- relation!=-,Other spelling!=Bare target=@TypeLevel outer=None position!=@ConstantOnly order=Self,Cycle +MustRefuseOrThrow N3-cycle family=Read route=- relation=- spelling=Bare target!=ModuleLet outer=None position=ModuleInitializer order=-,Self,Cycle nesting=- +MustRefuseOrThrow N3-cycle family=Read route=- relation=- target=ModuleLet outer=None order=Self,Cycle +MustRefuseOrThrow N3-cycle family=Read route=cycle relation=- outer=None +MustRefuseOrThrow N3-cycle family=Read route=str relation=- spelling!=Bare target=@TypeLevel outer=None position!=ComprehensionElement mark=self +MustRun N7 family=Read route=- relation!=- spelling!=Bare target=ClassLiteralConst outer=None position=@ConstantOnly +MustRun N7 family=Read route=- relation!=- spelling=SelfDot target!=@TypeLevel outer=None +MustRun N7 family=Read route=- relation=Self spelling!=Bare target!=@Instance outer!=None position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order!=Earlier +MustRun N7 family=Read route=- spelling!=Bare target=ClassLiteralConst outer!=@CallForm,@CtorForm,ModuleEnum,None position=@ConstantOnly order=Earlier +MustRun N7 family=Read route=- spelling!=Bare target=ClassLiteralConst outer!=None position=@ConstantOnly order!=Earlier +MustRun N7 family=Read route=- spelling=Qualified target!=@Instance outer=@Module,@TypeLevelMember,@Named position!=@ConstantOnly order=Earlier +MustRun N7 family=Read route=-,sibling,struct relation!=-,Other spelling!=Bare target=@TypeLevel outer=None position!=@ConstantOnly order=-,Earlier,Later +MustRun N7 family=Read route=-,str relation=- spelling!=Bare target=@TypeLevel outer=None position!=ComprehensionElement mark!=self +MustRun N7 family=Read route=struct relation!=- spelling=SelfDot target!=@TypeLevel outer=None position!=@StructClosureBody nesting=- +MustRun N7 family=Read route=type-position-alias relation=- spelling!=Bare target!=ModuleLet outer=None position!=ComprehensionElement +MustRefuse R-KG family=Read route=- relation!=-,Base spelling=Bare outer=None position!=@Initializer order=- +MustRefuse R-KG family=Read route=- relation!=-,Base spelling=Bare target=@TypeLevel outer=None position=@Initializer order=- +MustRefuse R-KT family=Read route=struct relation!=- spelling=SelfDot target!=@TypeLevel outer=None position!=@StructClosureBody nesting!=- +MustRefuse R-KT family=Read route=struct relation!=- spelling=SelfDot target!=@TypeLevel outer=None position=@StructClosureBody +MustRun R-Y family=Read route=- relation!=- target=InstanceField,InstanceProperty outer!=None position!=@Initializer +MustRun R-Y family=Read route=- relation!=- target=InstanceMethod outer!=@ValueForm position!=@Initializer +MustRun R-Y family=Read route=- relation=Self spelling=Bare target!=@CallForm,@CtorForm,ModuleEnum,InstanceField,InstanceProperty outer!=None position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order!=Earlier nesting=ComprehensionElement,Lambda +MustRun R-Y family=Read route=- relation=Self spelling=Bare target=StaticMethod outer=@NonWritableByMeaning position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order!=Earlier nesting=ComprehensionElement,Lambda +MustRun R-Y family=Read route=- relation=Self target!=@CallForm,@CtorForm,ModuleEnum,InstanceField,InstanceProperty outer!=None position!=@Initializer order!=Earlier +MustRun R-Y family=Read route=- relation=Self target!=@ValueForm,InstanceMethod outer=@PositionLocal,@TypeLevelMember,@CtorForm,@Named,ModuleEnum position!=@Initializer order!=Earlier +MustRun R-Y family=Read route=- relation=Self target=StaticMethod outer=ModuleDef position!=@Initializer order!=Earlier +MustRun R-Y family=Read route=- spelling!=Qualified readForm=-,Call target!=@TypeLevelMember,@NonWritableByMeaning outer=@CtorForm,ModuleEnum,ModuleUnion,ModuleInterface position!=@Initializer order=Earlier mark!=PrintedValue +MustRun R-Y family=Read route=- spelling!=Qualified target!=@CallForm,@CtorForm,ModuleEnum,InstanceField,InstanceProperty outer=@Module,StaticMethod,InstanceMethod,Builtin position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order=Earlier nesting=ComprehensionElement,Lambda +MustRun R-Y family=Read route=- spelling!=Qualified target=StaticField,StaticProperty,ClassLiteralConst,ClassComputedConst outer=@Module,@TypeLevelMember,@Named position!=@Initializer order=Earlier +MustRun R-Y family=Read route=- spelling!=Qualified target=StaticMethod outer=@CallForm position=StaticInitializer,InstanceFieldInitializer,DataclassInitFieldInitializer,StructInitFieldInitializer,ConstInitializer,StaticPropertyDefault,InstancePropertyDefault order=Earlier nesting=ComprehensionElement,Lambda +MustRun R-Y family=Read route=- spelling!=Qualified target=StaticMethod outer=@TypeLevelMember,@CtorForm,@Named,ModuleDef,ModuleEnum position!=@Initializer order=Earlier +MustRun R-Y family=Read route=- spelling=Bare target=InstanceField,InstanceProperty outer!=None position=@Initializer nesting=ComprehensionElement,Lambda +MustRun R-Y family=Read route=- spelling=Bare target=InstanceMethod outer=@NonWritableByMeaning position=@Initializer nesting=ComprehensionElement,Lambda +MustRefuse R1(b) family=Read route=- relation=Base spelling=Bare outer=None position!=@Initializer order=- +MustRefuse R1(b) family=Read route=- relation=Base spelling=Bare target=@TypeLevel outer=None position=@Initializer order=- +MustRefuse SPY0401 family=Read route=- relation!=- spelling!=Bare target=StaticField,StaticProperty,StaticMethod,ClassComputedConst,NestedType outer=None position=@ConstantOnly +MustRefuse SPY0401 family=Read route=- relation!=- spelling=Bare target=StaticField,StaticProperty,StaticMethod,ClassComputedConst,NestedType outer=None position=@ConstantOnly order!=- +MustRefuse SPY0401 family=Read route=- relation=- spelling=Bare target!=ModuleLet,ModuleLiteralConst,ModuleEnum outer=None position=@ConstantOnly +MustRefuse SPY0401 family=Read route=- relation=Base spelling=Bare target=ClassLiteralConst outer!=None position=@ConstantOnly order!=Earlier +MustRefuse SPY0401 family=Read route=- target!=@Instance,ClassLiteralConst outer!=None position=@ConstantOnly +MustRefuse kind:SPY0212 family=Read route=- relation=- readForm!=Call target!=@ValueForm,InstanceMethod outer=@Module,@TypeLevelMember,@Named position!=@ConstantOnly,ModuleInitializer order!=Earlier mark=int +MustRefuse kind:SPY0212 family=Read route=- spelling!=Qualified readForm=- target=@NonWritableByMeaning outer=@Module,@TypeLevelMember,@Named position!=@Initializer order=Earlier mark=int mark!=arity-mismatch +MustRefuse kind:SPY0212 family=Read route=- spelling!=Qualified target=@NonWritableByMeaning outer=@Module,@TypeLevelMember,@Named position!=@Initializer order=Earlier mark=arity-mismatch mark=int +MustRefuse kind:SPY0290 family=Read route=- relation=- spelling!=Bare target!=@Module,@TypeLevel outer=None position!=ComprehensionElement +MustRefuse kind:SPY0290 family=Read route=- spelling!=Bare target=@Instance outer!=None position=@Initializer +MustRefuse kind:SPY0290 family=Read route=-,struct relation!=- spelling!=Bare,SelfDot target!=@TypeLevel outer=None +MayRefuse kind:SPY0340 family=Read route=- relation=- target=ModuleLet outer=None order=-,Earlier,Later +MayRefuse kind:SPY0340 family=Read route=- target=ModuleLet outer=@PositionLocal position!=@ConstantOnly order=Earlier +MustRefuse kind:enum-member-constant family=Read route=- relation=- spelling=Bare target!=ModuleLet,ModuleLiteralConst,ModuleEnum outer=None position=EnumMemberValue nesting=- +MustRefuse kind:instance-at-initializer family=Read route=- relation!=- spelling=Bare target!=@TypeLevel outer=None position=@Initializer nesting=-,ComprehensionIterable +MustRefuse kind:instance-at-initializer family=Read route=- relation!=- spelling=Bare target=@Instance outer!=None position=@Initializer nesting=- +MustRefuse kind:instance-at-initializer family=Read route=- spelling=Bare target=@Instance outer!=None position=@Initializer nesting=ComprehensionIterable +MustRefuse kind:result-wrap family=Read route=result-form relation=- resultForm!=-,Err spelling!=Bare target=@NonWritableByMeaning,ModuleVar,ModuleLiteralConst,ModuleComputedConst,ModuleProperty outer=None position!=@Initializer,ComprehensionElement,ModuleInitializer + +# --- Store: 37 rows, 716 cells --- +MustRun #1974 family=Store route=- form=LetOrVar +MustRefuse N5 family=Store route=- form=Augmented target!=@TypeLevelMember,@NonWritableByMeaning outer=None +MustRefuse N5 family=Store route=builtin form!=LetOrVar target!=@TypeLevelMember,@NonWritableByMeaning outer=@Named mark=walrus/call mark!=assign/no-binding,no-decl +MustRefuse N5 family=Store route=builtin form=LetOrVar +MustRefuse N5 family=Store route=walrus-in-comprehension form=-,Assign,Augmented,Walrus target!=@TypeLevelMember,@NonWritableByMeaning outer=None +MustRun N5 family=Store route=- form=-,Assign,Walrus target!=@TypeLevelMember,@NonWritableByMeaning outer=None +MustRun N5 family=Store route=builtin form!=LetOrVar target!=@TypeLevelMember,@NonWritableByMeaning outer=@Named mark=assign/no-binding mark!=no-decl +MustRefuse N6 family=Store route=- form=-,Assign,Augmented,Walrus target=@PositionLocal,ModuleVar,ModuleProperty,NestedType,ImportedName,None outer!=None mark=no-decl +MustRefuse N6 family=Store route=-,builtin form=-,Assign,Augmented,Walrus target!=@TypeLevelMember,@NonWritableByMeaning outer=@Named mark!=Assign/global,Augmented/global,Walrus/global,assign/no-binding,no-decl,walrus/call +MustRefuse N6 family=Store route=lambda-walrus form!=LetOrVar target!=@TypeLevelMember,@NonWritableByMeaning outer!=@Named,None mark!=no-decl +MustRun N6 family=Store route=- form!=LetOrVar target!=@TypeLevelMember,@NonWritableByMeaning,ModuleLiteralConst,ModuleComputedConst,LocalVar outer!=@Named,None mark!=no-decl +MustRun N6 family=Store route=builtin form=-,Assign,Augmented,Walrus target!=@TypeLevelMember,@NonWritableByMeaning outer=@Named mark=Assign/global mark!=assign/no-binding,no-decl,walrus/call +MustRun N6 family=Store route=builtin form=-,Assign,Augmented,Walrus target!=@TypeLevelMember,@NonWritableByMeaning outer=@Named mark=Augmented/global mark!=Assign/global,assign/no-binding,no-decl,walrus/call +MustRun N6 family=Store route=builtin form=-,Assign,Augmented,Walrus target!=@TypeLevelMember,@NonWritableByMeaning outer=@Named mark=Walrus/global mark!=Assign/global,Augmented/global,assign/no-binding,no-decl,walrus/call +MustRefuse N6-declaration family=Store route=declaration form!=LetOrVar declaration!=GlobalCreatesBinding target!=@TypeLevelMember,@NonWritableByMeaning outer=None +MustRefuse N6-declaration family=Store route=declaration form!=LetOrVar target!=@TypeLevelMember,@NonWritableByMeaning outer!=@Named,None mark!=no-decl +MustRefuse N6-declaration family=Store route=declaration form=LetOrVar +MustRun N6-same-function family=Store route=- form!=LetOrVar target=LocalVar outer!=@Named,None mark!=no-decl +MustRefuse N6-type-kind family=Store route=- form=-,Assign,Augmented,Walrus target=@NonWritableByMeaning +MustRun N7 family=Store route=attribute form!=LetOrVar receiver=-,SelfDot,InstanceLocal target=InstanceField,InstanceProperty shape!=MemberAccess,TupleLiteral +MustRun N7 family=Store route=attribute form!=LetOrVar receiver=TypeName,Alias target=StaticField,StaticProperty shape!=MemberAccess +MustRun N7 family=Store route=attribute form!=LetOrVar target=StaticField,StaticProperty,ClassLiteralConst,ClassComputedConst,InstanceField,InstanceProperty shape=MemberAccess +MustRun R-BM family=Store route=- form=OutLet target!=@TypeLevelMember,@NonWritableByMeaning outer!=None mark=no-decl +MustRun R-BM family=Store route=- form=OutLet target!=@TypeLevelMember,@NonWritableByMeaning outer=@Named mark!=assign/no-binding,no-decl,walrus/call +MustRun R-BM family=Store route=- form=OutLet target!=@TypeLevelMember,@NonWritableByMeaning outer=None +MustRun R-BM family=Store route=- form=OutLet target=@NonWritableByMeaning +MustRun R-BM family=Store route=- form=OutLet target=@TypeLevelMember +MustRefuse R-KU family=Store route=attribute form!=LetOrVar receiver!=TypeName,Alias target=StaticField,StaticProperty shape!=MemberAccess +MustRefuse S2-walrus family=Store route=walrus-in-comprehension form!=LetOrVar target!=@TypeLevelMember,@NonWritableByMeaning outer!=None mark!=no-decl +MustRefuse SPY0606 family=Store route=- form=-,Assign,Augmented,Walrus target=@TypeLevelMember +MustRefuse kind:SPY0225 family=Store route=- form!=LetOrVar target=ModuleLiteralConst,ModuleComputedConst outer!=@Named,None mark!=no-decl +MustRefuse kind:SPY0225 family=Store route=- form=-,Assign,Augmented,Walrus target=ModuleLet,ModuleLiteralConst,ModuleComputedConst outer!=None mark=no-decl +MustRefuse kind:SPY0225 family=Store route=attribute form!=LetOrVar target=ClassLiteralConst,ClassComputedConst shape!=MemberAccess +MustRefuse kind:SPY0225 family=Store route=attribute form!=LetOrVar target=InstanceField,InstanceProperty shape=TupleLiteral +MustRefuse kind:SPY0290 family=Store route=attribute form!=LetOrVar receiver=TypeName,Alias,DerivedType target=InstanceField,InstanceProperty shape!=MemberAccess,TupleLiteral +MustRefuse kind:SPY0606 family=Store route=attribute form!=LetOrVar target=StaticMethod,InstanceMethod +Unruled unruled:global-creates-binding family=Store route=declaration form!=LetOrVar declaration=GlobalCreatesBinding target!=@TypeLevelMember,@NonWritableByMeaning outer=None + +# --- Local: 21 rows, 1346 cells --- +MustRun #1974 family=Local route=let-in construct=- outer=LocalVar deviation!=- +MustRun N1 family=Local route=-,comprehension-target,lambda-comprehension,timing construct=Comprehension outer!=None +MustRun N1 family=Local route=lambda-comprehension construct=Comprehension outer=None +MustRun N1-innermost family=Local route=- construct=- deviation=- mark!=above,self +MustRefuse N5 family=Local route=- construct=- target!=@CallForm outer=@TypeLevel,None deviation=- mark=above +MustRefuse N5 family=Local route=-,comprehension-target,timing construct=Comprehension outer=None +MustRefuse N5 family=Local route=-,timing construct!=-,Comprehension,OutLet outer=None mark!=inside +MustRefuse N5 family=Local route=let-in construct=- outer=None deviation!=- +MustRefuse N5 family=Local route=timing construct=OutLet outer=None mark!=inside +MustRun N5 family=Local route=- construct!=-,Comprehension mark=inside +MustRun N5 family=Local route=- construct=- target!=LambdaTypedLocal deviation=- mark=self mark!=above +MustRun N5 family=Local route=closure-in-comprehension,closure-in-loop,closure-in-loop-body construct=- outer=None deviation!=- +MustRun N5-block-scope family=Local route=let-in construct=- outer!=LocalVar,None deviation!=- +MustRefuse N5-declared-later family=Local route=- construct=- target!=LocalDef outer!=@TypeLevel,None deviation=- mark=above +MustRefuse N5-declared-later family=Local route=- construct=- target=ModuleDef,StaticMethod,InstanceMethod,LambdaTypedLocal outer=@TypeLevel,None deviation=- mark=above +MustRefuse N5-declared-later family=Local route=L28,timing construct=- deviation=- mark!=above +MustRefuse N5-self family=Local route=- construct=- target=LambdaTypedLocal deviation=- mark=self mark!=above +MustRun R-BM family=Local route=- construct=OutLet mark!=inside +MustRefuse S2 family=Local route=-,timing construct!=-,Comprehension,OutLet outer!=None mark!=inside +MustRefuse S2 family=Local route=timing construct=OutLet outer!=None mark!=inside +MustRefuse S3 family=Local route=- construct=- target=LocalDef deviation=- mark=above + +# --- TypeMember: 1 rows, 450 cells --- +MustRun P52 family=TypeMember route=class,dataclass,enum,interface,struct,union + +# --- Seed: 1 rows, 168 cells --- +* seed family=Seed route=- From 8bd4b49fcec8cdf8b4d935e7840a6cd63a9b51f9 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 05:18:44 +0000 Subject: [PATCH 06/22] test(conformance): P78 stage 0: ScopeMeaningDifferentialTests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stage 0 of plan-777361 (P78; contract §11), third commit: the cells of N1, N2, N4 and N7 that the P77a pool has no program for, as a generated test type of their own with its own allowlist. Test code and the scorecard baseline only: no product path. The owner's word (2026-11-20, #2423 comment 7030074628, item 1), on where stage 0's new cells live: "New test type (Recommended)". It decides: "a new generated test type with its own allowlist; `allowlist_rows_outside_seed` rises by the measured red count. Not approved: a `CellBudget` raise, an `allowlist_rows_seed` raise, a seed registration." So `scorecard_metrics.py --set-baseline allowlist_rows_outside_seed` moves it 572 -> 605 (+33 rows); allowlist_rows_seed stays 2368 and CellBudget 8951. Conformance.ScopeMeaningDifferentialTests: 86 cells (40 must-run, 46 must-refuse), 33 known-red rows in scope-meaning-differential- allowlist.txt (23 cite #2423, 10 cite #2432). A cell is a NameCell and carries NO verdict: its tag and rule are read from its one row of name-resolution-rules.txt (#2487), which gains 10 rows and 4 rules (R-QI, N1-typed-read, N4, N1-alias-target; 196 rows, 48 rules). The generator writes the program, what it prints if it runs and the codes a refusal of it may carry. Six cell sets, each over an enumeration or a set named closed, every value generated or excluded with its reason (Axes_EveryValueIsGenerated OrExcluded): - no-initializer (R-QI): BindingKind x {Present, Absent, AccessorBodies}, 17 cells, 4 red: a module variable, a module property, a @static field and a @static property with no initializer print 0; - typed-read: `b: bool = `, BindingKind x {Annotated, Inferred} x {Earlier, Later}, 30 cells, 13 red: SPY0908 CS0029 where the declaration is checked after its reader (11), SPY0200 for a module variable declared below (2, listed as wrong-code); - callee: a binder's name called under a module def of the name, LocalTarget and the parameter, 8 cells, 4 red: the module def is called (12, python 1); - constant-kind (#2432): the four constant positions x {CLR literal field, Stdlib module variable, comparison chain, chain with a non-constant link}, 17 cells, 10 red: math.pi / socket.AF_INET are CS1736 or CS0133 behind SPY0908 (7; must-refuse SPY0401, item 4 of the same comment), `1 < 2 < 3` is SPY0401 (3); - init-overload: caller x order, 8 cells, 1 red: `self.__init__(7)` above the overload it names is SPY0224; - alias-target: {Declared, Missing} x {Used, Unused} x order, 6 cells, 1 red: `type K0 = nosuch`, unused, runs (must-refuse SPY0202, item 3 of the same comment). Python agrees on the 18 cells it runs with the same meaning; the rest have no twin (a property, an overload, a type alias, a refusal). A must-refuse cell refused under a code its cell does not admit is red as FalseRefusal with the lane wrong-code, so "refused for another rule's reason" is a row and never a pass. Excluded on what the compiler does today (measured @ e5991c887): a @static property typed read is CS0029 at either order (#2417's class); `match one:` / `case x:` over a function value is CS8119 with no module def of the name. Mutations (contract §2), at this tree: - totality: the table's `N1-typed-read` row deleted -> RuleTable_Every CaseHasOneRow_AndTakesItsVerdictFromIt red, 30 cells match no row (1 failed); restored (cmp) -> green; - a passing cell listed as known-red (`local/callee/Parameter/ outer=None SilentWrong # #2423 silent-wrong`) -> ScopeMeaning_Sweep red, "STALE, delete the row" (1 failed, 3 passed); restored (cmp) -> 4 passed. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01LGMKZVcFYGqQRfHgd16DLa --- build_tools/scorecard-baseline.json | 2 +- .../NameResolutionDifferentialTests.Checks.cs | 5 +- ...meResolutionDifferentialTests.RuleTable.cs | 7 + .../ScopeMeaningDifferentialTests.cs | 789 ++++++++++++++++++ .../Conformance/name-resolution-rules.txt | 13 + .../scope-meaning-differential-allowlist.txt | 37 + 6 files changed, 850 insertions(+), 3 deletions(-) create mode 100644 src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs create mode 100644 src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt diff --git a/build_tools/scorecard-baseline.json b/build_tools/scorecard-baseline.json index 811cbb06d..4481c14bc 100644 --- a/build_tools/scorecard-baseline.json +++ b/build_tools/scorecard-baseline.json @@ -1,6 +1,6 @@ { "procedure_bytes": 145560, "claude_md_bytes": 9304, - "allowlist_rows_outside_seed": 572, + "allowlist_rows_outside_seed": 605, "allowlist_rows_seed": 2368 } diff --git a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Checks.cs b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Checks.cs index 4a49fe68d..b55718ffd 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Checks.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Checks.cs @@ -809,8 +809,9 @@ public void RuleTable_EveryCellHasOneRow_AndEveryRowACell() AssertNoProblems(RuleTableFailures(pool).Concat(AdmittedRuleFailures(pool)), "a cell's tag and rule are its one row's, a row no cell matches rules nothing, and a refusal under a rule says which codes it admits"); - // Measured literals: a table or a generator that stopped citing a rule would otherwise pass an emptier check. - RuleTable().Select(r => r.Rule).Distinct(StringComparer.Ordinal).Should().HaveCount(44); + // Measured literals: a table or a generator that stopped citing a rule would otherwise pass an emptier check. 44 rules of this + // pool, and the four only ScopeMeaningDifferentialTests has cells for (R-QI, N1-typed-read, N4, N1-alias-target). + RuleTable().Select(r => r.Rule).Distinct(StringComparer.Ordinal).Should().HaveCount(48); // 29 rules with an entry, and the seeds', which carry their own codes. pool.Where(RefusalIsAnOutcome).Select(c => c.Rule).Distinct(StringComparer.Ordinal).Should().HaveCount(30); } diff --git a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.RuleTable.cs b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.RuleTable.cs index 3bfc45fba..6ba3506ac 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.RuleTable.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.RuleTable.cs @@ -150,6 +150,12 @@ private static RuleAxis KeyAxis(string name) where T : struct, Enum KeyAxis("receiver"), KeyAxis("resultForm"), KeyAxis("storeSpelling"), + KeyAxis("initializer"), + KeyAxis("annotation"), + KeyAxis("constantKind"), + KeyAxis("aliasTarget"), + KeyAxis("aliasUse"), + KeyAxis("overloadCaller"), new RuleAxis("route", c => One(c.Family == Family.Seed ? null : c.Key?.Route), null, new Dictionary>()), new RuleAxis("mark", c => c.Family == Family.Seed ? Array.Empty() : c.Key?.Marks ?? Array.Empty(), null, new Dictionary>(), SetValued: true), new RuleAxis("shape", c => One(c.Shape), null, new Dictionary>()), @@ -240,6 +246,7 @@ internal static List ParseRuleTable(IEnumerable lines, List> Cells)> RuleTablePools = new (string, Func>)[] { (nameof(NameResolutionDifferentialTests), GeneratedCells), + (nameof(ScopeMeaningDifferentialTests), ScopeMeaningDifferentialTests.DraftCells), }; /// The rows that claim a cell. One is the verdict; none or several is a totality failure. diff --git a/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs new file mode 100644 index 000000000..5f9af85fe --- /dev/null +++ b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs @@ -0,0 +1,789 @@ +using System.Diagnostics; +using System.Text.Json; +using System.Text.RegularExpressions; +using Sharpy.Compiler.Diagnostics; +using Sharpy.Compiler.Tests.Properties.Differential; +using Sharpy.TestInfrastructure.Integration; +using Sharpy.TestInfrastructure.Oracles; +using Xunit; +using Xunit.Abstractions; +using Harness = Sharpy.Compiler.Tests.Conformance.NameResolutionDifferentialTests; + +namespace Sharpy.Compiler.Tests.Conformance; + +/// Whether a declaration says its first value: R-QI's axis. Closed: a declaration has an initializer, has +/// none, or (a property) computes its value in accessor bodies. +internal enum ScopeInitializer +{ + Present, + Absent, + AccessorBodies, +} + +/// Where a declaration's type comes from. Closed: written, or inferred from the initializer. +internal enum ScopeAnnotation +{ + Annotated, + Inferred, +} + +/// What a constant position is handed (#2432's expression-kind axis, the kinds the P77a pool has no cell +/// for; charter §3.20l calls 43 and 45). Closed by those two calls. +internal enum ScopeConstantKind +{ + /// A constant of a referenced assembly: a CLR literal field read through a Stdlib module. + ClrLiteralField, + + /// A module variable of the .spy stdlib: no constant. + StdlibModuleVariable, + + /// A comparison chain whose every link is a constant. + ComparisonChain, + + /// A comparison chain with a link that is no constant. + ChainWithNonConstantLink, +} + +/// Whether a type alias's target exists. Closed. +internal enum ScopeAliasTarget +{ + Declared, + Missing, +} + +/// Whether anything names a type alias. Closed. +internal enum ScopeAliasUse +{ + Used, + Unused, +} + +/// Who calls a constructor overload. Closed: another constructor of the type, a method of it, an initializer +/// of it, a function outside it. +internal enum ScopeOverloadCaller +{ + InitDelegation, + MethodBody, + StaticInitializer, + ModuleFunction, +} + +/// +/// Stage 0 of plan-777361 (P78; verification contract §11), the owner's ruling of 2026-11-20 (#2423 comment +/// 7030074628, item 1): the cells of rules N1, N2, N4 and N7 that the P77a pool +/// () has no program for, as a generated test type of their own. A cell is +/// a , and its tag and rule are READ from the rule table (name-resolution-rules.txt, #2487): +/// the generator writes the program, what it prints when it runs and the codes a refusal may carry, and never a verdict. +/// +/// Six cell sets, each over an enumeration or a set named closed, with every value generated or excluded with its reason +/// (): +/// +/// no-initializer (R-QI): × ; +/// typed-read: b: bool = <read>, × × order; +/// callee: a binder's name called under a module def of the name, and the parameter; +/// constant-kind (#2432): the constant positions of × ; +/// init-overload: × order; +/// alias-target: × × order. +/// +/// Known-red cells are rows of scope-meaning-differential-allowlist.txt (a missing file reads as empty), each citing +/// the issue whose fix turns it green. A must-refuse cell refused under a code its cell does not admit is listed as +/// with the lane wrong-code: the refusal is another rule's. +/// +[Trait("Category", "GapDiscovery")] +public sealed class ScopeMeaningDifferentialTests : IntegrationTestBase +{ + private const string AllowlistFileName = "scope-meaning-differential-allowlist.txt"; + private const int SharpyExecTimeoutMs = 12_000; + private const int PythonBatchTimeoutMs = 600_000; + + public ScopeMeaningDifferentialTests(ITestOutputHelper output) : base(output) => MuteCompilePath = true; + + /// A generated case: the cell, and whether python runs the same program with the same meaning (no twin, no vote). + internal sealed record Case(NameCell Cell, bool Twin); + + private const string Main = "def main() -> None:\n"; + + private static CellKey Key(params object?[] parts) + { + var kept = parts.Where(p => p != null).Select(p => p!).ToArray(); + return new CellKey(string.Join("/", kept.Select(p => Convert.ToString(p, System.Globalization.CultureInfo.InvariantCulture))), kept); + } + + /// A cell before the table has said what it must do. is what it prints if it runs; + /// the codes a refusal of it may carry. + private static Case Draft(CellKey key, Family family, string source, string? model, string[] refusal, bool twin, + BindingKind target = BindingKind.None, BindingKind outer = BindingKind.None, ReadPosition? position = null, + LocalTarget? construct = null, bool stdlib = false) + => new( + new NameCell + { + Key = key, + Family = family, + Source = source, + Tag = SharpyTag.Unruled, + Model = model, + Python = model == null ? new PyOutcome(PyKind.OtherError, "no twin") : PyOutcome.Ran(model), + Rule = "", + Target = target, + Outer = outer, + Position = position, + Construct = construct, + SeedRefusalCodes = new HashSet(refusal, StringComparer.Ordinal), + NeedsStdlib = stdlib, + }, + twin); + + // ------------------------------------------------------------------------------------------- // + // no-initializer (R-QI) + // ------------------------------------------------------------------------------------------- // + + /// How a kind declares x with a type and no value, where the declaration sits and how main reads it. + /// : the statements that give it a value before the read, for the kinds R-QI leaves alone. + internal sealed record Declared(string Text, bool InType, string Read, string? Accessor = null, string[]? Stored = null, bool Twin = false); + + internal static readonly IReadOnlyDictionary Declarations = new Dictionary + { + [BindingKind.ModuleVar] = new("x: int", false, "x", Twin: true), + [BindingKind.ModuleProperty] = new("property x: int", false, "x", Accessor: "property get x() -> int:\n return 5"), + [BindingKind.StaticField] = new("@static\nx: int", true, "H.x", Twin: true), + [BindingKind.StaticProperty] = new("@static\nproperty x: int", true, "H.x", Accessor: "@static\nproperty get x() -> int:\n return 5"), + [BindingKind.InstanceField] = new("x: int", true, "H().x", Stored: new[] { "def __init__(self):", " self.x = 5" }, Twin: true), + [BindingKind.InstanceProperty] = new("property x: int", true, "H().x", Accessor: "property get x(self) -> int:\n return 5", Stored: new[] { "def __init__(self):", " self.x = 5" }), + [BindingKind.LocalVar] = new("x: int", false, "x", Stored: new[] { "x = 5" }, Twin: true), + }; + + private const string NeedsItsValue = "the declaration's grammar takes a value: there is no spelling without one"; + private const string NoValueSlot = "declares no storage with a type annotation, so it has no initializer to leave out"; + + internal static readonly IReadOnlyDictionary ExcludedDeclarations = new Dictionary + { + [BindingKind.ModuleLet] = "a module `let` is refused at every order (SPY0340, P21b)", + [BindingKind.ModuleLiteralConst] = NeedsItsValue, + [BindingKind.ModuleComputedConst] = NeedsItsValue, + [BindingKind.ClassLiteralConst] = NeedsItsValue, + [BindingKind.ClassComputedConst] = NeedsItsValue, + [BindingKind.LocalLet] = NeedsItsValue, + [BindingKind.LocalLiteralConst] = NeedsItsValue, + [BindingKind.LocalComputedConst] = NeedsItsValue, + [BindingKind.LambdaTypedLocal] = "a local `x: T` with another type: the LocalVar cell is its shape", + [BindingKind.ModuleDef] = NoValueSlot, + [BindingKind.ModuleClass] = NoValueSlot, + [BindingKind.ModuleStruct] = NoValueSlot, + [BindingKind.ModuleEnum] = NoValueSlot, + [BindingKind.ModuleUnion] = NoValueSlot, + [BindingKind.ModuleInterface] = NoValueSlot, + [BindingKind.ModuleTypeAlias] = NoValueSlot, + [BindingKind.StaticMethod] = NoValueSlot, + [BindingKind.NestedType] = NoValueSlot, + [BindingKind.InstanceMethod] = NoValueSlot, + [BindingKind.Constructor] = NoValueSlot, + [BindingKind.LocalDef] = NoValueSlot, + [BindingKind.EnclosingLocal] = "a local read from a nested function: the LocalVar cell's declaration", + [BindingKind.Parameter] = "a parameter's value is its argument", + [BindingKind.Inner] = "bound by its comprehension or lambda", + [BindingKind.Builtin] = "not declared by the program", + [BindingKind.ImportedName] = "not declared by the program", + [BindingKind.None] = "no binding", + }; + + private static string Indent(string text) => string.Join("\n", text.Split('\n').Select(l => " " + l)); + + private static IEnumerable NoInitializerCases() + { + foreach (var (kind, d) in Declarations.OrderBy(e => e.Key)) + { + foreach (var initializer in Enum.GetValues()) + { + if (initializer == ScopeInitializer.AccessorBodies && d.Accessor == null) + continue; + string decl = initializer switch + { + ScopeInitializer.Present => d.Text + " = 5", + ScopeInitializer.Absent => d.Text, + _ => d.Accessor!, + }; + var lines = new List(); + if (kind == BindingKind.LocalVar) + { + lines.Add(Main.TrimEnd()); + lines.Add(Indent(decl)); + if (initializer == ScopeInitializer.Absent) + lines.AddRange(d.Stored!.Select(Indent)); + lines.Add($" print({d.Read})"); + } + else + { + if (d.InType) + { + lines.Add("class H:"); + lines.Add(Indent(decl)); + if (initializer == ScopeInitializer.Absent && d.Stored != null) + lines.AddRange(d.Stored.Select(Indent)); + } + else + lines.Add(decl); + lines.Add(Main.TrimEnd()); + lines.Add($" print({d.Read})"); + } + // Read where R-QI refuses; the kinds it leaves alone store first, so every cell that runs prints 5. + yield return Draft(Key("read", "no-initializer", kind, initializer), Family.Read, string.Join("\n", lines) + "\n", "5", + Array.Empty(), d.Twin && (initializer == ScopeInitializer.Present || (initializer == ScopeInitializer.Absent && d.Stored != null)), target: kind); + } + } + } + + // ------------------------------------------------------------------------------------------- // + // typed-read: `b: bool = ` is the type mismatch at either order + // ------------------------------------------------------------------------------------------- // + + /// An int-valued declaration of x per kind, with its inferred spelling where the kind has one, and the read of it. + internal sealed record Typed(string Annotated, string? Inferred, bool InType, string Read, bool NeedsFive = false); + + internal static readonly IReadOnlyDictionary TypedReads = new Dictionary + { + [BindingKind.ModuleVar] = new("x: int = 5", "x: auto = 5", false, "x"), + [BindingKind.ModuleLiteralConst] = new("const x: int = 5", "const x = 5", false, "x"), + [BindingKind.ModuleComputedConst] = new("const x: int = five()", "const x = five()", false, "x", NeedsFive: true), + [BindingKind.ModuleProperty] = new("property x: int = 5", null, false, "x"), + [BindingKind.ModuleDef] = new("def x() -> int:\n return 5", null, false, "x()"), + [BindingKind.StaticField] = new("@static\nx: int = 5", "@static\nx: auto = 5", true, "H.x"), + [BindingKind.StaticMethod] = new("@static\ndef x() -> int:\n return 5", null, true, "H.x()"), + [BindingKind.ClassLiteralConst] = new("const x: int = 5", "const x = 5", true, "H.x"), + [BindingKind.ClassComputedConst] = new("const x: int = five()", "const x = five()", true, "H.x", NeedsFive: true), + }; + + private const string NotAnIntValue = "its read is no int value at a module or type level: the mismatch against bool is not a question of order"; + + internal static readonly IReadOnlyDictionary ExcludedTypedReads = new Dictionary + { + [BindingKind.ModuleLet] = "a module `let` is refused at every order (SPY0340, P21b)", + [BindingKind.ModuleClass] = NotAnIntValue, + [BindingKind.ModuleStruct] = NotAnIntValue, + [BindingKind.ModuleEnum] = NotAnIntValue, + [BindingKind.ModuleUnion] = NotAnIntValue, + [BindingKind.ModuleInterface] = NotAnIntValue, + [BindingKind.ModuleTypeAlias] = NotAnIntValue, + [BindingKind.NestedType] = NotAnIntValue, + [BindingKind.StaticProperty] = "read through its type's name it is untyped at either order: #2417's class, not a question of order (CS0029 at both, measured @ e5991c887)", + [BindingKind.InstanceField] = "an instance member has no read from another declaration's initializer (kind:SPY0290)", + [BindingKind.InstanceProperty] = "an instance member has no read from another declaration's initializer (kind:SPY0290)", + [BindingKind.InstanceMethod] = "an instance member has no read from another declaration's initializer (kind:SPY0290)", + [BindingKind.Constructor] = NotAnIntValue, + [BindingKind.EnclosingLocal] = "a local: a read above it is R-KX's (P80)", + [BindingKind.Parameter] = "a local: a read above it is R-KX's (P80)", + [BindingKind.Inner] = "a local: a read above it is R-KX's (P80)", + [BindingKind.LocalVar] = "a local: a read above it is R-KX's (P80)", + [BindingKind.LocalLet] = "a local: a read above it is R-KX's (P80)", + [BindingKind.LocalLiteralConst] = "a local: a read above it is R-KX's (P80)", + [BindingKind.LocalComputedConst] = "a local: a read above it is R-KX's (P80)", + [BindingKind.LocalDef] = "a local: a read above it is R-KX's (P80)", + [BindingKind.LambdaTypedLocal] = "a local: a read above it is R-KX's (P80)", + [BindingKind.Builtin] = "not declared by the program", + [BindingKind.ImportedName] = "not declared by the program", + [BindingKind.None] = "no binding", + }; + + private static IEnumerable TypedReadCases() + { + foreach (var (kind, t) in TypedReads.OrderBy(e => e.Key)) + { + foreach (var annotation in Enum.GetValues()) + { + var text = annotation == ScopeAnnotation.Annotated ? t.Annotated : t.Inferred; + if (text == null) + continue; + foreach (var order in new[] { Harness.Order.Earlier, Harness.Order.Later }) + { + var target = t.InType ? "class H:\n" + Indent(text) : text; + // The reader is a function's local: a body resolves every module-level and type-level name, whatever the order. + var reader = "def r() -> int:\n b: bool = " + t.Read + "\n return 1"; + var lines = new List(); + if (t.NeedsFive) + lines.Add("def five() -> int:\n return 5"); + lines.AddRange(order == Harness.Order.Earlier ? new[] { target, reader } : new[] { reader, target }); + lines.Add(Main + " print(r())"); + yield return Draft(Key("read", "typed-read", kind, annotation, order), Family.Read, string.Join("\n", lines) + "\n", null, + new[] { "SPY0220" }, twin: false, target: kind, position: ReadPosition.FunctionBody); + } + } + } + } + + // ------------------------------------------------------------------------------------------- // + // callee: the innermost binding of a name is what a call of it calls + // ------------------------------------------------------------------------------------------- // + + /// The statements of main that bind x to a function returning 1 and print its call, per binder. + internal static readonly IReadOnlyDictionary CalleeBinders = new Dictionary + { + [LocalTarget.For] = new[] { "for x in [one]:", " print(x())" }, + [LocalTarget.Comprehension] = new[] { "print([x() for x in [one]][0])" }, + [LocalTarget.WithAs] = new[] { "with CM() as x:", " print(x())" }, + }; + + internal static readonly IReadOnlyDictionary ExcludedCalleeBinders = new Dictionary + { + [LocalTarget.ExceptAs] = "binds an exception, which no call calls", + [LocalTarget.MatchCapture] = "`match one:` / `case x:` over a function value is SPY0908 CS8119 with no module def of the name (measured @ e5991c887): no callee verdict", + [LocalTarget.AsPatternCapture] = "a capture of the same subject: the MatchCapture exclusion's shape", + [LocalTarget.OutLet] = "binds an out argument: a function-typed out parameter is #2154's class", + }; + + private const string One = "def one() -> int:\n return 1"; + private const string CalleeCm = "class CM:\n def __enter__(self) -> () -> int:\n return one\n def __exit__(self) -> None:\n pass"; + + private static IEnumerable CalleeCases() + { + foreach (var outer in new[] { BindingKind.ModuleDef, BindingKind.None }) + { + var module = outer == BindingKind.ModuleDef ? new[] { "def x() -> int:\n return 12", One } : new[] { One }; + yield return Draft(Key("local", "callee", BindingKind.Parameter, $"outer={outer}"), Family.Local, + string.Join("\n", module.Append("def f(x: () -> int) -> int:\n return x()").Append(Main + " print(f(one))")) + "\n", + "1", Array.Empty(), twin: true, target: BindingKind.Parameter, outer: outer, position: ReadPosition.FunctionBody); + foreach (var (binder, stmts) in CalleeBinders.OrderBy(e => e.Key)) + { + var lines = module.ToList(); + if (binder == LocalTarget.WithAs) + lines.Add(CalleeCm); + lines.Add(Main + string.Join("\n", stmts.Select(s => " " + s))); + yield return Draft(Key("local", "callee", binder, $"outer={outer}"), Family.Local, string.Join("\n", lines) + "\n", + "1", Array.Empty(), twin: binder is LocalTarget.For or LocalTarget.Comprehension, + target: binder == LocalTarget.Comprehension ? BindingKind.Inner : BindingKind.LocalVar, outer: outer, + position: ReadPosition.FunctionBody, construct: binder); + } + } + } + + // ------------------------------------------------------------------------------------------- // + // constant-kind (#2432) + // ------------------------------------------------------------------------------------------- // + + /// The positions that take constants only: 's and the enum member's value. + internal static IReadOnlyList ConstantPositions => + Enum.GetValues().Where(p => Harness.IsConstantOnly(p) || p == ReadPosition.EnumMemberValue).ToList(); + + /// The expression, its type, what it prints and what it imports. + internal sealed record ConstantExpression(string Label, string Text, string Type, string Prints, string? Import); + + internal static readonly IReadOnlyDictionary ConstantExpressions = new Dictionary + { + [ScopeConstantKind.ClrLiteralField] = new[] { new ConstantExpression("subprocess.PIPE", "subprocess.PIPE", "int", "-1", "subprocess") }, + [ScopeConstantKind.StdlibModuleVariable] = new[] + { + new ConstantExpression("socket.AF_INET", "socket.AF_INET", "int", "2", "socket"), + new ConstantExpression("math.pi", "math.pi", "float", "3.141592653589793", "math"), + }, + [ScopeConstantKind.ComparisonChain] = new[] { new ConstantExpression("ordered", "1 < 2 < 3", "bool", "True", null) }, + [ScopeConstantKind.ChainWithNonConstantLink] = new[] { new ConstantExpression("membership", "0 < 2 in [1, 2]", "bool", "True", null) }, + }; + + private static IEnumerable ConstantKindCases() + { + foreach (var position in ConstantPositions) + { + foreach (var (kind, expressions) in ConstantExpressions.OrderBy(e => e.Key)) + { + foreach (var e in expressions) + { + // An enum member's value is an int: the other types have no cell there. + if (position == ReadPosition.EnumMemberValue && e.Type != "int") + continue; + string host = position switch + { + ReadPosition.ParameterDefault => $"def f(p: {e.Type} = {e.Text}) -> {e.Type}:\n return p\n{Main} print(f())", + ReadPosition.DataclassFieldInitializer => $"@dataclass\nclass H:\n p: {e.Type} = {e.Text}\n{Main} print(H().p)", + ReadPosition.StructFieldInitializer => $"struct H:\n p: {e.Type} = {e.Text}\n{Main} print(H().p)", + ReadPosition.EnumMemberValue => $"enum H:\n RED = {e.Text}\n{Main} print(H.RED.value)", + _ => throw new ArgumentOutOfRangeException(nameof(position), position, "not a constant position"), + }; + var source = (e.Import == null ? "" : $"import {e.Import}\n") + host + "\n"; + yield return Draft(Key("read", "constant-kind", position, kind, e.Label), Family.Read, source, e.Prints, + new[] { "SPY0401" }, twin: kind is ScopeConstantKind.ClrLiteralField or ScopeConstantKind.ComparisonChain && position != ReadPosition.EnumMemberValue, + position: position, stdlib: e.Import != null); + } + } + } + } + + // ------------------------------------------------------------------------------------------- // + // init-overload: a constructor's overload set is the whole body's + // ------------------------------------------------------------------------------------------- // + + private static IEnumerable InitOverloadCases() + { + const string Target = "def __init__(self, x: int):\n self.x = x"; + foreach (var caller in Enum.GetValues()) + { + foreach (var order in new[] { Harness.Order.Earlier, Harness.Order.Later }) + { + (string? member, string? function, string read) = caller switch + { + ScopeOverloadCaller.InitDelegation => ("def __init__(self):\n self.__init__(7)", null, "P().x"), + ScopeOverloadCaller.MethodBody => ("def mk(self) -> int:\n return P(7).x", null, "P(1).mk()"), + ScopeOverloadCaller.StaticInitializer => ("@static\nd: int = P(7).x", null, "P.d"), + _ => ((string?)null, "def mk() -> int:\n return P(7).x", "mk()"), + }; + var members = new List { "x: int = 0" }; + if (member == null) + members.Add(Target); + else + members.AddRange(order == Harness.Order.Earlier ? new[] { Target, member } : new[] { member, Target }); + var type = "class P:\n" + string.Join("\n", members.Select(Indent)); + var lines = function == null ? new[] { type } : order == Harness.Order.Earlier ? new[] { type, function } : new[] { function, type }; + yield return Draft(Key("read", "init-overload", caller, order), Family.Read, string.Join("\n", lines) + $"\n{Main} print({read})\n", "7", + Array.Empty(), twin: false, target: BindingKind.Constructor); + } + } + } + + // ------------------------------------------------------------------------------------------- // + // alias-target: an alias names a type that exists, used or not + // ------------------------------------------------------------------------------------------- // + + private static IEnumerable AliasTargetCases() + { + foreach (var target in Enum.GetValues()) + { + foreach (var use in Enum.GetValues()) + { + foreach (var order in new[] { Harness.Order.Earlier, Harness.Order.Later }) + { + // The order is the alias against its target's declaration: a missing target has none. + if (target == ScopeAliasTarget.Missing && order == Harness.Order.Later) + continue; + var alias = target == ScopeAliasTarget.Declared ? "type K0 = C0" : "type K0 = nosuch"; + var lines = new List(); + if (target == ScopeAliasTarget.Declared && order == Harness.Order.Earlier) + lines.Add("class C0:\n v: int = 1"); + lines.Add(alias); + if (target == ScopeAliasTarget.Declared && order == Harness.Order.Later) + lines.Add("class C0:\n v: int = 1"); + if (use == ScopeAliasUse.Used) + lines.Add("def f(k: K0) -> int:\n return 1"); + lines.Add(Main + " print(1)"); + yield return Draft(Key("read", "alias-target", target, use, order), Family.Read, string.Join("\n", lines) + "\n", "1", + new[] { "SPY0202" }, twin: false, target: BindingKind.ModuleTypeAlias, position: ReadPosition.TypeAliasTarget); + } + } + } + } + + // ------------------------------------------------------------------------------------------- // + // The pool: every case, with the tag and rule its one row of the table gives it + // ------------------------------------------------------------------------------------------- // + + private static readonly Lazy> Drafts = new(() => + NoInitializerCases().Concat(TypedReadCases()).Concat(CalleeCases()).Concat(ConstantKindCases()).Concat(InitOverloadCases()).Concat(AliasTargetCases()).ToList()); + + /// The cells as generated, before the table is read: what counts a row's cells over. + internal static IReadOnlyList DraftCells() => Drafts.Value.Select(c => c.Cell).ToList(); + + private static readonly Lazy> Pool = new(() => Drafts.Value.Select(c => + { + var rows = Harness.RowsOf(Harness.RuleTable(), c.Cell); + return rows.Count == 1 && rows[0].Tag is { } tag ? c with { Cell = c.Cell with { Tag = tag, Rule = rows[0].Rule } } : c; + }).ToList()); + + internal static IReadOnlyList GeneratedCases() => Pool.Value; + + /// The pool's totality: ids are unique, every cell has its one row and took its verdict from it, a cell that + /// must run says what it prints, and a twin is a program that runs. + internal static List TotalityFailures(IReadOnlyList pool) + { + var failures = new List(); + foreach (var dup in pool.GroupBy(c => c.Cell.Id, StringComparer.Ordinal).Where(g => g.Count() > 1)) + failures.Add($"duplicate cell id {dup.Key}"); + var rows = Harness.RuleTable(); + foreach (var c in pool) + { + var matched = Harness.RowsOf(rows, c.Cell); + if (matched.Count != 1) + failures.Add($"RuleTable: {c.Cell.Id} matches {(matched.Count == 0 ? "no row" : "rows L" + string.Join(", L", matched.Select(r => r.Line)))}"); + else if (matched[0].Tag != c.Cell.Tag || matched[0].Rule != c.Cell.Rule) + failures.Add($"RuleTable: {c.Cell.Id} carries {c.Cell.Tag} under '{c.Cell.Rule}', and its row L{matched[0].Line} says {matched[0].Tag?.ToString() ?? "*"} under {matched[0].Rule}"); + if (c.Cell.Tag is not (SharpyTag.MustRun or SharpyTag.MustRefuse)) + failures.Add($"{c.Cell.Id}: a cell of this pool must run or must be refused, and its row says {c.Cell.Tag}"); + if (c.Cell.Tag == SharpyTag.MustRun && c.Cell.Model == null) + failures.Add($"{c.Cell.Id}: its row says must-run and the generator gives it nothing to print"); + if (c.Twin && c.Cell.Tag != SharpyTag.MustRun) + failures.Add($"{c.Cell.Id}: a twin is python running the same program, and the cell does not run"); + } + failures.AddRange(Harness.RuleTableRowFailures(rows, Harness.RuleTablePools.SelectMany(p => p.Cells()).ToList())); + return failures; + } + + [Fact] + public void RuleTable_EveryCaseHasOneRow_AndTakesItsVerdictFromIt() + { + var failures = TotalityFailures(GeneratedCases()); + Assert.True(failures.Count == 0, string.Join("\n", failures)); + } + + /// Each axis against its enumeration: a value is generated or carries its reason, never both, never neither. + [Fact] + public void Axes_EveryValueIsGeneratedOrExcluded() + { + var pool = GeneratedCases(); + var problems = new List(); + + void Partition(string axis, IEnumerable generated, IEnumerable excluded) where T : struct, Enum + { + var g = generated.ToHashSet(); + var e = excluded.ToHashSet(); + foreach (var value in Enum.GetValues()) + { + if (g.Contains(value) == e.Contains(value)) + problems.Add($"{axis}: {value} is {(g.Contains(value) ? "generated and excluded" : "neither generated nor excluded")}"); + } + } + + Partition("no-initializer", Declarations.Keys, ExcludedDeclarations.Keys); + Partition("typed-read", TypedReads.Keys, ExcludedTypedReads.Keys); + Partition("callee", CalleeBinders.Keys, ExcludedCalleeBinders.Keys); + + void Fed(string route, IEnumerable owed) where T : struct, Enum + { + var carried = pool.Where(c => c.Cell.Key!.Route == route).Select(c => c.Cell.Key!.Part()).ToHashSet(); + foreach (var value in owed.Where(v => !carried.Contains(v))) + problems.Add($"{route}: no cell carries {typeof(T).Name}.{value}"); + } + + Fed("no-initializer", Declarations.Keys); + Fed("no-initializer", Enum.GetValues()); + Fed("typed-read", TypedReads.Keys); + Fed("typed-read", Enum.GetValues()); + Fed("callee", CalleeBinders.Keys); + Fed("constant-kind", ConstantPositions); + Fed("constant-kind", Enum.GetValues()); + Fed("init-overload", Enum.GetValues()); + Fed("alias-target", Enum.GetValues()); + Fed("alias-target", Enum.GetValues()); + foreach (var kind in Enum.GetValues().Where(k => !ConstantExpressions.ContainsKey(k))) + problems.Add($"constant-kind: {kind} has no expression"); + + Assert.True(problems.Count == 0, string.Join("\n", problems)); + Assert.Equal(4, ConstantPositions.Count); + } + + // ------------------------------------------------------------------------------------------- // + // Judge, route, ratchet + // ------------------------------------------------------------------------------------------- // + + /// The issue whose fix turns a red cell of a route green: #2432 for a constant position's verdict, #2423 for the rest + /// (R-QI's cells, the untyped forward read, the callee lookup, the alias refusal: charter §3.20l). + internal static readonly IReadOnlyDictionary RouteIssues = new Dictionary(StringComparer.Ordinal) + { + ["no-initializer"] = "#2423", + ["typed-read"] = "#2423", + ["callee"] = "#2423", + ["constant-kind"] = "#2432", + ["init-overload"] = "#2423", + ["alias-target"] = "#2423", + }; + + internal sealed record Result(Case Case, Harness.SharpyRun Run, SharpyKind Kind, VerdictClass Class, bool WrongCode, string? PythonFailure); + + /// The harness's table, and one more red: a must-refuse cell refused under a code it does not admit. + internal static (VerdictClass Class, bool WrongCode) Judge(NameCell cell, SharpyKind kind, Harness.SharpyRun run) + { + var verdict = Harness.Judge(cell, kind, run.Stdout); + bool wrongCode = verdict == VerdictClass.Match && cell.Tag == SharpyTag.MustRefuse && Harness.RefusalReasonFailure(cell, run) != null; + return (wrongCode ? VerdictClass.FalseRefusal : verdict, wrongCode); + } + + internal static string ProposedCite(Result r) + { + var issue = RouteIssues.GetValueOrDefault(r.Case.Cell.Key!.Route ?? "", "UNROUTED"); + string lane = r.WrongCode ? "wrong-code" : r.Class switch + { + VerdictClass.Ice => "ice", + VerdictClass.FalseRefusal => "false-refusal", + VerdictClass.RuntimeThrow => "runtime-throw", + VerdictClass.SilentWrong when r.Case.Cell.Tag == SharpyTag.MustRefuse => "missing-refusal", + _ => "silent-wrong", + }; + return $"{issue} {lane}"; + } + + private static bool IsRed(VerdictClass c) => c is VerdictClass.Ice or VerdictClass.FalseRefusal or VerdictClass.SilentWrong or VerdictClass.RuntimeThrow; + + /// The ratchet: a red cell has its row, a row has its red cell of that class and cite, and python or the harness + /// failing to judge a cell is never a row's to hold. + internal static List RatchetFailures(IReadOnlyList results, IReadOnlyDictionary rows) + { + var failures = new List(); + foreach (var r in results) + { + rows.TryGetValue(r.Case.Cell.Id, out var row); + if (r.PythonFailure != null) + failures.Add($"GeneratorBug {r.Case.Cell.Id}: {r.PythonFailure}{(row == null ? "" : " (and a row lists it: not allowlistable)")}"); + else if (r.Class == VerdictClass.Harness) + failures.Add($"Harness {r.Case.Cell.Id}: Sharpy {Describe(r)}"); + else if (IsRed(r.Class) && row == null) + failures.Add($"{r.Class} {r.Case.Cell.Id} ({r.Case.Cell.Tag}, {r.Case.Cell.Rule}): Sharpy {Describe(r)}; model '{r.Case.Cell.Model}'"); + else if (IsRed(r.Class) && row!.Class != r.Class) + failures.Add($"{r.Case.Cell.Id}: listed as {row.Class}, now {r.Class}: MOVED, update or delete the row"); + else if (!IsRed(r.Class) && row != null) + failures.Add($"{r.Case.Cell.Id}: listed as {row.Class}, now {r.Class}: STALE, delete the row"); + else if (IsRed(r.Class) && row!.Cite != ProposedCite(r)) + failures.Add($"{r.Case.Cell.Id}: the row cites '{row.Cite}' and the route says '{ProposedCite(r)}'"); + } + return failures; + } + + private static string Describe(Result r) + => r.Kind == SharpyKind.Ran + ? $"Ran '{Harness.Normalize(r.Run.Stdout)}'" + : $"{r.Kind} [{string.Join(",", r.Run.AllCodes.Distinct())}{(r.Run.CsCode != null ? " " + r.Run.CsCode : "")}]" + + (r.Kind == SharpyKind.RuntimeThrow ? $" stderr '{r.Run.Stderr.TrimStart().Split('\n', 2)[0].TrimEnd()}'" : ""); + + private bool _currentCellNeedsStdlib; + + protected override IEnumerable GetAdditionalReferenceAssemblyPaths() + { + if (_currentCellNeedsStdlib) + yield return SharpyStdlibReference.Location; + } + + private Harness.SharpyRun RunSharpy(NameCell cell, int timeoutMs) + { + _currentCellNeedsStdlib = cell.NeedsStdlib; + var r = CompileAndExecute(cell.Source, "scope_meaning.spy", executionTimeoutMs: timeoutMs); + var diagnostics = r.RawDiagnostics; + var all = diagnostics.Select(d => d.Code).Where(c => c != null).Select(c => c!).ToList(); + var errors = diagnostics.Where(d => d.Severity == CompilerDiagnosticSeverity.Error).Select(d => d.Code).Where(c => c != null).Select(c => c!).ToList(); + var cs = diagnostics.Where(d => d.Code == "SPY0908").Select(d => Regex.Match(d.Message, @"\bCS\d{4}\b")).Where(m => m.Success).Select(m => m.Value).FirstOrDefault(); + return new Harness.SharpyRun(r.Success, r.ExitCode, r.Exception != null, r.TimedOut, r.StandardOutput, r.StandardError, errors, all, cs); + } + + [SkippableFact] + public void ScopeMeaning_Sweep() + { + var oracle = PythonBatchOracle.Over(PythonInterpreter.RequireOrSkip(minMinor: 12)); + var wall = Stopwatch.StartNew(); + var pool = GeneratedCases(); + var failures = TotalityFailures(pool); + + // --- Python arm: one batch over the cells python runs with the same meaning. --- + var requests = new List(); + var twinFailures = new Dictionary(); + for (int i = 0; i < pool.Count; i++) + { + if (!pool[i].Twin) + continue; + try + { + requests.Add(new PyRequest(i, TwinRenderer.Render(pool[i].Cell.Source))); + } + catch (Exception ex) when (ex is NotSupportedException or InvalidOperationException) + { + twinFailures[i] = $"renderer: {ex.Message}"; + } + } + var pythonById = oracle.RunBatch(requests, PythonBatchTimeoutMs); + + // --- Sharpy arm: production compile + execute, `run` and never `emit`. --- + var results = new List(pool.Count); + for (int i = 0; i < pool.Count; i++) + { + var c = pool[i]; + string? pythonFailure = twinFailures.GetValueOrDefault(i); + if (pythonFailure == null && c.Twin) + { + var python = pythonById.TryGetValue(i, out var verdict) ? Harness.ClassifyPython(verdict) : new PyOutcome(PyKind.SyntaxError, "no verdict from the runner"); + if (python != c.Cell.Python) + pythonFailure = $"the cell is modelled to print '{c.Cell.Model}' and python {python}"; + } + var run = RunSharpy(c.Cell, SharpyExecTimeoutMs); + if (run.TimedOut) + run = RunSharpy(c.Cell, SharpyExecTimeoutMs * 2); + var kind = Harness.ClassifySharpy(run); + var (cls, wrongCode) = Judge(c.Cell, kind, run); + results.Add(new Result(c, run, kind, cls, wrongCode, pythonFailure)); + } + + // --- Ratchet. --- + var universe = pool.Select(c => c.Cell.Id).ToHashSet(StringComparer.Ordinal); + var path = PythonInterpreter.FindRepoFile("src", "Sharpy.Compiler.Tests", "Conformance", AllowlistFileName); + var rows = InitializerDependencyDifferentialTests.ParseAllowlist(path == null ? Array.Empty() : File.ReadAllLines(path), universe, failures); + failures.AddRange(RatchetFailures(results, rows)); + + wall.Stop(); + var red = results.Where(r => IsRed(r.Class)).ToList(); + var dir = ReportDirectory(); + using (var writer = new StreamWriter(Path.Combine(dir, "scope-meaning-differential-cells.jsonl"))) + { + foreach (var r in results) + { + writer.WriteLine(JsonSerializer.Serialize(new + { + id = r.Case.Cell.Id, + tag = r.Case.Cell.Tag.ToString(), + rule = r.Case.Cell.Rule, + verdict = r.Class.ToString(), + wrongCode = r.WrongCode, + twin = r.Case.Twin, + python = r.PythonFailure, + sharpy = Describe(r), + source = r.Case.Cell.Source, + })); + } + } + File.WriteAllLines( + Path.Combine(dir, "scope-meaning-differential-proposed-allowlist.txt"), + red.OrderBy(r => r.Case.Cell.Id, StringComparer.Ordinal).Select(r => $"{r.Case.Cell.Id} {r.Class} # {ProposedCite(r)}")); + + var report = $"scope-meaning-differential: pool {pool.Count} ({pool.Count(c => c.Cell.Tag == SharpyTag.MustRun)} must-run, {pool.Count(c => c.Cell.Tag == SharpyTag.MustRefuse)} must-refuse), " + + $"python agreed {results.Count(r => r.Case.Twin && r.PythonFailure == null)}/{pool.Count(c => c.Twin)}, red {red.Count}, allowlist {rows.Count}, wall {wall.Elapsed.TotalSeconds:F1}s. " + + string.Join(" ", results.GroupBy(r => r.Case.Cell.Key!.Route).Select(g => $"{g.Key}={g.Count()}/red {g.Count(r => IsRed(r.Class))}")); + Output.WriteLine(report); + Assert.True(failures.Count == 0, $"{failures.Count} failures. {report}\n{string.Join("\n", failures.Take(120))}"); + } + + private static string ReportDirectory() + { + var dir = new DirectoryInfo(AppContext.BaseDirectory); + while (dir != null && !File.Exists(Path.Combine(dir.FullName, "sharpy.sln"))) + dir = dir.Parent; + var tmp = Path.Combine(dir?.FullName ?? Path.GetTempPath(), ".claude", "tmp"); + Directory.CreateDirectory(tmp); + return tmp; + } + + // ------------------------------------------------------------------------------------------- // + // The ratchet's own fact: plain data in, no compile + // ------------------------------------------------------------------------------------------- // + + [Fact] + public void Ratchet_ARedCell_NeedsItsRow_AndARowNeedsItsRedCell() + { + var pool = GeneratedCases(); + var running = pool.First(c => c.Cell.Tag == SharpyTag.MustRun && c.Cell.Key!.Route == "callee"); + var refusing = pool.First(c => c.Cell.Tag == SharpyTag.MustRefuse && c.Cell.Key!.Route == "typed-read"); + static Harness.SharpyRun Ran(string stdout) => new(true, 0, false, false, stdout, "", Array.Empty(), Array.Empty(), null); + static Harness.SharpyRun Refused(string code) => new(false, null, false, false, "", "", new[] { code }, new[] { code }, null); + Result Of(Case c, Harness.SharpyRun run, string? pythonFailure = null) + { + var kind = Harness.ClassifySharpy(run); + var (cls, wrongCode) = Judge(c.Cell, kind, run); + return new Result(c, run, kind, cls, wrongCode, pythonFailure); + } + var none = new Dictionary(); + var listed = new Dictionary { [running.Cell.Id] = new(VerdictClass.SilentWrong, "#2423 silent-wrong") }; + var wrong = new Dictionary { [refusing.Cell.Id] = new(VerdictClass.FalseRefusal, "#2423 wrong-code") }; + + Assert.Empty(RatchetFailures(new[] { Of(running, Ran("1")) }, none)); + Assert.Empty(RatchetFailures(new[] { Of(running, Ran("12")) }, listed)); + Assert.Empty(RatchetFailures(new[] { Of(refusing, Refused("SPY0220")) }, none)); + Assert.Empty(RatchetFailures(new[] { Of(refusing, Refused("SPY0200")) }, wrong)); + + Assert.Contains("model", Assert.Single(RatchetFailures(new[] { Of(running, Ran("12")) }, none))); + Assert.Contains("STALE", Assert.Single(RatchetFailures(new[] { Of(running, Ran("1")) }, listed))); + Assert.Contains("MOVED", Assert.Single(RatchetFailures(new[] { Of(running, Refused("SPY0200")) }, listed))); + Assert.Contains("FalseRefusal", Assert.Single(RatchetFailures(new[] { Of(refusing, Refused("SPY0200")) }, none))); + Assert.Contains("STALE", Assert.Single(RatchetFailures(new[] { Of(refusing, Refused("SPY0220")) }, wrong))); + Assert.Contains("the route says", Assert.Single(RatchetFailures(new[] { Of(running, Ran("12")) }, + new Dictionary { [running.Cell.Id] = new(VerdictClass.SilentWrong, "#2432 silent-wrong") }))); + Assert.Contains("GeneratorBug", Assert.Single(RatchetFailures(new[] { Of(running, Ran("1"), "python 4") }, none))); + } +} diff --git a/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt b/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt index 09884f3b2..091e15f59 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt +++ b/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt @@ -212,3 +212,16 @@ MustRun P52 family=TypeMember route=class,dataclass,enum,interface,struct,union # --- Seed: 1 rows, 168 cells --- * seed family=Seed route=- + +# --- ScopeMeaningDifferentialTests: the cells the P77a pool has no program for (hand-written; the test reads its +# --- verdicts from these rows and carries none) --- +MustRefuse R-QI family=Read route=no-initializer initializer=Absent target=ModuleVar,ModuleProperty,StaticField,StaticProperty +MustRun N1 family=Read route=no-initializer initializer=Absent target=InstanceField,InstanceProperty,LocalVar +MustRun N1 family=Read route=no-initializer initializer=Present,AccessorBodies +MustRefuse N1-typed-read family=Read route=typed-read +MustRun N1-innermost family=Local route=callee +MustRun N4 family=Read route=constant-kind constantKind=ClrLiteralField,ComparisonChain +MustRefuse SPY0401 family=Read route=constant-kind constantKind=StdlibModuleVariable,ChainWithNonConstantLink +MustRun N1 family=Read route=init-overload +MustRefuse N1-alias-target family=Read route=alias-target aliasTarget=Missing +MustRun N1 family=Read route=alias-target aliasTarget=Declared diff --git a/src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt b/src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt new file mode 100644 index 000000000..a2d1ab3d2 --- /dev/null +++ b/src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt @@ -0,0 +1,37 @@ +# Known-red cells of ScopeMeaningDifferentialTests (stage 0 of plan-777361, P78; verification contract §11). +# ` # # `: the issue is the one whose fix turns the +# cell green, by the cell's route (ScopeMeaningDifferentialTests.RouteIssues). A row whose cell passes fails the test +# until it is deleted. `wrong-code` is a must-refuse cell refused under a code its cell does not admit. +local/callee/Comprehension/outer=ModuleDef SilentWrong # #2423 silent-wrong +local/callee/For/outer=ModuleDef SilentWrong # #2423 silent-wrong +local/callee/Parameter/outer=ModuleDef SilentWrong # #2423 silent-wrong +local/callee/WithAs/outer=ModuleDef SilentWrong # #2423 silent-wrong +read/alias-target/Missing/Unused/Earlier SilentWrong # #2423 missing-refusal +read/constant-kind/DataclassFieldInitializer/ComparisonChain/ordered FalseRefusal # #2432 false-refusal +read/constant-kind/DataclassFieldInitializer/StdlibModuleVariable/math.pi Ice # #2432 ice +read/constant-kind/DataclassFieldInitializer/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice +read/constant-kind/EnumMemberValue/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice +read/constant-kind/ParameterDefault/ComparisonChain/ordered FalseRefusal # #2432 false-refusal +read/constant-kind/ParameterDefault/StdlibModuleVariable/math.pi Ice # #2432 ice +read/constant-kind/ParameterDefault/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice +read/constant-kind/StructFieldInitializer/ComparisonChain/ordered FalseRefusal # #2432 false-refusal +read/constant-kind/StructFieldInitializer/StdlibModuleVariable/math.pi Ice # #2432 ice +read/constant-kind/StructFieldInitializer/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice +read/init-overload/InitDelegation/Later FalseRefusal # #2423 false-refusal +read/no-initializer/ModuleProperty/Absent SilentWrong # #2423 missing-refusal +read/no-initializer/ModuleVar/Absent SilentWrong # #2423 missing-refusal +read/no-initializer/StaticField/Absent SilentWrong # #2423 missing-refusal +read/no-initializer/StaticProperty/Absent SilentWrong # #2423 missing-refusal +read/typed-read/ClassComputedConst/Annotated/Later Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later Ice # #2423 ice +read/typed-read/ClassLiteralConst/Annotated/Later Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later Ice # #2423 ice +read/typed-read/ModuleVar/Annotated/Later FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later FalseRefusal # #2423 wrong-code +read/typed-read/StaticField/Annotated/Later Ice # #2423 ice +read/typed-read/StaticField/Inferred/Earlier Ice # #2423 ice +read/typed-read/StaticField/Inferred/Later Ice # #2423 ice +read/typed-read/StaticMethod/Annotated/Later Ice # #2423 ice From a7fbd945d96416b0ddb0d34739433eb30b4c1912 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 05:29:28 +0000 Subject: [PATCH 07/22] process(plan): plan-777361 (P78) revised before pass 1 A draft with no pass: revised to the owner's rulings of 2026-11-20 (#2423 comment 7030074628) and to stage 0 as landed @ 8bd4b49fc (ff40b21a9, 59ac995da, 8bd4b49fc). Text is replaced, not appended. - Generator: no longer "not landed". The table (196 rows, 48 rules, 27 axes), the two test types with their counts, the hand-listed axes named as such, the exclusions, and which decisions turn rows green. - D8: the nine must-refuse cells that run are must-run (item 2); math.pi / socket.AF_INET are SPY0401 and #2768's as constants (item 4). A9 and #2432's close criterion follow. - D10: an alias to a missing type is refused at its declaration, used or not (item 3), with A13, M13, T12, its direction line and its place in A8's record. The 32 R-LQ rows cite #2397. - D9: the relabelling is T8's edit of the table; its SPY0401 count is 154 (the draft's 169 counted 15 qualified reads, which N2 does not name). - Counts re-taken @ 8bd4b49fc: 303/0/0 on the instrument filter (measured), sweep 7 m 26 s, seed rows 2368 (1076 / 6 / 27), the new type's 33 (23 / 10), scorecard seed 2368 and outside 605. - A11 names docs/design/gap-discovery-contracts.md, which still says RuleAxes. check_plan_refs.py: RESULT: OK; body 20,090 -> 20,479 / 20,480 bytes; 0 verify passes / 2. Next: /verify-plan in a fresh context. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01LGMKZVcFYGqQRfHgd16DLa --- docs/process/plans/plan-777361.md | 44 ++++++++++++++++++------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/docs/process/plans/plan-777361.md b/docs/process/plans/plan-777361.md index d2422d96c..e2b7e133d 100644 --- a/docs/process/plans/plan-777361.md +++ b/docs/process/plans/plan-777361.md @@ -1,4 +1,4 @@ - + # P78 — N1/N2/N4/N7: scope decides meaning @@ -15,11 +15,11 @@ Rules N1, N2, N4 and N7 of `docs/design/name-resolution.md` (charter §3.20l): # - **Bodies (#2398).** A nested type's initializer reading the enclosing type's `@static` or instance field: SPY0909. A lambda in an initializer: the method-body steer. `@static def len()` then `v: int = len()`: SPY0224. An interface or union parameter default: SPY0200 + SPY0401. A parameter `x` called as `x()` under a module `def x`: `12` (python `1`). - **Constant positions (#2432).** Enum member `RED = x` / `= x()`: CS0133. A default through a `@static property`, `math.pi`, `socket.AF_INET`: CS1736. `= 1 < 2 < 3`: SPY0401 (python `True`). - **No initializer (R-QI).** Module `x: int` and `@static t: int`, read: `0` (python NameError). -- **Instruments.** `NameResolutionDifferentialTests`, `ClassBodyReadPositionMatrixTests`, `StaticInitializerOrderMatrixTests` and the `ConstantPositionValidator` tests: 299/0/0 (sweep 7 m 29 s; pool 8951 = `CellBudget`; python agrees on 8951). Allowlist rows: 1117 / 6 / 27 cite #2423 / #2398 / #2432. #2423's by rule: N2 343, instance-at-initializer 250, N1-type-error 97, N1-innermost 96, N1 90, N1-nesting 61, N7 32, seeds 27, SPY0401 25, N1+N3 24, N2-module 24, R-Y 20, N3 10, others 18. Scorecard: seed 2377, outside 572. The sweep is one test: R-QH's split has not landed. +- **Instruments @ 8bd4b49fc**. The two generated types, `ClassBodyReadPositionMatrixTests`, `StaticInitializerOrderMatrixTests` and the `ConstantPositionValidator` tests: 303/0/0 (sweep 7 m 26 s; pool 8951 = `CellBudget`; python agrees on 8951 + 18). Seed allowlist 2368 rows: 1076 / 6 / 27 cite #2423 / #2398 / #2432; the new type's 33: 23 / 10 cite #2423 / #2432. Scorecard: seed 2368, outside 605. ## Scope -- **Group:** P78 (chores: none). #2432 stays in (R-KV lets the author split it): 27 of 1150 rows, on `TypeBodyMembership` and the interface/union cell #2398 shares. +- **Group:** P78 (chores: none). #2432 stays in (R-KV): 37 of 1142 rows, on `TypeBodyMembership` and the interface/union cell #2398 shares. - **Tier:** full (c: the seam is under `Semantic/`) — from charter §3.20l - **Alone:** no — verdicts, not layout; no snapshot moves (A12) - **Gates:** 1 @@ -33,16 +33,16 @@ Rules N1, N2, N4 and N7 of `docs/design/name-resolution.md` (charter §3.20l): # - **Known member cells:** #2423, #2398, #2432; the folded #2415 (C08) and #2416 method-group cells; R-QI's cells (#2427, comment 6967863739). - **Sibling cells this plan must also cover:** none listed; see Generator. - **Lane / reach:** false-refusal + silent-wrong + ice · program; **fidelity-scope row:** "which programs run vs. are refused" and "value of an expression", both COMPARED. -- **Standing harness that should have caught it:** `NameResolutionDifferentialTests` (it does: 1150 rows). `ClassBodyReadPositionMatrixTests` is the hand control (R-KF) for the one axis the generator cannot judge: steer text and diagnostic count per position × host. -- **Generator:** stage 0 (§2.1), in `NameResolutionDifferentialTests` (R-LO: the executor) — **not landed at this draft**; it waits on the owner's answers to the questions in the plan pull request, and no pass runs before it lands. **S0a:** the #2487 table as data beside the allowlist: rows of axis classes → tag and rule id, each axis a typed `NameCell` property; every cell matches exactly one row, whose tag and rule are the cell's and what the sweep judges by; every row has a cell; `RuleAxes` is deleted. **S0b:** the cells the pool lacks (0 of its 8951 programs carry any): R-QI's binding kind × initializer; `b: bool = ` per binding kind; a parameter or loop target in callee position; #2432's expression kinds {Stdlib module attribute, comparison chain}; a later `__init__` overload. Excluded, each by a named exclusion: the project route (A3's hand controls) and message text (the hand control). Counts and known-red rows: measured at the stage-0 sha. -- **Owner rulings:** R-KD, R-KF, R-KG, R-KJ, R-KV, R-LJ, R-LO, R-PM, R-QE, R-QI (charter §4); #2432's call-43 and call-45 cells (§3.20l). +- **Standing harness that should have caught it:** `NameResolutionDifferentialTests` (it does: 1109 rows). `ClassBodyReadPositionMatrixTests` is the hand control (R-KF) for the one axis the generator cannot judge: steer text and diagnostic count per position × host. +- **Generator:** stage 0 (§2.1) @ 8bd4b49fc. **The table** (S0a, #2487): `name-resolution-rules.txt`, 196 rows over 48 rules, each a tag, a rule id and constraints on `RuleTableAxes`' 27 axes, 23 typed. Every cell of both pools matches exactly one row and every row has a cell; `RuleAxes` is deleted. **`NameResolutionDifferentialTests`:** 8951 cases, 2368 known-red rows; the generator's tag and rule must equal the row's. Its 186 rows were derived by splitting the pool on the axes: they state the generator; T8 rewrites those D9 names. **`ScopeMeaningDifferentialTests`** (S0b): 86 cases, 33 known-red rows; it takes every verdict from its row (six cell sets: its summary). Hand lists, closed by the pools: the axes `route`, `mark`, `shape`, `deviation` and the six `Scope*` enums. Excluded: the project route (A3's hand controls), message text (the hand control), a `@static property` typed read (#2417), a match capture as callee (CS8119). Green by D1, D2, D5, D10 (A1, A2, A4, A13), D3, D4, D6, D7 (A5–A7), D8 (A9). +- **Owner rulings:** R-KD, R-KF, R-KG, R-KJ, R-KV, R-LJ, R-LO, R-PM, R-QE, R-QI (charter §4); #2432's call-43 and call-45 cells (§3.20l); owner 2026-11-20, #2423 comment 7030074628: stage 0's test type, D8's nine cells, D10, #2432's close. ## Adversarial Review (pre-mortem) - **Alternative root cause:** "bodies are checked in textual order" — refuted: the same function reads a later `const`, `def`, class and module property (`3`, `4`); only the variable's symbol is missing. The `bool` probe shows the second cause: a symbol that exists is still untyped until its declaration is checked (D2). - **Alternative layer:** scoping has no `.spy`, dunder or protocol spelling; D8's module-attribute arm is rung 3. - **How the fix could be inert:** D1 without D2 prints `3` and leaves CS0029; F2's yield one branch above the N2 refusal keeps `64`; a callee site left on its own lookup keeps `12`. -- **Before/after by direction:** newly refused and `worked`, each ruled: the N2 cells (`6`, `64`, `3`, `2`; R-KD, R-KJ); a module initializer under a later same-named declaration (`7`, python `2`; R-LJ); a module or `@static` declaration with no initializer (R-QI; a regex census of 4,384 `.spy` files finds none). Unruled, the owner's: an unused alias to a missing type (D10). Newly running: every order-only refusal. A8 is the record. +- **Before/after by direction:** newly refused and `worked`, each ruled: the N2 cells (`6`, `64`, `3`, `2`; R-KD, R-KJ); a module initializer under a later same-named declaration (`7`, python `2`; R-LJ); a module or `@static` declaration with no initializer (R-QI; a regex census of 4,384 `.spy` files finds none); an unused alias to a missing type (`1` today; D10). Newly running: every order-only refusal. A8 is the record. - **Blast radius:** every project and sweep of the commit gate; Stdlib.Tests (the `.spy` stdlib's module variables), cold/warm and `FrontEndParityTests` first. - **Generated artifacts touched:** none may move: spy-stdlib C#, spy-test C# and `.expected.cs` are regenerated after T1 and T4 and an empty diff is the guard (A12); the oracle ledger follows `docs/deviations.yaml` at T11. @@ -56,9 +56,9 @@ Python is evidence where it runs the same program: a NameError by order only bec - **D5 (one callee resolver).** A bare callee resolves by the scope walk a bare read uses — local, parameter, class-body sibling at a class-body position, module, builtin — and dispatches on the symbol it bound. The 33 direct `LookupFunctionOverloads` / `BuiltinRegistry.GetFunction` / `GetFunctionOverloads` sites in `TypeChecker*.cs` go behind it; a census test pins the remainder at the helper's own. A constructor's overload set is the whole body's. - **D6 (N2 at module level; R-LJ).** A read evaluated at load — a module-level or class-level initializer or default — of a builtin name its module declares at or after the reader is SPY0619. A function body is not such a position. An import its module redeclares stays SPY0204 at the declaration, whatever reads it. - **D7 (R-QI).** A module variable, a `@static` field, and a module or `@static` auto-property with no initializer is SPY0620 at its declaration; the steer names `x: T = ` and `x: T | None = None`. Untouched: an instance field, a local `x: T`, a property with accessor bodies. -- **D8 (#2432; Validation).** `ConstantPositionValidator` judges an enum member's value (a new `AdmissionTable` row) and pushes interface and union hosts on `_enclosingTypes`. `IsMemberConstAdmissible` answers for every member access the checker bound, by what the member is: true for a `const` whose fact is true through any receiver, for an enum member and its `.value`, and — rung 3, since a constant in a referenced assembly has no Sharpy symbol — for a CLR literal field read through `ClrTypeBridge`; false for a `@static` field, property or method, own or inherited. The shape rule keeps only what the checker did not bind. A `ComparisonChain` is admitted when each link is. Predicate: no expression a constant position admits is CS0133 or CS1736, and no constant it admits today is refused. **Open, the owner's:** the harness tags 9 such cells must-refuse (rows citing #2423: an enum member's `.value`, a literal `const` through a subclass name; each runs, and python prints the same where it runs); D8 keeps them running, so their tags move only on the owner's word. -- **D9 (codes).** SPY0619 (N2; the text carries both readings and the qualified spelling) and SPY0620 (R-QI), each with its `DiagnosticExplanations` entry; SPY0618 retires. SPY0200 stays where no binding is visible at the position. In the table a read at-or-after its member under an outer binding is N2's whatever its target or position (381 cells leave `kind:instance-at-initializer`, 169 leave `SPY0401`), N2 admits SPY0619 alone, N2-module SPY0619 and D6's SPY0204, `kind:enum-member-constant` SPY0401, and `N1-arity` names its code. -- **D10 (open, the owner's).** `type K0 = nosuch`, unused, compiles and runs today; it is refused at the alias (SPY0202) only on the owner's word, and until then it is no cell of this plan. The 32 N7 rows citing #2423 are `self.N()` / `A.N()` on a nested type, which R-LQ gave P16 (#2397): re-cited there on the owner's word, else D3 admits them. +- **D8 (#2432; Validation).** `ConstantPositionValidator` judges an enum member's value (a new `AdmissionTable` row) and pushes interface and union hosts on `_enclosingTypes`. `IsMemberConstAdmissible` answers for every member access the checker bound, by what the member is: true for a `const` whose fact is true through any receiver, for an enum member and its `.value`, and — rung 3, since a constant in a referenced assembly has no Sharpy symbol — for a CLR literal field read through `ClrTypeBridge`; false for a `@static` field, property or method, own or inherited. The shape rule keeps only what the checker did not bind. A `ComparisonChain` is admitted when each link is. Predicate: no expression a constant position admits is CS0133 or CS1736, and no constant it admits today is refused. The nine cells tagged must-refuse that run (an enum's `.value`; a literal `const` through a subclass) are must-run since stage 0 (owner). `math.pi` and `socket.AF_INET` are `.spy` module variables: SPY0401 (#2768). +- **D9 (codes).** SPY0619 (N2; the text carries both readings and the qualified spelling) and SPY0620 (R-QI), each with its `DiagnosticExplanations` entry; SPY0618 retires. SPY0200 stays where no binding is visible at the position. T8 edits the table: a bare read at-or-after its member under an outer binding is N2's whatever its target or position (381 cells leave `kind:instance-at-initializer`, 154 leave `SPY0401`), N2 admits SPY0619 alone, N2-module SPY0619 and D6's SPY0204, `kind:enum-member-constant` SPY0401, and `N1-arity` names its code. +- **D10 (an alias names a type that exists; owner).** `type K0 = nosuch` is SPY0202 at the alias whether or not anything names it: the target is resolved where the alias is declared. Predicate: no alias is declared whose target resolves to no type. The 32 `self.N()` / `A.N()` rows are R-LQ's and cite #2397 since stage 0. - **Out of contract:** a read above a same-scope local (R-KX, P80); a store without `global` (P79); a walrus over `let` (P21b); `ALSO = RED` (#2069, P23); an untyped `@static property` read (#2417); the #2397 rows (P16); `T !E` above its `E` (its row cites #2249, P52); `from m import x` as a live alias (N6). ## Implementation @@ -71,13 +71,15 @@ Python is evidence where it runs the same program: a NameError by order only bec - **A1.** #2423's module-level rows under N1, N1-nesting and N3 drain (143) — **M1:** declare only annotated variables → the `auto` cells red - **A2.** S0b's `bool` cells are SPY0220 at both orders — **M2:** drop the first-read check → CS0029 - **A3.** One symbol: `StaticStorageFactsRoundTripTests` and `ColdWarmBuildDifferentialTests` hold a variable's export equal to its declared symbol, cold and warm, with a project control per importer form — **M3:** create the symbol in `CheckVariableDeclaration` again → the cold cell red -- **A4.** The 96 local rows (N1-innermost) and the module-level N1-type-error and N1-arity rows (46) drain, and S0b's callee cells print python's value — **M4:** send one site back to `LookupFunctionOverloads` → red, and the census pin red +- **A4.** The 96 local rows (N1-innermost) and the module-level N1-type-error and N1-arity rows (46) drain, S0b's callee cells print python's value and its later-`__init__` cell runs — **M4:** send one site back to `LookupFunctionOverloads` → red, and the census pin red +- **A13.** S0b's unused-alias cell is SPY0202 and its five controls keep theirs — **M13:** resolve the target at first use → the cell prints `1` #### Tasks - **T1. Declare module variables (D1)** — `NameResolver.Declarations.cs`, `NameResolver.Members.cs`, `TypeChecker.Statements.cs`, `ProjectCompiler.Phases.cs`, `StaticStorageFacts.cs`; then regenerate (A12). (A1, A3) - **T2. Types before reads (D2)** — `TypeChecker.cs`, `TypeChecker.Statements.cs`, `TypeChecker.Definitions.cs`. (A2) - **T3. One callee resolver (D5)** — `TypeChecker.Expressions.Access.Calls.cs`, `TypeChecker.Expressions.Access.Calls.Overloads.cs`, the census in `DispatchSiteInventoryTests`. (A4) +- **T12. Alias targets (D10)** — `NameResolver.Declarations.cs`. (A13) ### Phase 2: Ambiguity and bodies (N2, N4, N7, R-KG, R-QI) @@ -87,7 +89,7 @@ Python is evidence where it runs the same program: a NameError by order only bec - **A5.** #2423's type-level rows under N2, instance-at-initializer, N1-type-error, N1+N3, N1 and SPY0401 (710) and its N2-module rows (24) drain, C08's pin in `StaticInitializerOrderMatrixTests` moves to SPY0619, and no cell under N2 answers with another code — **M5:** restore F2's yield → `64`; restore the `const` exemption → `3`; report under SPY0200 → red; let a function body count for D6 → its controls red - **A6.** The 6 #2398 rows and #2423's R-Y, N1-methods and R-KG rows (30) drain; the hand control, with scope {own body, nested type at one and two levels, lambda in an initializer, comprehension body} × host {class, struct, interface, union}, holds one diagnostic whose phrase is its position's — **M6:** drop D4's crossing → SPY0909; give the lambda the method-body text → red - **A7.** S0b's R-QI cells are SPY0620; their controls (an initializer; an instance field set in `__init__`; a local `x: T`; an accessor-bodied property) run — **M7:** skip `@static` → red; include instance fields → the control red -- **A8.** Direction record: every fixture, spec block and `.spy` stdlib module newly SPY0619 or SPY0620, each with its prior behaviour; none `worked` outside the rulings named above +- **A8.** Direction record: every fixture, spec block and `.spy` stdlib module newly SPY0619, SPY0620 or SPY0202 at an alias, each with its prior behaviour; none `worked` outside the rulings named above #### Tasks @@ -103,7 +105,7 @@ Python is evidence where it runs the same program: a NameError by order only bec **Goal:** a constant position's verdict is the checker's. **Acceptance:** -- **A9.** The 27 #2432 rows drain to SPY0401; D8's 9 open rows keep running; S0b's cells: `subprocess.PIPE`, a CLR literal, runs (`-1` today); `math.pi` and `socket.AF_INET`, module variables of the `.spy` stdlib, are SPY0401 (python runs them: a ledger cell, Stdlib's); a chain is admitted exactly when its links are — **M9:** answer null for a bound non-constant member → CS1736; skip the enum row → CS0133; admit every chain → `0 < 2 in [1, 2]` reaches C# +- **A9.** The 27 #2432 rows and S0b's 10 drain: `math.pi` and `socket.AF_INET` are SPY0401 (python runs them: #2768), a chain is admitted exactly when its links are, and `subprocess.PIPE`, a CLR literal, still prints `-1` — **M9:** answer null for a bound non-constant member → CS1736; skip the enum row → CS0133; admit every chain → `0 < 2 in [1, 2]` reaches C# - **A10.** An interface or union parameter default draws one diagnostic — **M10:** drop either push → two #### Tasks @@ -113,7 +115,7 @@ Python is evidence where it runs the same program: a NameError by order only bec ### Phase 4: Spec and record **Acceptance:** -- **A11.** `docs/language_specification/variable_scoping.md` is rewritten around N1–N7: each rule's example executed, each printing something else with its rule off; an `error` block per refusal; the F1, F2, R-JJ and SPY0618 texts gone; touched files drained (R-BG). `docs/language_specification/variable_declaration.md` § Bare Declarations states D7. `docs/deviations.yaml`: `class-body-bare-name-read` is N1 and N2's text. `docs/design/name-resolution.md`: the *Today* notes of N1, N2 and N4 removed, the table named as the source. #2426's other open items (the block-scope list's `match` case and loop-`else` bodies, the `case x:` constant-pattern row, the walrus and `let` texts) are fixed, or marked pending with the issue that owns each. `check_spec_blocks.sh` green +- **A11.** `docs/language_specification/variable_scoping.md` is rewritten around N1–N7: each rule's example executed, each printing something else with its rule off; an `error` block per refusal; the F1, F2, R-JJ and SPY0618 texts gone; touched files drained (R-BG). `docs/language_specification/variable_declaration.md` § Bare Declarations states D7. `docs/deviations.yaml`: `class-body-bare-name-read` is N1 and N2's text. `docs/design/name-resolution.md`: the *Today* notes of N1, N2 and N4 removed, the table named as the source there and in `docs/design/gap-discovery-contracts.md`. #2426's other open items (the block-scope list's `match` case and loop-`else` bodies, the `case x:` constant-pattern row, the walrus and `let` texts) are fixed, or marked pending with the issue that owns each. `check_spec_blocks.sh` green - **A12.** `regen: no diff` after T1 and after T4, for spy-stdlib C#, spy-test C# and `.expected.cs`; `FrontEndParityTests` green - Allowlists drain, each row in the commit that turns it green: every #2423, #2398 and #2432 row and every S0b row; `allowlist_rows_seed` lowered with `--lower` @@ -123,17 +125,16 @@ Python is evidence where it runs the same program: a NameError by order only bec ## Testing Strategy -- Fixtures: one `.spy` + `.expected` per rule and one `.error` per refusal (SPY0619 in a class body and at module level, SPY0620, SPY0200 with each D4 phrase, SPY0401 at an enum member), each with its running control: the same read qualified, the same declaration with an initializer. +- Fixtures: one `.spy` + `.expected` per rule and one `.error` per refusal (SPY0619 in a class body and at module level, SPY0620, SPY0200 with each D4 phrase, SPY0401 at an enum member, SPY0202 at an unused alias), each with its running control: the same read qualified, the same declaration with an initializer. - Change of axis beyond the issues: host {struct, interface, union}; reader {property default, synthesized-constructor field}; outer {import, builtin, enclosing function}; the project route (A3). - Outputs discriminate: member and outer values differ in every cell; an initializer's default is never a member's value. -- Spec: A11, a deliverable of equal weight. -- Blast radius and regeneration: A12, early, never at push time. +- Spec: A11, of equal weight. Blast radius and regeneration: A12, early. ## Issues to Close -- #2423 — closed by T1–T9; **close criterion:** A1–A8 @ sha, 0 rows citing it (D8's 9 and D10's 32 by their answers) +- #2423 — closed by T1–T9, T12; **close criterion:** A1–A8, A13 @ sha, 0 rows citing it in either allowlist - #2398 — closed by T5, T9, T10; **close criterion:** A6 and A10 @ sha -- #2432 — closed by T10; **close criterion:** A9 @ sha +- #2432 — closed by T10; **close criterion:** A9 @ sha: the SPY0401 verdict (owner); the constants are #2768's - #2426 — closed by T11; **close criterion:** A11 @ sha - #2487 — closed by stage 0 and T11; **close criterion:** S0a's totality test and its two mutations @ the stage-0 sha, and A11's pointer @@ -143,3 +144,8 @@ Python is evidence where it runs the same program: a NameError by order only bec - #2457 — the harness's residue (P77c) - #2486 — the rule tables - #2397, #2417, #2069, #2249 — neighbouring classes named under Out of contract +- #2768 — Stdlib constants as module variables + +## Revision log + +- @ 8bd4b49fc — revised before the first pass: stage 0 landed; D8's nine cells are must-run; D10 refuses the alias (A13); #2432 closes on SPY0401 (#2768); 32 rows cite #2397; D9's 169 is 154. From 55846bb3f1701407e15a56a7c3b496d59f4b2456 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 06:31:02 +0000 Subject: [PATCH 08/22] process(plan): plan-777361 (P78) verified NEEDS REVISION @ a7fbd945d MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /verify-plan pass 1 of 2, nine dimensions. Result NEEDS REVISION (Dimension 6, with Dimension 4 design rows); Adequacy CELL. The stamp replaces the DRAFT marker and a Verification Summary is appended. The body is unchanged: 20,479 of 20,480 bytes before and after, so no correction was made in place; each is in the summary. Stage 0 (contract §11) @ 8bd4b49fc: the path check passes; both generated types and the three hand instruments are 303/0/0 at this tree; seven mutations were re-run from cp copies, each red, each restored and confirmed with cmp, then green. Open: axes the new type carries as hand lists or single values, each with a value measured red today; D2 not reaching six of A2's thirteen red cells; four decisions that are the owner's. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01LGMKZVcFYGqQRfHgd16DLa --- docs/process/plans/plan-777361.md | 101 +++++++++++++++++++++++++++++- 1 file changed, 100 insertions(+), 1 deletion(-) diff --git a/docs/process/plans/plan-777361.md b/docs/process/plans/plan-777361.md index e2b7e133d..7ba882b50 100644 --- a/docs/process/plans/plan-777361.md +++ b/docs/process/plans/plan-777361.md @@ -1,4 +1,7 @@ - + + + + # P78 — N1/N2/N4/N7: scope decides meaning @@ -149,3 +152,99 @@ Python is evidence where it runs the same program: a NameError by order only bec ## Revision log - @ 8bd4b49fc — revised before the first pass: stage 0 landed; D8's nine cells are must-run; D10 refuses the alias (A13); #2432 closes on SPY0401 (#2768); 32 rows cite #2397; D9's 169 is 154. +## Verification Summary + +**Result:** NEEDS REVISION (Dimension 6, with Dimension 4 design rows; pass 1 of 2) +**Adequacy:** CELL +**Verified on:** 2026-11-20 @ a7fbd945d (product code == e24aaf9f0; stage 0 @ 8bd4b49fc; Debug `sharpyc` built at this tree; python = CPython 3.15.2, `.venv/bin/python3`) +**Plan file:** `docs/process/plans/plan-777361.md` (committed in §4 at every result, NEEDS REVISION included) + +### Paraphrase +- **Changes:** a module-level or class-level name gets one meaning, one type and one legality verdict wherever it is read. Module variables are declared at name resolution as consts are (D1) and typed before any read (D2). One class-body rule decides a bare sibling read from the member's level, its order against the reader, whether a binding outside the body holds the name, and the position: an earlier member is the member, at-or-after under an outer binding is the new SPY0619, at-or-after with none is a forward read (D3). Nested type bodies, lambdas in initializers and comprehension bodies stop seeing class names bare, with a position phrase in SPY0200 (D4). A bare callee resolves by the walk a bare read uses (D5). A load-time read of a builtin name its module declares at or after the reader is SPY0619 (D6). A module or `@static` declaration with no initializer is the new SPY0620 (D7). The constant-position validator judges enum member values and interface and union hosts, answers a member access by what the member is, and admits a comparison chain link by link (D8). SPY0618 retires and T8 re-labels the rule table (D9). An alias to a missing type is SPY0202 at the alias (D10). The spec is rewritten around N1–N7; rows drain in the commit that turns them green. · **Today:** order decides (a function or initializer reading a later module variable is SPY0200); kind decides (a later `@static` yields to a module binding, a later literal `const` outranks it, a later computed `const` is SPY0618); a forward read is untyped (CS0029 behind SPY0908); a nested type's initializer ICEs (SPY0909); a parameter called as `x()` under a module `def x` calls the module's; constant positions leak CS0133 / CS1736; a declaration with no initializer reads `0`. Instruments: an 8951-cell pool with 2368 known-red rows, and a new 86-cell type with 33. · **Could not paraphrase:** none. Two sentences read two ways and are raised below (D4 "no enclosing type's symbol binds there"; D8 on a CLR static that is no literal). + +### Corrections Made +- None. The body is 20,479 of 20,480 bytes, and every correction found either grows it or is the author's judgment. Each is listed under Findings with its text, for the revision. A revision-log line `(NEEDS REVISION, Dimension 6)` costs bytes too. + +### Stage 0 checks (contract §11) +- **Path check:** `git merge-base origin/dev 8bd4b49fc` = e24aaf9f0; `git diff --name-only e24aaf9f0..8bd4b49fc -- ':!docs/process/plans/'` lists `build_tools/scorecard-baseline.json` and 12 files under `src/Sharpy.Compiler.Tests/Conformance/`. Not seeded (`scorecard_metrics.py` untouched). PASS. +- **Green @ a7fbd945d (measured):** both generated types, `ClassBodyReadPositionMatrixTests`, `StaticInitializerOrderMatrixTests`, `ConstantPositionValidator*`: 303/0/0, 8.5 min. Pool 8951 = `CellBudget`, python agreed 8951/8951, 2368 rows (1076 / 6 / 27 / 239 cite #2423 / #2398 / #2432 / #2397). New type: 86 cells, 33 red, 33 rows (23 / 10), python 18/18. `scorecard_metrics.py --check`: OK, seed 2368, outside 605. Table: 196 rows, 48 rules. CI on #2767 @ a7fbd945d: gate green, `review-line` red (no review line yet). +- **What the totality assertions catch.** `RuleTable_EveryCellHasOneRow_AndEveryRowACell`: a cell of the 8951 with no row or two rows; a cell whose generated tag or rule differs from its row's; a row no cell matches; a table value that is no enum name or (text axes) is carried by no cell; a rule a refusal can answer with no admitted-code entry. `RuleTable_EveryCaseHasOneRow_AndTakesItsVerdictFromIt`: the same for the 86, whose tag and rule come from the row. `Axes_EveryValueIsGeneratedOrExcluded`: each of `BindingKind` (twice) and `LocalTarget` is generated or carries a reason, and each `Scope*` value has a cell. +- **What they do not catch.** (1) For the 8951 cells the table is a second copy of the generator: `derive2.py` induced the 186 rows from the pool's own tags and rules, so a wrong arm in an `Expect*` function is in both and stays green; the only verdicts that differ from the base are the nine the owner ruled (compared with the drafter's base-run dump: 9 cells differ, the nine named). The table catches drift between the two from here on, nothing earlier. (2) 165 of the 196 rows carry a negated constraint (354 `!=`): a new enum value on such an axis is absorbed by a row nobody wrote for it; a negated constraint is a default arm. (3) No assertion reads `name-resolution.md`: 36 of the 48 rule ids do not occur in it (`grep -F`). (4) The axes one cell set fixes at a single value (under Adequacy) have no partition. +- **Mutations re-run, each from a `cp` copy, restored and confirmed by `cmp`:** + - table row L82 (an N2 row) deleted → `RuleTable_EveryCellHasOneRow…` red, 568 cells match no row (1 failed, 1 passed); + - the R-QI row deleted → both `RuleTable_Every…` facts red (4 cells no row; 47 rules, not 48) (2 failed); + - a dead row appended → both red, "no cell of any pool matches" (2 failed); + - generator arm `R1(b)` retagged `R-KG` (both admit SPY0200) → the 8951 fact red, cells differ from rows L127 / L128; and `ExcludedTypedReads[StaticProperty]` removed → `Axes_…` red, "neither generated nor excluded" (2 failed, 1 passed). `Axes_…` had no mutation in a commit body; this is its record; + - `read/alias-target/Declared/Used/Later` listed known-red → `ScopeMeaning_Sweep` red, STALE (1 failed, 3 passed); + - the R-QI row flipped to `MustRun` → `ScopeMeaning_Sweep` red on the four rows' lane (1 failed, 3 passed); + - `read/StaticField/StaticInitializer/Earlier/Bare/outer=ModuleVar` listed known-red → `NameResolutionDifferential_Sweep` red, STALE, allowlist 2369 (1 failed; 7.4 min); + - all restored → the two table facts and the new type's four tests 5/5 passed; `git status --short` empty. +- **Not re-run:** the 8951 sweep after the last restore (its green is the 303/0/0 above, at the same bytes by `cmp`). + +### Adequacy +- **Contract:** named — one answer per name for every binding kind, order, spelling and reading position; a refusal under one code where python's reading differs; a constant position refuses a non-constant itself. +- **Axes:** open. The 8951-cell pool's rosters are P77a's and were not re-graded. The new type carries the axes below as hand lists or single values, each with a value measured red today inside the plan's own contract (`sharpyc run`, each with its control): + - constant position ← `AdmissionTable`, the validator's own enumeration (the test pins 4 positions): a lambda default `lambda r: float = math.pi: r` is CS1736; `const TAU2: float = math.pi` is CS0133; + - constant expression kind ← the member kinds `IsMemberConstAdmissible` answers for (D8): `ScopeConstantKind` has a CLR literal and a `.spy` module variable; a CLR static property, `def f(n: int = sys.maxsize)`, is CS1736 and no cell asks; + - callee `outer` ← the `BindingKind` call and constructor classes the table defines: only `ModuleDef` and none; a parameter `x` called under a module `class x` is CS0029 (python `1`); + - alias declaration site ← the binder census (`ResolveTypeAliasDeclaration` at module and type-body level, `RegisterScopedTypeAlias` in a function), and alias target shape ← the type-annotation node kinds: `type K0 = nosuch`, unused, runs `1` in a function and in a class body, and `list[nosuch]`, `nosuch | None`, `(nosuch) -> int` run `1` at module level. T12 names `NameResolver.Declarations.cs` only; the function-scoped site is in `TypeChecker.Utilities.cs`; + - typed-read reader position ← `ReadPosition` (one value, a function body) and spelling ← `Spelling`: `b: bool = K` at module level above `const K = five()` is CS0029; `def r(p: bool = K)` above `const K = 5` is CS1750. The instance kinds are excluded for a reason ("no read from another declaration's initializer") that does not hold for the reader the set generates; + - R-QI host ← `TypeKind`, and value type: `struct S: @static t: int` reads `0`; module `s: str` reads `None`. + The finding is "close each against the enumeration named, or exclude it with its reason in the test and in the plan", answered by a new stage-0 commit; it is not "add these cells". +- **Cure:** seam + sweep — silent wrong behaviour, a position missing a shared check, SPY0908 as a net. +- **Harness:** named + allowlist delta (1076 + 6 + 27 seed rows, 33 new-type rows; counts re-measured). +- **Layer:** every decision rung-justified (D8's CLR literal is rung 3; no rule reads a builtin or type name). + +### Scope & convergence +- **Group:** one (P78; chores none; #2432 in by R-KV) · **Alone:** no — required? no (verdicts and diagnostics, no emitted layout) · **Gates:** 1 +- **Generator:** existing `NameResolutionDifferentialTests` + stage 0 @ 8bd4b49fc (`ScopeMeaningDifferentialTests`, the rule table), mutations re-run. Hand controls named: the project route (A3); steer text and count per position × host (`ClassBodyReadPositionMatrixTests`, R-KF). +- **Trackers named:** #2427, #2457, #2486, #2397, #2417, #2069, #2249, #2768 · **Fidelity rows:** named ("which programs run vs. are refused", "value of an expression"; both COMPARED). + +### Findings +Dimension 4 (design rows against the code; the author's revision): +- **D2 does not reach what A2 and A1 count.** Its two mechanisms are annotated module variables joining the const pre-pass, and an unannotated value checked on its first read. Of the 13 red `typed-read` cells, five are ANNOTATED members of a later type or an annotated module property (`StaticField`, `ClassLiteralConst`, `ClassComputedConst`, `StaticMethod`, `ModuleProperty` × `Annotated/Later`), which neither sentence names. And 16 of A1's 143 rows are no module variable: a later class's or struct's field through `x().v`, a later module property, alias or union, read in a comprehension, a lambda or a body (CS0266 / CS0149 / CS1503; SPY0224), filed under T1. +- **One A2 cell is not an order defect.** `read/typed-read/StaticField/Inferred/Earlier` is CS0029 with the declaration ABOVE its reader: a member-access read of an `auto` field is untyped at either order (`b: bool = H.x`, and `H().x` for an instance field; the bare `y: bool = x` is SPY0220; the annotated controls are SPY0220). The plan excludes `@static property` for exactly this reason (#2417) and keeps this cell under #2423. Current State's "at the earlier order SPY0220" is false for it, and so is the stage-0 body's "checked after its reader (11)". Either D2 names the cure (where the inferred type of a type-level field is recorded for a member access), or the cell is #2417's. +- **D4, "so no enclosing type's symbol binds there".** `ResolveName`'s crossing is variable-only: types, aliases, type parameters and functions bind through it. Read literally, the sentence refuses `class B: a: A | None = None` beside a nested `class A` (prints `True` today): `worked` → refused with no ruling. Bare `A()` there is CS1955, #2397's. +- **D1, "`ImportedStaticFacts.ImportedStorage` is deleted".** The function has three callers and a first arm (the declaration's own CodeGenInfo through `DeclarationRoot()`). The code's own note deletes the bridge ARM and `SemanticBinding`'s module-value map. +- **D8 is silent on a CLR static that is no literal** (the `sys.maxsize` value above): "false for a `@static` field, property or method" names Sharpy members. It should say false for every bound member that is no constant. + +Dimension 7: +- **The by-direction list is short.** Must-refuse cells that RUN today, from this pass's sweep: N2 334, `kind:instance-at-initializer` 250, N1-type-error 33, SPY0401 15, N2-module 8, N1-methods 6, R-KG 4. The plan names the N2, N2-module, R-QI and alias cells. Not named: R-KG's four (a nested type reading the enclosing type's `const` prints `1` / `7`) and N1-methods' six (a class member read in a comprehension element of a `@static` initializer prints its value); both are ruled, by N1 and R-KG. A8 records only new SPY0619, SPY0620 and SPY0202, so a corpus program newly SPY0200 under D4 or newly SPY0401 has no record. +- **R-QI's census did not read the spec.** `.spy` files: 0 real hits in 4565 (this pass's regex). Spec blocks: 22 candidate module-level `name: T` declarations with no initializer in five files (`function_types.md`, `type_annotation_shorthand.md`, `collection_types.md`, `properties.md`, `parameter_modifiers.md`); whether each block compiles today or carries a marker was not checked. The charter's "the spec … found no such declaration" does not hold as a grep. A11 names none of the five; each would be a touched file for R-BG. +- **D2's SPY0240 arm** (a read re-entering its own inference) has no acceptance bullet, cell, fixture or mutation; SPY0240 is `InvalidAutoVariable` today. +- **T8 does not name what it edits.** The 8951 pool is double-entry, so D9's re-labelling is the table's rows AND the generator's `Expect*` arms in one commit; the new type's R-QI cells admit no code (`Array.Empty()` in `NoInitializerCases`), so SPY0620 is red there as `wrong-code` until that line changes. T8 lists `DiagnosticCodes.cs`, the explanations and `AdmittedRefusals`. + +Dimensions 5 and 8: +- **#2487's close criterion is weaker than the issue.** Its text asks that the classifier READ its verdict from the table, that every rule id exist in `name-resolution.md`, that no arm be a default, and that the spec's verdict tables be generated from or asserted equal to it. Stage 0 gives a double-entry table for 8951 cells, 36 ids outside the doc and 165 rows with a negation; A11 adds a pointer. +- **Gate:** the plan says "the commit gate" and names no command; `/ci-gate` with its fallback, counts `@ sha (measured)` and a control at the base are `/implement-plan`'s (contract §6). + +Decisions that are the owner's (this pass asked nothing): +1. **The hand-listed axes above:** close each against its enumeration (a new stage-0 commit; the new red cells raise `allowlist_rows_outside_seed`, which item 1 of comment 7030074628 reads as covering), or rule an axis out with its reason. Recommended: close those with a measured red value; exclude the rest in the test. +2. **#2487:** (a) leave it open after P78 with the remainder listed; (b) finish it in P78 (rows written from the rules, the generator reading tag and rule from them: a large stage-0 commit); (c) close as planned and move the remainder to #2486. Recommended: (a). +3. **D9 at T8 or in stage 0.** In stage 0 (N2 admitting SPY0619 alone, named as waiting on #2423), 108 + 136 green cells of the two rules and 183 green N2 cells would be refused under a code their rule no longer admits: 427 reds with no row to hold them in that pool, or a `wrong-code` lane there and +427 seed rows, which item 1 did not approve. Recommended: keep it at T8, named as the T8 finding says. +4. **The `auto`-field cell:** in P78 under D2, or re-cited to #2417 (P30) as its `@static property` twin is. Recommended: by cause; if D2 does not record on the type's own field symbol, re-cite. + +### Falsifiability +- A1 / M1, A2 / M2, A3 / M3, A4 / M4 (and the census pin), A5 / M5 (four), A6 / M6 (two), A7 / M7 (with its control), A9 / M9 (three), A10 / M10, A13 / M13: mutation named; exemption not subject; positive control yes; by-direction specified except as found above. +- A8 (the direction record): too narrow by code, above. A11: each example "printing something else with its rule off" discriminates. A12 (`regen: no diff`): an absence assertion whose positive control is the staleness gates. +- Stage 0's facts and two sweeps: mutations re-run above. + +### Deferred findings +- (not CONVERGED: a first pass) + +### Warnings +- A1's, A4's, A5's and A6's row counts are measured (143; 96 + 46; 710 + 24; 30; 27 seeds; 1076 in all). Which decision drains which rule is the drafter's reading, and it fails for the rows named under D2. +- The 32 rows re-cited to #2397 are `NestedType` × `SelfDot` (R-LQ's `self.N()`) and `NestedType` × `Alias`; R-LQ's text names `self.N()` only, so the alias spelling rests on P16's contract. +- Two `.error` fixtures pin F1's text ("declared later than"); they become running programs under the retirement the charter records. +- `python3 -m pytest build_tools/tests -q` @ a7fbd945d: 2 failed, 2216 passed; both `test_check_review_line.py::test_real_lines_on_real_history[…]`, "no merge base", in a shallow clone. No control at the base was run. + +### Missing Steps Added +- None added to the body (the cap). For the revision: the gate command; A8 over every newly refused program whatever its code; T8's edit list; the five spec files; a fixture and a mutation for D2's SPY0240 arm. + +### Unchecked Claims +- "No snapshot moves" (A12): the charter's claim; the regeneration after T1 and T4 proves or refutes it. +- D5's "all 33 sites behind one resolver": the count is measured (33 call sites in `TypeChecker*.cs`); that one resolver can carry them, and which site resolves a type-name callee, were not traced. +- D1's cold and warm export identity and the bridge deletion: read from `ResolveOwnExportedSymbol` and `ModuleLoader.ExtractExportedSymbol`, not run. A value import across an import cycle is SPY0302, so no cycle cell exists. +- D2's first-read check under an in-progress mark: a design with no prototype. +- The nine re-tagged cells against the base: compared with the drafter's sweep dump at e24aaf9f0, not re-run at the base by this pass. +- Not run: the whole-solution gate (CI at a7fbd945d is green on #2767), `check_spec_blocks.sh`, any control at the base sha, the hand controls' own mutations. From 0c5446974b9322406b1afe0892f1d12b946cd104 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 13:47:40 +0000 Subject: [PATCH 09/22] test(conformance): P78 stage 0: close ScopeMeaning's seven axes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stage 0 of plan-777361 (P78; verification contract §11), answering the first /verify-plan pass (NEEDS REVISION, Dimension 6 @ a7fbd945d): the seven hand-listed or single-valued axes of ScopeMeaningDifferentialTests are each the image of a compiler enumeration, read by reflection, by a census, or from the 8951 pool, with an assertion that every value is generated or excluded with a reason. Test code and the scorecard baseline only; no product path. Axis <- source (ScopeMeaningDifferentialTests.Axes.cs): - constant position <- AdmissionTable (5 tables, 8 hosts, and the enum member's value, which has no table: a table added for it is red) - constant member kind <- a census of discovery's FieldSignature facts (IsConst x IsGuarded) over every value of every Stdlib module; each expression's kind is checked against what discovery records for it - callee outer <- BindingKind (30 generated, 4 excluded) - alias site <- ScopeKind x TypeKind, pinned to the 8951 pool's census of the two binder sites - alias target shape <- the public properties of TypeAlias, TypeAnnotation and FunctionType (10 shapes) - typed-read spelling, reader position, nesting <- Spelling, ReadPosition, Nesting as the 8951 pool runs a read of the kind (derived from its must-run cells; a placement it gains is red) - R-QI host <- TypeKind; declared type <- SemanticType's 19 subclasses - order <- Order, per cell set that has the axis An exclusion that rests on compiler behaviour has a probe that goes red when the behaviour changes (Exclusions_RestingOnTheCompiler_GoRedWhenItChanges, 6 probes): the module `let` refusal, a match subject that is a function value (CS8119), an interface's @static value (CS0120, #2383), enum and union bodies, a declaration that needs its value. The @static property typed-read exclusion is gone: the cells are generated. Cite by class (contract §10; #2423 comment 7039834146): a typed read that is red at the EARLIER order is no order defect, so it and its later twin cite #2417 (150 rows: an `auto` field or a @static property read through a receiver). read/typed-read/StaticField/Inferred/Earlier was re-measured @ 55846bb3f: `b: bool = H.x` is SPY0908 CS0029 with the declaration above its reader and below it. Rule table: +axis `admission` (AdmissionTable), +2 rows, +1 rule (SPY0425, an attribute argument's refusal): 198 rows, 49 rules. A `const` initializer handed a non-constant member must run (N4). Counts @ this commit: ScopeMeaningDifferentialTests 2225 cases (683 must-run, 1542 must-refuse; python agreed 30/30), 639 known-red rows: 463 cite #2423, 26 #2432, 150 #2417. By route: no-initializer 318/72 red, typed-read 1308/430, callee 120/40, constant-kind 51/26, init-overload 8/1, alias-target 420/70. NameResolutionDifferentialTests unchanged: 8951 cases, 2368 rows. Scorecard: allowlist_rows_outside_seed 605 -> 1211 (+606 = 639 - 33), by `scorecard_metrics.py --set-baseline allowlist_rows_outside_seed`. The owner's word is item 5 of #2423 comment 7039834146: "Close all seven (Recommended)", "this is the owner's word for the further allowlist_rows_outside_seed raise by the measured red count". Not raised: CellBudget, allowlist_rows_seed; no seed registration. Mutations (each from a cp copy, restored and confirmed by cmp): - totality: the SPY0425 row deleted -> both RuleTable_Every... facts red (4 cells match no row; 48 rules, not 49) (2 failed) - a passing case listed known-red (local/callee/Parameter/outer=None) -> ScopeMeaning_Sweep red, STALE (1 failed, 4 passed) - cite: a #2417 row re-cited to #2423 -> ScopeMeaning_Sweep red, "the row cites '#2423 ice' and the route says '#2417 ice'" (1 failed) - Axes_EveryValueIsGeneratedOrExcluded, one mutation per axis family, applied together, one failure line each (1 failed): constant position: the lambda table's hosts removed -> "constant-kind x host: LambdaParameterDefault is neither generated nor excluded"; member kind: sys.maxsize listed as a CLR literal -> "discovery records it (IsConst, IsGuarded) = (False, False)"; callee outer: ModuleEnum removed -> "neither generated nor excluded"; alias site: the struct body removed -> "alias-target x type body: Struct ..."; alias shape: ErrorType removed -> "TypeAnnotation. ErrorType ..."; typed-read: BaseList's exclusion removed and SelfDot dropped from the derivation -> one line each; R-QI: the struct host and TupleType removed -> one line each; order: the alias set's Self exclusion removed -> "alias-target x order: Self ..." - Exclusions_...: the module-let probe handed a program that compiles -> red, "rests on SPY0340, and the probe now gives [] stdout '1'" (1 failed) - all restored -> green. Runs @ 55846bb3f + this diff (product code == e24aaf9f0): ScopeMeaningDifferentialTests + RuleTable: 6/0/0 (1.7 min). Both generated types, ClassBodyReadPositionMatrixTests, StaticInitializerOrderMatrixTests, ConstantPositionValidator*: 304/0/0 (13.2 min). pytest build_tools/tests -k "scorecard or allowlist": 112 passed. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01LGMKZVcFYGqQRfHgd16DLa --- build_tools/scorecard-baseline.json | 2 +- .../NameResolutionDifferentialTests.Checks.cs | 4 +- ...meResolutionDifferentialTests.RuleTable.cs | 2 + .../ScopeMeaningDifferentialTests.Axes.cs | 743 ++++++++++++++++++ .../ScopeMeaningDifferentialTests.cs | 586 +++++++------- .../Conformance/name-resolution-rules.txt | 8 +- .../scope-meaning-differential-allowlist.txt | 668 +++++++++++++++- 7 files changed, 1680 insertions(+), 333 deletions(-) create mode 100644 src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Axes.cs diff --git a/build_tools/scorecard-baseline.json b/build_tools/scorecard-baseline.json index 4481c14bc..ac0de6096 100644 --- a/build_tools/scorecard-baseline.json +++ b/build_tools/scorecard-baseline.json @@ -1,6 +1,6 @@ { "procedure_bytes": 145560, "claude_md_bytes": 9304, - "allowlist_rows_outside_seed": 605, + "allowlist_rows_outside_seed": 1211, "allowlist_rows_seed": 2368 } diff --git a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Checks.cs b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Checks.cs index b55718ffd..028d6e23d 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Checks.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Checks.cs @@ -810,8 +810,8 @@ public void RuleTable_EveryCellHasOneRow_AndEveryRowACell() "a cell's tag and rule are its one row's, a row no cell matches rules nothing, and a refusal under a rule says which codes it admits"); // Measured literals: a table or a generator that stopped citing a rule would otherwise pass an emptier check. 44 rules of this - // pool, and the four only ScopeMeaningDifferentialTests has cells for (R-QI, N1-typed-read, N4, N1-alias-target). - RuleTable().Select(r => r.Rule).Distinct(StringComparer.Ordinal).Should().HaveCount(48); + // pool, and the five only ScopeMeaningDifferentialTests has cells for (R-QI, N1-typed-read, N4, SPY0425, N1-alias-target). + RuleTable().Select(r => r.Rule).Distinct(StringComparer.Ordinal).Should().HaveCount(49); // 29 rules with an entry, and the seeds', which carry their own codes. pool.Where(RefusalIsAnOutcome).Select(c => c.Rule).Distinct(StringComparer.Ordinal).Should().HaveCount(30); } diff --git a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.RuleTable.cs b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.RuleTable.cs index 6ba3506ac..93396b649 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.RuleTable.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.RuleTable.cs @@ -1,4 +1,5 @@ using System.Text.Json; +using Sharpy.Compiler.Semantic.Validation; using Sharpy.TestInfrastructure.Oracles; using Xunit; @@ -153,6 +154,7 @@ private static RuleAxis KeyAxis(string name) where T : struct, Enum KeyAxis("initializer"), KeyAxis("annotation"), KeyAxis("constantKind"), + KeyAxis("admission"), KeyAxis("aliasTarget"), KeyAxis("aliasUse"), KeyAxis("overloadCaller"), diff --git a/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Axes.cs b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Axes.cs new file mode 100644 index 000000000..060a3aca6 --- /dev/null +++ b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Axes.cs @@ -0,0 +1,743 @@ +using System.Reflection; +using Sharpy.Compiler.Discovery.Caching; +using Sharpy.Compiler.Semantic; +using Sharpy.Compiler.Semantic.Validation; +using Xunit; +using AstFunctionType = Sharpy.Compiler.Parser.Ast.FunctionType; +using AstTypeAlias = Sharpy.Compiler.Parser.Ast.TypeAlias; +using AstTypeAnnotation = Sharpy.Compiler.Parser.Ast.TypeAnnotation; +using Harness = Sharpy.Compiler.Tests.Conformance.NameResolutionDifferentialTests; +using ScopeKind = Sharpy.Compiler.Semantic.SymbolTable.ScopeKind; +using TypeKind = Sharpy.Compiler.Semantic.TypeKind; + +namespace Sharpy.Compiler.Tests.Conformance; + +/// +/// The axes of , each beside the enumeration it is the image of, with no +/// default arm: a value the enumeration gains has no entry, and is red +/// until it is generated or excluded with its reason. +/// +/// +/// no-initializer × hostTypeKind (Enum.GetValues) +/// no-initializer × declared typethe concrete subclasses of SemanticType (reflection) +/// typed-read × spelling, × reader positionSpelling and , as the +/// P77a pool runs a read of the kind (): the pool's own rosters decide where a read is legal +/// callee × outer (Enum.GetValues) +/// constant-kind × hostAdmissionTable, the validator's own enumeration of constant positions +/// constant-kind × member kinda census of what discovery records for every value of every +/// Stdlib module (FieldSignature.IsConst × IsGuarded), which is what a checker's answer for a bound module +/// member can rest on +/// alias-target × siteScopeKind × TypeKind: the scope an alias's binder declares into +/// alias-target × shapethe public properties of the alias's three AST records +/// (TypeAlias, TypeAnnotation, FunctionType): each place a target can hold a type's name +/// +/// +public sealed partial class ScopeMeaningDifferentialTests +{ + // ------------------------------------------------------------------------------------------- // + // Exclusions that rest on what the compiler does today + // ------------------------------------------------------------------------------------------- // + + /// A program and what the compiler does with it today. An exclusion whose reason is one of these keys is true + /// only while the probe holds: when the behaviour changes the probe is red, and the value is generated or re-reasoned. + internal sealed record BehaviourProbe(string Source, string Expected, Func Holds, bool Stdlib = false); + + private static bool Refused(Harness.SharpyRun run, string code, string? cs = null) + => run.ErrorCodes.Contains(code) && (cs == null || run.CsCode == cs); + + private const string TailMain = "def main() -> None:\n print(1)\n"; + + private const string ModuleLetRefused = "a module `let` is refused at every order (SPY0340, P21b)"; + private const string MatchSubjectIsNoValue = "`match one:` / `case x:` over a function value is SPY0908 CS8119 with no outer binding of the name: no callee verdict to compare"; + private const string InterfaceStaticIsNoStatic = "an interface's `@static` value member is SPY0908 CS0120 WITH its initializer (#2383's class): the host has no running control"; + private const string EnumBodyHoldsCases = "an enum body holds `NAME = value` cases and nothing else (SPY0101 / SPY0103)"; + private const string UnionBodyHoldsCases = "a union body holds cases and methods and nothing else (SPY0104)"; + + internal static readonly IReadOnlyDictionary BehaviourProbes = new Dictionary(StringComparer.Ordinal) + { + [ModuleLetRefused] = new("let x = 5\n" + TailMain, "SPY0340", r => Refused(r, "SPY0340")), + [MatchSubjectIsNoValue] = new("def one() -> int:\n return 1\ndef main() -> None:\n match one:\n case x:\n print(x())\n", + "SPY0908 CS8119", r => Refused(r, "SPY0908", "CS8119")), + [InterfaceStaticIsNoStatic] = new("interface H:\n @static\n x: int = 5\ndef main() -> None:\n print(H.x)\n", "SPY0908 CS0120", r => Refused(r, "SPY0908", "CS0120")), + [EnumBodyHoldsCases] = new("enum H:\n type K0 = int\n RED = 1\n" + TailMain, "SPY0103", r => Refused(r, "SPY0103") || Refused(r, "SPY0101")), + [UnionBodyHoldsCases] = new("union H:\n type K0 = int\n case A()\n" + TailMain, "SPY0104", r => Refused(r, "SPY0104")), + [NeedsItsValue] = new("const x: int\ndef main() -> None:\n let y: int\n print(1)\n", "SPY0104", r => r.ErrorCodes.Count(c => c == "SPY0104") == 2), + }; + + // ------------------------------------------------------------------------------------------- // + // no-initializer (R-QI): kind × initializer × host × declared type + // ------------------------------------------------------------------------------------------- // + + /// How a kind declares x with a type and no value ({T} the type, {L} a value of it), whether the + /// declaration sits in a type and how main reads it. : the statements that give it a value before + /// the read, for the kinds R-QI leaves alone. + internal sealed record Declared(string Text, bool InType, string Read, string? Accessor = null, string[]? Stored = null, bool Twin = false); + + private static readonly string[] StoredInInit = { "def __init__(self):", " self.x = {L}" }; + + internal static readonly IReadOnlyDictionary Declarations = new Dictionary + { + [BindingKind.ModuleVar] = new("x: {T}", false, "x", Twin: true), + [BindingKind.ModuleProperty] = new("property x: {T}", false, "x", Accessor: "property get x() -> {T}:\n return {L}"), + [BindingKind.StaticField] = new("@static\nx: {T}", true, "H.x", Twin: true), + [BindingKind.StaticProperty] = new("@static\nproperty x: {T}", true, "H.x", Accessor: "@static\nproperty get x() -> {T}:\n return {L}"), + [BindingKind.InstanceField] = new("x: {T}", true, "H().x", Stored: StoredInInit, Twin: true), + [BindingKind.InstanceProperty] = new("property x: {T}", true, "H().x", Accessor: "property get x(self) -> {T}:\n return {L}", Stored: StoredInInit), + [BindingKind.LocalVar] = new("x: {T}", false, "x", Stored: new[] { "x = {L}" }, Twin: true), + }; + + private const string NeedsItsValue = "the declaration's grammar takes a value: there is no spelling without one (SPY0104)"; + private const string NoValueSlot = "declares no storage with a type annotation, so it has no initializer to leave out"; + + internal static readonly IReadOnlyDictionary ExcludedDeclarations = new Dictionary + { + [BindingKind.ModuleLet] = ModuleLetRefused, + [BindingKind.ModuleLiteralConst] = NeedsItsValue, + [BindingKind.ModuleComputedConst] = NeedsItsValue, + [BindingKind.ClassLiteralConst] = NeedsItsValue, + [BindingKind.ClassComputedConst] = NeedsItsValue, + [BindingKind.LocalLet] = NeedsItsValue, + [BindingKind.LocalLiteralConst] = NeedsItsValue, + [BindingKind.LocalComputedConst] = NeedsItsValue, + [BindingKind.LambdaTypedLocal] = "a local `x: T` with another type: the LocalVar cell's `callable` type is its shape", + [BindingKind.ModuleDef] = NoValueSlot, + [BindingKind.ModuleClass] = NoValueSlot, + [BindingKind.ModuleStruct] = NoValueSlot, + [BindingKind.ModuleEnum] = NoValueSlot, + [BindingKind.ModuleUnion] = NoValueSlot, + [BindingKind.ModuleInterface] = NoValueSlot, + [BindingKind.ModuleTypeAlias] = NoValueSlot, + [BindingKind.StaticMethod] = NoValueSlot, + [BindingKind.NestedType] = NoValueSlot, + [BindingKind.InstanceMethod] = NoValueSlot, + [BindingKind.Constructor] = NoValueSlot, + [BindingKind.LocalDef] = NoValueSlot, + [BindingKind.EnclosingLocal] = "a local read from a nested function: the LocalVar cell's declaration", + [BindingKind.Parameter] = "a parameter's value is its argument", + [BindingKind.Inner] = "bound by its comprehension or lambda", + [BindingKind.Builtin] = "not declared by the program", + [BindingKind.ImportedName] = "not declared by the program", + [BindingKind.None] = "no binding", + }; + + /// The hosts of a member declaration, total over TypeKind with : the + /// keyword that opens the host's body. + internal static readonly IReadOnlyDictionary DeclarationHosts = new Dictionary + { + [TypeKind.Class] = new[] { "class" }, + [TypeKind.Struct] = new[] { "struct" }, + }; + + internal static readonly IReadOnlyDictionary ExcludedDeclarationHosts = new Dictionary + { + [TypeKind.Interface] = InterfaceStaticIsNoStatic, + [TypeKind.Enum] = EnumBodyHoldsCases, + [TypeKind.Union] = UnionBodyHoldsCases, + [TypeKind.Delegate] = "no Sharpy declaration: `() -> int` is an annotation, never a host", + }; + + /// A declared type: its label in a cell's id, its spelling, a value of it, how main shows that value as + /// 5 ({0} the read), the declarations it needs, and whether the value is one a constant position admits + /// (a literal, an enum member, a collection literal at a field: AdmissionTable.PerInstanceFieldDefault). + internal sealed record ValueType(string Label, string Spelling, string Literal, string Show, string? Prelude = null, bool Twin = false, bool Constant = false); + + /// The declared types, total over the concrete subclasses of SemanticType with . + /// What a missing initializer leaves behind differs by type (0, None, a default struct), and R-QI refuses all of them. + internal static readonly IReadOnlyDictionary ValueTypes = new Dictionary + { + [typeof(BuiltinType)] = new[] { new ValueType("int", "int", "5", "{0}", Twin: true, Constant: true), new ValueType("str", "str", "\"5\"", "{0}", Constant: true) }, + [typeof(GenericType)] = new[] { new ValueType("list", "list[int]", "[5]", "{0}[0]", Constant: true) }, + [typeof(UserDefinedType)] = new[] + { + new ValueType("class", "C0", "C0()", "{0}.v", "class C0:\n v: int = 5"), + new ValueType("struct", "S0", "S0()", "{0}.v", "struct S0:\n v: int = 5"), + new ValueType("enum", "E0", "E0.RED", "{0}.value", "enum E0:\n RED = 5", Constant: true), + }, + [typeof(OptionalType)] = new[] { new ValueType("optional", "int?", "Some(5)", "{0}.unwrap()") }, + [typeof(NullableType)] = new[] { new ValueType("nullable", "str | None", "\"5\"", "{0}", Constant: true) }, + [typeof(ResultType)] = new[] { new ValueType("result", "int !str", "Ok(5)", "{0}.unwrap()") }, + [typeof(Sharpy.Compiler.Semantic.FunctionType)] = new[] { new ValueType("callable", "() -> int", "lambda: 5", "{0}()") }, + [typeof(TupleType)] = new[] { new ValueType("tuple", "tuple[int, int]", "(5, 6)", "{0}[0]") }, + [typeof(LiteralStringType)] = new[] { new ValueType("literal-string", "LiteralString", "\"5\"", "{0}", Constant: true) }, + }; + + private const string NoAnnotationSpellsIt = "the checker's type of an expression: no annotation spells it, so no declaration has it"; + + internal static readonly IReadOnlyDictionary ExcludedValueTypes = new Dictionary + { + [typeof(UnknownType)] = NoAnnotationSpellsIt, + [typeof(VoidType)] = "`None` as a return type: no storage has it", + [typeof(ModuleType)] = NoAnnotationSpellsIt, + [typeof(GenericFunctionType)] = NoAnnotationSpellsIt, + [typeof(ConstructorReferenceType)] = NoAnnotationSpellsIt, + [typeof(UnmappedClrType)] = NoAnnotationSpellsIt, + [typeof(TypeParameterType)] = "needs a generic host: the 8951 pool's excluded axis (ii), InterfaceUnionEnumGenericHosts", + [typeof(SelfType)] = "`Self` is a member signature's spelling of its own type: a slot of it is the UserDefinedType cell", + [typeof(UnionType)] = "a placeholder record (its own doc comment): a declared `union` is a UserDefinedType, and only the symbol deserializer builds this one", + [typeof(TaskType)] = "the type the checker gives an `async def`'s return: a slot of it needs an awaited value, and async is outside N1 to N7", + }; + + // ------------------------------------------------------------------------------------------- // + // typed-read: kind × annotation × order × spelling × reader position + // ------------------------------------------------------------------------------------------- // + + internal enum MemberLevel + { + Module, + Type, + Instance, + } + + /// An int-valued declaration of x per kind, with its inferred spelling where the kind has one, its level and + /// the text that reads it after its receiver (x, or x() for a callable). + internal sealed record Typed(string Annotated, string? Inferred, MemberLevel Level, string Member, bool NeedsFive = false); + + internal static readonly IReadOnlyDictionary TypedReads = new Dictionary + { + [BindingKind.ModuleVar] = new("x: int = 5", "x: auto = 5", MemberLevel.Module, "x"), + [BindingKind.ModuleLiteralConst] = new("const x: int = 5", "const x = 5", MemberLevel.Module, "x"), + [BindingKind.ModuleComputedConst] = new("const x: int = five()", "const x = five()", MemberLevel.Module, "x", NeedsFive: true), + [BindingKind.ModuleProperty] = new("property x: int = 5", null, MemberLevel.Module, "x"), + [BindingKind.ModuleDef] = new("def x() -> int:\n return 5", null, MemberLevel.Module, "x()"), + [BindingKind.StaticField] = new("@static\nx: int = 5", "@static\nx: auto = 5", MemberLevel.Type, "x"), + [BindingKind.StaticProperty] = new("@static\nproperty x: int = 5", null, MemberLevel.Type, "x"), + [BindingKind.StaticMethod] = new("@static\ndef x() -> int:\n return 5", null, MemberLevel.Type, "x()"), + [BindingKind.ClassLiteralConst] = new("const x: int = 5", "const x = 5", MemberLevel.Type, "x"), + [BindingKind.ClassComputedConst] = new("const x: int = five()", "const x = five()", MemberLevel.Type, "x", NeedsFive: true), + [BindingKind.InstanceField] = new("x: int = 5", "x: auto = 5", MemberLevel.Instance, "x"), + [BindingKind.InstanceProperty] = new("property x: int = 5", null, MemberLevel.Instance, "x"), + [BindingKind.InstanceMethod] = new("def x(self) -> int:\n return 5", null, MemberLevel.Instance, "x()"), + }; + + private const string NotAnIntValue = "its read is no int value at a module or type level: the mismatch against bool is not a question of order"; + private const string ALocal = "a local: a read above it is R-KX's (P80)"; + + internal static readonly IReadOnlyDictionary ExcludedTypedReads = new Dictionary + { + [BindingKind.ModuleLet] = ModuleLetRefused, + [BindingKind.ModuleClass] = NotAnIntValue, + [BindingKind.ModuleStruct] = NotAnIntValue, + [BindingKind.ModuleEnum] = NotAnIntValue, + [BindingKind.ModuleUnion] = NotAnIntValue, + [BindingKind.ModuleInterface] = NotAnIntValue, + [BindingKind.ModuleTypeAlias] = NotAnIntValue, + [BindingKind.NestedType] = NotAnIntValue, + [BindingKind.Constructor] = NotAnIntValue, + [BindingKind.EnclosingLocal] = ALocal, + [BindingKind.Parameter] = ALocal, + [BindingKind.Inner] = ALocal, + [BindingKind.LocalVar] = ALocal, + [BindingKind.LocalLet] = ALocal, + [BindingKind.LocalLiteralConst] = ALocal, + [BindingKind.LocalComputedConst] = ALocal, + [BindingKind.LocalDef] = ALocal, + [BindingKind.LambdaTypedLocal] = ALocal, + [BindingKind.Builtin] = "not declared by the program", + [BindingKind.ImportedName] = "not declared by the program", + [BindingKind.None] = "no binding", + }; + + /// The spellings with no typed-read cell. Call is the 8951 pool's get(): a helper whose DECLARED return + /// type is what the reader sees, so the read itself sits in the helper's body, which is the function-body cell. + internal static readonly IReadOnlyDictionary ExcludedTypedSpellings = new Dictionary + { + [Harness.Spelling.Call] = "the reader sees the helper's declared return type; the read sits in the helper's body, which is the FunctionBody cell", + }; + + internal static readonly IReadOnlyDictionary ExcludedTypedPositions = new Dictionary + { + [ReadPosition.EnumMemberValue] = "an enum member's value has no annotated slot and admits no call: nothing takes the probe (its reads are constant-kind's and the 8951 pool's)", + [ReadPosition.TypeAliasTarget] = "holds a type's name: no value is read there", + [ReadPosition.BaseList] = "holds a type's name: no value is read there", + }; + + /// A reader of a kind: under which spelling, from which position and nesting, and whether it sits INSIDE the member's own type. + internal sealed record TypedReader(BindingKind Kind, Harness.Spelling Spelling, ReadPosition Position, Harness.Nesting Nesting, bool Inside); + + /// The positions a module-level reader is placed at; every other position is a member of a reader class. + internal static readonly IReadOnlySet ModulePlacedPositions = Enum.GetValues().Where(p => + { + try + { + Harness.PlaceAtModule(p, Harness.Nesting.Direct, "0"); + return true; + } + catch (ArgumentOutOfRangeException) + { + return false; + } + }).ToHashSet(); + + /// + /// Where a typed read of each kind is legal, READ from the 8951 pool: a (kind, spelling, position, nesting) is a reader exactly + /// when that pool spells a read of it that must run, declared before its reader, with no outer binding, in a class or at + /// module level (its sub-generators' routes are that pool's own axes). So the two axes are the images of Spelling and + /// under the pool's own rosters, and a position, nesting or spelling the pool gains for a kind is a + /// typed-read cell with no edit here. The pool places such a reader in the member's own type or outside every type; a third + /// placement has no host here and is , which the axes fact holds empty. One reader the pool + /// does not spell is added: an instance member read through its type's name is read off a constructed instance + /// (H().x, A().x), from wherever the pool reads a @static field through that name from outside its type. + /// + private static readonly Lazy<(IReadOnlyList Readers, IReadOnlyList Unplaced)> DerivedTypedReaders = new(() => + { + var readers = new HashSet(); + var unplaced = new List(); + foreach (var c in Harness.GeneratedCells()) + { + if (c.Family != Family.Read || c.Tag != SharpyTag.MustRun || c.Outer != BindingKind.None || c.Position is not { } position + || c.Key is not { Route: null } key || key.Part() is not { } spelling + || key.Part() != Harness.Order.Earlier || !TypedReads.ContainsKey(c.Target) + || ExcludedTypedSpellings.ContainsKey(spelling) || ExcludedTypedPositions.ContainsKey(position)) + continue; + if (c.Relation is not (null or DeclaringRelation.Self)) + unplaced.Add($"{c.Id} (relation {c.Relation})"); + else + readers.Add(new TypedReader(c.Target, spelling, position, key.Part() ?? Harness.Nesting.Direct, c.Relation == DeclaringRelation.Self)); + } + var instances = TypedReads.Where(t => t.Value.Level == MemberLevel.Instance).Select(t => t.Key).ToList(); + foreach (var r in readers.Where(r => r is { Kind: BindingKind.StaticField, Inside: false, Spelling: Harness.Spelling.Qualified or Harness.Spelling.Alias }).ToList()) + { + foreach (var instance in instances) + readers.Add(r with { Kind = instance }); + } + return (readers.OrderBy(r => r.Kind).ThenBy(r => r.Spelling).ThenBy(r => r.Position).ThenBy(r => r.Nesting).ThenBy(r => r.Inside).ToList(), unplaced); + }); + + internal static IReadOnlyList TypedReaders => DerivedTypedReaders.Value.Readers; + + /// The pool's spelled reads whose reader sits neither in the member's type nor outside every type. + internal static IReadOnlyList UnplacedTypedReaders => DerivedTypedReaders.Value.Unplaced; + + private const string AReadOfItself = "a declaration that reads itself, directly or through a ring, is N3-cycle's: refused or thrown whatever its slot's type (the 8951 pool's Self and Cycle cells)"; + private const string ARecursion = "a constructor that calls itself is a recursion, not an order of two declarations"; + private const string ARecursiveAlias = "an alias that names itself, directly or through a ring, has a target that is neither missing nor a declared type: a recursive alias is unruled (owner question raised with plan-777361's first revision)"; + + /// The orders with no cell, per cell set that has the axis: total over Order with the two every set generates. + internal static readonly IReadOnlyDictionary> ExcludedOrders = new Dictionary>(StringComparer.Ordinal) + { + ["typed-read"] = new Dictionary { [Harness.Order.Self] = AReadOfItself, [Harness.Order.Cycle] = AReadOfItself }, + ["init-overload"] = new Dictionary { [Harness.Order.Self] = ARecursion, [Harness.Order.Cycle] = ARecursion }, + ["alias-target"] = new Dictionary { [Harness.Order.Self] = ARecursiveAlias, [Harness.Order.Cycle] = ARecursiveAlias }, + }; + + // ------------------------------------------------------------------------------------------- // + // callee: binder × outer + // ------------------------------------------------------------------------------------------- // + + /// The statements that bind {n} to a function returning 1 and print its call, per binder. + internal static readonly IReadOnlyDictionary CalleeBinders = new Dictionary + { + [LocalTarget.For] = new[] { "for {n} in [one]:", " print({n}())" }, + [LocalTarget.Comprehension] = new[] { "print([{n}() for {n} in [one]][0])" }, + [LocalTarget.WithAs] = new[] { "with CM() as {n}:", " print({n}())" }, + }; + + internal static readonly IReadOnlyDictionary ExcludedCalleeBinders = new Dictionary + { + [LocalTarget.ExceptAs] = "binds an exception, which no call calls", + [LocalTarget.MatchCapture] = MatchSubjectIsNoValue, + [LocalTarget.AsPatternCapture] = MatchSubjectIsNoValue, + [LocalTarget.OutLet] = "binds an out argument: a function-typed out parameter is #2154's class", + }; + + /// Where an outer binding of the name sits against the binder: at module level (or nowhere, or the global scope), + /// as a member of the type whose method holds the binder, or as a local of the function whose nested def holds it. + internal enum OuterScope + { + Module, + Member, + Enclosing, + } + + /// An outer binding: the name both bindings share, its declaration, where it sits, whether python runs the same + /// program, and whether it imports the Stdlib. + internal sealed record OuterBinding(string Name, string Text, OuterScope Scope, bool Twin = false, bool Stdlib = false); + + /// The outer bindings of the callee, total over with : + /// every kind that can hold the name outside the binder's own scope. The outer's value is 12 and the binder's function + /// returns 1, so a call that reaches the outer binding prints something else or does not compile. + internal static readonly IReadOnlyDictionary CalleeOuters = new Dictionary + { + [BindingKind.None] = new("x", "", OuterScope.Module, Twin: true), + [BindingKind.ModuleVar] = new("x", "x: int = 12", OuterScope.Module, Twin: true), + [BindingKind.ModuleLiteralConst] = new("x", "const x: int = 12", OuterScope.Module), + [BindingKind.ModuleComputedConst] = new("x", "const x: int = twelve()", OuterScope.Module), + [BindingKind.ModuleProperty] = new("x", "property x: int = 12", OuterScope.Module), + [BindingKind.ModuleDef] = new("x", "def x() -> int:\n return 12", OuterScope.Module, Twin: true), + [BindingKind.ModuleClass] = new("x", "class x:\n v: int = 12", OuterScope.Module, Twin: true), + [BindingKind.ModuleStruct] = new("x", "struct x:\n v: int = 12", OuterScope.Module), + [BindingKind.ModuleEnum] = new("x", "enum x:\n RED = 12", OuterScope.Module), + [BindingKind.ModuleUnion] = new("x", "union x:\n case A(v: int)", OuterScope.Module), + [BindingKind.ModuleInterface] = new("x", "interface x:\n def m(self) -> int: ...", OuterScope.Module), + [BindingKind.ModuleTypeAlias] = new("x", "class Tgt:\n v: int = 12\ntype x = Tgt", OuterScope.Module), + [BindingKind.Builtin] = new("abs", "", OuterScope.Module, Twin: true), + [BindingKind.ImportedName] = new("floor", "from math import floor", OuterScope.Module, Stdlib: true), + [BindingKind.StaticField] = new("x", "@static\nx: int = 12", OuterScope.Member), + [BindingKind.StaticProperty] = new("x", "@static\nproperty x: int = 12", OuterScope.Member), + [BindingKind.StaticMethod] = new("x", "@static\ndef x() -> int:\n return 12", OuterScope.Member), + [BindingKind.ClassLiteralConst] = new("x", "const x: int = 12", OuterScope.Member), + [BindingKind.ClassComputedConst] = new("x", "const x: int = twelve()", OuterScope.Member), + [BindingKind.NestedType] = new("x", "class x:\n v: int = 12", OuterScope.Member), + [BindingKind.InstanceField] = new("x", "x: int = 12", OuterScope.Member), + [BindingKind.InstanceProperty] = new("x", "property x: int = 12", OuterScope.Member), + [BindingKind.InstanceMethod] = new("x", "def x(self) -> int:\n return 12", OuterScope.Member), + [BindingKind.EnclosingLocal] = new("x", "x: int = 12", OuterScope.Enclosing, Twin: true), + [BindingKind.Parameter] = new("x", "", OuterScope.Enclosing), + [BindingKind.LocalLet] = new("x", "let x = 12", OuterScope.Enclosing), + [BindingKind.LocalLiteralConst] = new("x", "const x: int = 12", OuterScope.Enclosing), + [BindingKind.LocalComputedConst] = new("x", "const x: int = twelve()", OuterScope.Enclosing), + [BindingKind.LocalDef] = new("x", "def x() -> int:\n return 12", OuterScope.Enclosing), + [BindingKind.LambdaTypedLocal] = new("x", "x: () -> int = lambda: 12", OuterScope.Enclosing), + }; + + internal static readonly IReadOnlyDictionary ExcludedCalleeOuters = new Dictionary + { + [BindingKind.ModuleLet] = ModuleLetRefused, + [BindingKind.Constructor] = "`__init__` is called through its type's name: the ModuleClass and NestedType cells", + [BindingKind.Inner] = "binds only inside its own lambda or comprehension, where no statement binder sits; a comprehension target over it is the same target", + [BindingKind.LocalVar] = "seen from the nested def that holds the binder it IS EnclosingLocal, which is generated; in the binder's own function it is S2's target reuse (P80)", + }; + + // ------------------------------------------------------------------------------------------- // + // constant-kind (#2432): host × kind + // ------------------------------------------------------------------------------------------- // + + /// A host of a constant position: its label, the program around {e} typed {T}, the code its refusal + /// carries, the 8951 pool's position where it has one, whether the program prints 1 and not the value, whether it + /// takes an int only, and whether python has the same position. + internal sealed record ConstantHost(string Label, string Program, string Refusal, ReadPosition? Position = null, bool PrintsOne = false, bool IntOnly = false, bool Twin = false); + + /// The constant positions, total over AdmissionTable with : every table the + /// validator judges a position by, each with the hosts that reach it. + internal static readonly IReadOnlyDictionary ConstantHosts = new Dictionary + { + [AdmissionTable.ParameterDefault] = new[] + { + new ConstantHost("def", $"def f(p: {{T}} = {{e}}) -> {{T}}:\n return p\n{Main} print(f())", "SPY0401", ReadPosition.ParameterDefault, Twin: true), + }, + [AdmissionTable.LambdaParameterDefault] = new[] + { + new ConstantHost("lambda", $"{Main} f = lambda p: {{T}} = {{e}}: p\n print(f())", "SPY0401"), + }, + [AdmissionTable.DecoratorArgument] = new[] + { + new ConstantHost("attribute", $"class H:\n @[system.component_model.default_value({{e}})]\n def f(self) -> int:\n return 1\n{Main} print(H().f())", "SPY0425", PrintsOne: true), + }, + [AdmissionTable.ConstInitializer] = new[] + { + new ConstantHost("module-const", $"const K: {{T}} = {{e}}\n{Main} print(K)", "SPY0401"), + new ConstantHost("class-const", $"class H:\n const K: {{T}} = {{e}}\n{Main} print(H.K)", "SPY0401", ReadPosition.ConstInitializer), + new ConstantHost("local-const", $"{Main} const K: {{T}} = {{e}}\n print(K)", "SPY0401"), + }, + [AdmissionTable.PerInstanceFieldDefault] = new[] + { + new ConstantHost("dataclass", $"@dataclass\nclass H:\n p: {{T}} = {{e}}\n{Main} print(H().p)", "SPY0401", ReadPosition.DataclassFieldInitializer, Twin: true), + new ConstantHost("struct", $"struct H:\n p: {{T}} = {{e}}\n{Main} print(H().p)", "SPY0401", ReadPosition.StructFieldInitializer, Twin: true), + }, + }; + + internal static readonly IReadOnlyDictionary ExcludedAdmissionTables = new Dictionary(); + + /// The one constant position the validator judges by no table: an enum member's value. A table value added for it + /// has no entry in , which is red until this host moves under it. + internal static readonly ConstantHost EnumMemberHost = new("enum-member", $"enum H:\n RED = {{e}}\n{Main} print(H.RED.value)", "SPY0401", ReadPosition.EnumMemberValue, IntOnly: true); + + /// The expression, its type, what it prints and what it imports. + internal sealed record ConstantExpression(string Label, string Text, string Type, string Prints, string? Import); + + internal static readonly IReadOnlyDictionary ConstantExpressions = new Dictionary + { + [ScopeConstantKind.ClrLiteralField] = new[] { new ConstantExpression("subprocess.PIPE", "subprocess.PIPE", "int", "-1", "subprocess") }, + [ScopeConstantKind.StdlibModuleVariable] = new[] + { + new ConstantExpression("socket.AF_INET", "socket.AF_INET", "int", "2", "socket"), + new ConstantExpression("math.pi", "math.pi", "float", "3.141592653589793", "math"), + }, + [ScopeConstantKind.ClrStaticMember] = new[] { new ConstantExpression("sys.maxsize", "sys.maxsize", "int", "2147483647", "sys") }, + [ScopeConstantKind.ComparisonChain] = new[] { new ConstantExpression("ordered", "1 < 2 < 3", "bool", "True", null) }, + [ScopeConstantKind.ChainWithNonConstantLink] = new[] { new ConstantExpression("membership", "0 < 2 in [1, 2]", "bool", "True", null) }, + }; + + /// What discovery records for a value of a referenced module, and the kind that is its image: the two facts of + /// FieldSignature a constant position's answer can read. + internal static readonly IReadOnlyDictionary<(bool IsConst, bool IsGuarded), ScopeConstantKind> ModuleValueShapes = new Dictionary<(bool, bool), ScopeConstantKind> + { + [(true, false)] = ScopeConstantKind.ClrLiteralField, + [(false, true)] = ScopeConstantKind.StdlibModuleVariable, + [(false, false)] = ScopeConstantKind.ClrStaticMember, + }; + + /// The shapes no value of the Stdlib has: the census holds each at 0. + internal static readonly IReadOnlyDictionary<(bool IsConst, bool IsGuarded), string> UnproducedModuleValueShapes = new Dictionary<(bool, bool), string> + { + [(true, true)] = "a literal has no storage to guard", + }; + + /// The kinds that are no member of a module: closed by call 45 (a chain is admitted when each link is). + internal static readonly IReadOnlySet ChainKinds = new HashSet { ScopeConstantKind.ComparisonChain, ScopeConstantKind.ChainWithNonConstantLink }; + + /// Every value of every module of the Stdlib, as discovery records it. + private static readonly Lazy> StdlibModuleValues = new(() => + { + var index = new OverloadIndexBuilder().BuildFromAssembly(SharpyStdlibReference.Assembly); + var values = new Dictionary(StringComparer.Ordinal); + foreach (var (module, overloads) in index.Modules) + { + foreach (var (name, field) in overloads.Fields) + values[$"{module}.{name}"] = (field.IsConst, field.IsGuarded); + } + return values; + }); + + // ------------------------------------------------------------------------------------------- // + // alias-target: site × shape × target × use × order + // ------------------------------------------------------------------------------------------- // + + /// A site an alias is declared at: the program around {alias} and {use}, the declaration that names the + /// alias {K} there, and what stands in its place when nothing does. + internal sealed record AliasSite(string Label, string Program, string Use, string NoUse); + + /// The sites, total over ScopeKind with : the scope the alias's binder declares + /// it into (ResolveTypeAliasDeclaration at module level and in a type body, RegisterScopedTypeAlias in a type + /// body, a function and a block). A type body is refined by . + internal static readonly IReadOnlyDictionary AliasSites = new Dictionary + { + [ScopeKind.Module] = new[] { new AliasSite("module", "{alias}\n{use}", "def f(k: {K}) -> int:\n return 1", "def f(k: int) -> int:\n return 1") }, + [ScopeKind.TypeBody] = Array.Empty(), + [ScopeKind.FunctionLike] = new[] + { + new AliasSite("function", "def g() -> int:\n {alias}\n{use}\n return 1", " def f(k: {K}) -> int:\n return 1", " def f(k: int) -> int:\n return 1"), + new AliasSite("method", "class H:\n def g(self) -> int:\n {alias}\n{use}\n return 1", " def f(k: {K}) -> int:\n return 1", " def f(k: int) -> int:\n return 1"), + }, + [ScopeKind.Block] = new[] + { + new AliasSite("block", "def g() -> int:\n if True:\n {alias}\n{use}\n return 1", " def f(k: {K}) -> int:\n return 1", " def f(k: int) -> int:\n return 1"), + }, + }; + + internal static readonly IReadOnlyDictionary ExcludedAliasScopes = new Dictionary + { + [ScopeKind.InitializerHost] = "the scope of an initializer EXPRESSION's own locals: a `type` statement is no expression", + [ScopeKind.Transparent] = "pushed to hold type parameters for one resolution step: it declares nothing a program writes", + }; + + /// The type bodies an alias is declared in, total over TypeKind with . + internal static readonly IReadOnlyDictionary AliasTypeHosts = new Dictionary + { + [TypeKind.Class] = new[] { new AliasSite("class", "class H:\n {alias}\n{use}", " def f(self, k: {K}) -> int:\n return 1", " def f(self, k: int) -> int:\n return 1") }, + [TypeKind.Struct] = new[] { new AliasSite("struct", "struct H:\n {alias}\n v: int = 1\n{use}", " def f(self, k: {K}) -> int:\n return 1", " def f(self, k: int) -> int:\n return 1") }, + [TypeKind.Interface] = new[] { new AliasSite("interface", "interface H:\n {alias}\n{use}", " def f(self, k: {K}) -> int: ...", " def f(self, k: int) -> int: ...") }, + }; + + internal static readonly IReadOnlyDictionary ExcludedAliasTypeHosts = new Dictionary + { + [TypeKind.Enum] = EnumBodyHoldsCases, + [TypeKind.Union] = UnionBodyHoldsCases, + [TypeKind.Delegate] = "no Sharpy declaration: `() -> int` is an annotation, never a host", + }; + + /// A target's shape: where in it the type's name {N} sits, whether the alias is generic, what it imports, and the + /// name of a type that exists there (C0, the program's own class, unless the shape qualifies the name). + internal sealed record AliasShape(string Label, string Target, bool Generic = false, string? Import = null, string Declared = "C0"); + + private static readonly AliasShape NameShape = new("name", "{N}"); + + /// The shapes, total over the public properties the alias's three AST records declare + /// (TypeAlias, TypeAnnotation, FunctionType) with : each property + /// that can hold, wrap or qualify a type's name is a shape, keyed Record.Property. + internal static readonly IReadOnlyDictionary AliasShapes = new Dictionary(StringComparer.Ordinal) + { + [$"TypeAlias.{nameof(AstTypeAlias.Type)}"] = NameShape, + [$"TypeAlias.{nameof(AstTypeAlias.TypeParameters)}"] = new("generic-alias", "list[{N}]", Generic: true), + [$"TypeAnnotation.{nameof(AstTypeAnnotation.Name)}"] = NameShape, + [$"TypeAnnotation.{nameof(AstTypeAnnotation.NameParts)}"] = new("dotted", "pathlib.{N}", Import: "pathlib", Declared: "Path"), + [$"TypeAnnotation.{nameof(AstTypeAnnotation.TypeArguments)}"] = new("type-argument", "list[{N}]"), + [$"TypeAnnotation.{nameof(AstTypeAnnotation.IsOptional)}"] = new("optional", "{N}?"), + [$"TypeAnnotation.{nameof(AstTypeAnnotation.IsCSharpNullable)}"] = new("nullable", "{N} | None"), + [$"TypeAnnotation.{nameof(AstTypeAnnotation.ErrorType)}"] = new("result-error", "int !{N}"), + [$"TypeAnnotation.{nameof(AstTypeAnnotation.TupleElementNames)}"] = new("tuple-element", "tuple[a: {N}, b: int]"), + [$"FunctionType.{nameof(AstFunctionType.ParameterTypes)}"] = new("callable-parameter", "({N}) -> int"), + [$"FunctionType.{nameof(AstFunctionType.ReturnType)}"] = new("callable-return", "() -> {N}"), + }; + + private const string TheAliasItself = "the alias's own name and where it stands: not its target"; + private const string SourceLocation = "a source location"; + private const string UnparserFact = "a syntax fact for the unparser and the structural comparer (the record's own remark): resolution does not read it"; + + internal static readonly IReadOnlyDictionary ExcludedAliasShapeProperties = new Dictionary(StringComparer.Ordinal) + { + [$"TypeAlias.{nameof(AstTypeAlias.Name)}"] = TheAliasItself, + [$"TypeAlias.{nameof(AstTypeAlias.NameLineStart)}"] = TheAliasItself, + [$"TypeAlias.{nameof(AstTypeAlias.NameColumnStart)}"] = TheAliasItself, + [$"TypeAlias.{nameof(AstTypeAlias.NameColumnEnd)}"] = TheAliasItself, + [$"TypeAlias.{nameof(AstTypeAlias.IsNameBacktickEscaped)}"] = TheAliasItself, + [$"TypeAlias.{nameof(AstTypeAlias.FunctionType)}"] = "refined by FunctionType's own properties", + [$"TypeAnnotation.{nameof(AstTypeAnnotation.IsNameBacktickEscaped)}"] = "the escape picks the namespace a spelling is looked up in: a missing name is missing in both, and the escaped lookup is #1325's", + [$"TypeAnnotation.{nameof(AstTypeAnnotation.BacktickEscapedParts)}"] = UnparserFact, + [$"TypeAnnotation.{nameof(AstTypeAnnotation.IsResult)}"] = "computed from ErrorType, which is a shape", + [$"TypeAnnotation.{nameof(AstTypeAnnotation.TupleElementNamesBacktickEscaped)}"] = UnparserFact, + [$"FunctionType.{nameof(AstFunctionType.LineStart)}"] = SourceLocation, + [$"FunctionType.{nameof(AstFunctionType.ColumnStart)}"] = SourceLocation, + [$"FunctionType.{nameof(AstFunctionType.LineEnd)}"] = SourceLocation, + [$"FunctionType.{nameof(AstFunctionType.ColumnEnd)}"] = SourceLocation, + [$"FunctionType.{nameof(AstFunctionType.Span)}"] = SourceLocation, + }; + + private static IEnumerable DeclaredProperties(Type record) + => record.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly).Select(p => $"{record.Name}.{p.Name}"); + + // ------------------------------------------------------------------------------------------- // + // The axes against their enumerations + // ------------------------------------------------------------------------------------------- // + + /// Each axis against its enumeration: a value is generated or carries its reason, never both, never neither; a + /// generated value has a cell; and an axis read from the pool or a census is the image it says it is. + internal static List AxisProblems(IReadOnlyList pool) + { + var problems = new List(); + + void Partition(string axis, IEnumerable universe, IEnumerable generated, IEnumerable excluded) where T : notnull + { + var g = generated.ToHashSet(); + var e = excluded.ToHashSet(); + var u = universe.ToHashSet(); + foreach (var value in u.OrderBy(v => v.ToString(), StringComparer.Ordinal)) + { + if (g.Contains(value) == e.Contains(value)) + problems.Add($"{axis}: {value} is {(g.Contains(value) ? "generated and excluded" : "neither generated nor excluded")}"); + } + foreach (var value in g.Concat(e).Where(v => !u.Contains(v)).Distinct()) + problems.Add($"{axis}: {value} is no value of the enumeration"); + } + + IEnumerable Route(string route) => pool.Where(c => c.Cell.Key!.Route == route); + + void Carried(string route, IEnumerable owed, Func> read) where T : notnull + { + var carried = Route(route).SelectMany(read).ToHashSet(); + foreach (var value in owed.Where(v => !carried.Contains(v))) + problems.Add($"{route}: no cell carries {value}"); + } + + IEnumerable Part(Case c) where T : struct, Enum => c.Cell.Key!.Part() is { } v ? new[] { v } : Array.Empty(); + IEnumerable Marks(Case c) => c.Cell.Key!.Marks; + + // no-initializer + Partition("no-initializer × kind", Enum.GetValues(), Declarations.Keys, ExcludedDeclarations.Keys); + Partition("no-initializer × host", Enum.GetValues(), DeclarationHosts.Keys, ExcludedDeclarationHosts.Keys); + Partition("no-initializer × declared type", typeof(SemanticType).Assembly.GetTypes().Where(t => t.IsSubclassOf(typeof(SemanticType)) && !t.IsAbstract), + ValueTypes.Keys, ExcludedValueTypes.Keys); + Carried("no-initializer", Declarations.Keys, c => new[] { c.Cell.Target }); + Carried("no-initializer", Enum.GetValues(), Part); + Carried("no-initializer", DeclarationHosts.Values.SelectMany(h => h).Concat(ValueTypes.Values.SelectMany(v => v).Select(v => v.Label)), Marks); + + // typed-read + Partition("typed-read × kind", Enum.GetValues(), TypedReads.Keys, ExcludedTypedReads.Keys); + Partition("typed-read × spelling", Enum.GetValues(), Route("typed-read").SelectMany(Part), ExcludedTypedSpellings.Keys); + Partition("typed-read × reader position", Enum.GetValues(), Route("typed-read").Select(c => c.Cell.Position!.Value), ExcludedTypedPositions.Keys); + Carried("typed-read", TypedReads.Keys, c => new[] { c.Cell.Target }); + Carried("typed-read", Enum.GetValues(), Part); + foreach (var unplaced in UnplacedTypedReaders.Take(10)) + problems.Add($"typed-read: the 8951 pool spells a read this set has no reader host for: {unplaced}"); + foreach (var (route, excluded) in ExcludedOrders) + Partition($"{route} × order", Enum.GetValues(), Route(route).SelectMany(Part), excluded.Keys); + foreach (var later in Route("typed-read").Where(c => c.Cell.Key!.Part() == Harness.Order.Later)) + { + if (!pool.Any(c => c.Cell.Id == EarlierTwinId(later.Cell))) + problems.Add($"typed-read: {later.Cell.Id} has no twin at the earlier order, which is what says whether its red is the order's"); + } + + // callee + Partition("callee × binder", Enum.GetValues(), CalleeBinders.Keys, ExcludedCalleeBinders.Keys); + Partition("callee × outer", Enum.GetValues(), CalleeOuters.Keys, ExcludedCalleeOuters.Keys); + Carried("callee", CalleeBinders.Keys, c => c.Cell.Construct is { } t ? new[] { t } : Array.Empty()); + Carried("callee", CalleeOuters.Keys, c => new[] { c.Cell.Outer }); + Carried("callee", new[] { BindingKind.Parameter }, c => new[] { c.Cell.Target }); + + // constant-kind + Partition("constant-kind × host", Enum.GetValues(), ConstantHosts.Keys, ExcludedAdmissionTables.Keys); + Carried("constant-kind", ConstantHosts.Keys, Part); + Carried("constant-kind", ConstantHosts.Values.SelectMany(h => h).Append(EnumMemberHost).Select(h => h.Label), Marks); + Carried("constant-kind", Enum.GetValues(), Part); + var census = StdlibModuleValues.Value; + Partition("constant-kind × member kind", census.Values.Distinct().Concat(UnproducedModuleValueShapes.Keys), ModuleValueShapes.Keys, UnproducedModuleValueShapes.Keys); + foreach (var shape in UnproducedModuleValueShapes.Keys.Where(s => census.Values.Contains(s))) + problems.Add($"constant-kind × member kind: {census.First(v => v.Value == shape).Key} is {shape}, which is listed as a shape no value has"); + Partition("constant-kind × kind", Enum.GetValues(), ModuleValueShapes.Values, ChainKinds); + foreach (var (kind, expressions) in ConstantExpressions) + { + foreach (var e in expressions) + { + if (ChainKinds.Contains(kind) != (e.Import == null)) + problems.Add($"constant-kind: {e.Label} is listed under {kind}, and a member kind is read off an imported module while a chain is not"); + else if (e.Import != null && !census.ContainsKey(e.Text)) + problems.Add($"constant-kind: discovery records no value {e.Text}"); + else if (e.Import != null && ModuleValueShapes.GetValueOrDefault(census[e.Text], kind) != kind) + problems.Add($"constant-kind: {e.Text} is listed under {kind}, and discovery records it (IsConst, IsGuarded) = {census[e.Text]}"); + } + } + foreach (var kind in Enum.GetValues().Where(k => !ConstantExpressions.ContainsKey(k))) + problems.Add($"constant-kind: {kind} has no expression"); + + // init-overload + Carried("init-overload", Enum.GetValues(), Part); + + // alias-target + Partition("alias-target × site", Enum.GetValues(), AliasSites.Keys, ExcludedAliasScopes.Keys); + Partition("alias-target × type body", Enum.GetValues(), AliasTypeHosts.Keys, ExcludedAliasTypeHosts.Keys); + Partition("alias-target × shape", new[] { typeof(AstTypeAlias), typeof(AstTypeAnnotation), typeof(AstFunctionType) }.SelectMany(DeclaredProperties), + AliasShapes.Keys, ExcludedAliasShapeProperties.Keys); + Carried("alias-target", AllAliasSites().Select(s => s.Label).Concat(AliasShapes.Values.Select(s => s.Label)), Marks); + Carried("alias-target", Enum.GetValues(), Part); + Carried("alias-target", Enum.GetValues(), Part); + // The two binders of an alias, by the 8951 pool's census of binder sites: a third is a site this axis has not placed. + var binders = NameResolutionRosters.BinderSites.Keys.Where(k => k.Contains("TypeAliasSymbol.CreateFrom", StringComparison.Ordinal)).OrderBy(k => k, StringComparer.Ordinal).ToList(); + if (!binders.SequenceEqual(AliasBinderSites.OrderBy(k => k, StringComparer.Ordinal))) + problems.Add($"alias-target × site: the binder census holds [{string.Join("; ", binders)}], and the sites were placed for [{string.Join("; ", AliasBinderSites)}]"); + + // An exclusion that rests on the compiler names its probe, and a probe has its exclusion. + var reasons = ExcludedDeclarations.Values.Concat(ExcludedDeclarationHosts.Values).Concat(ExcludedValueTypes.Values).Concat(ExcludedTypedReads.Values) + .Concat(ExcludedTypedSpellings.Values).Concat(ExcludedTypedPositions.Values).Concat(ExcludedCalleeBinders.Values).Concat(ExcludedCalleeOuters.Values) + .Concat(ExcludedAdmissionTables.Values).Concat(UnproducedModuleValueShapes.Values).Concat(ExcludedAliasScopes.Values).Concat(ExcludedAliasTypeHosts.Values) + .Concat(ExcludedAliasShapeProperties.Values).Concat(ExcludedOrders.Values.SelectMany(o => o.Values)).ToHashSet(StringComparer.Ordinal); + foreach (var orphan in BehaviourProbes.Keys.Where(k => !reasons.Contains(k))) + problems.Add($"a probe guards the reason '{orphan}', and no exclusion gives it"); + foreach (var blank in reasons.Where(string.IsNullOrWhiteSpace)) + problems.Add($"an exclusion gives no reason: '{blank}'"); + return problems; + } + + /// The binder sites the alias sites were placed for ('s summary). + internal static readonly string[] AliasBinderSites = + { + "NameResolver.Members.cs:ResolveTypeAliasDeclaration(TypeAliasSymbol.CreateFrom(typeAlias, _currentFilePath))", + "TypeChecker.Utilities.cs:RegisterScopedTypeAlias(TypeAliasSymbol.CreateFrom(typeAlias, _currentFilePath))", + }; + + internal static IEnumerable AllAliasSites() + => AliasSites.OrderBy(e => e.Key).SelectMany(e => e.Key == ScopeKind.TypeBody ? AliasTypeHosts.OrderBy(h => h.Key).SelectMany(h => h.Value) : e.Value); + + [Fact] + public void Axes_EveryValueIsGeneratedOrExcluded() + { + var problems = AxisProblems(GeneratedCases()); + Assert.True(problems.Count == 0, string.Join("\n", problems)); + } + + /// The falsifier of every exclusion that rests on compiler behaviour: its probe still does what the reason says. + [Fact] + public void Exclusions_RestingOnTheCompiler_GoRedWhenItChanges() + { + var problems = new List(); + foreach (var (reason, probe) in BehaviourProbes.OrderBy(e => e.Key, StringComparer.Ordinal)) + { + var run = RunSharpy(probe.Source, probe.Stdlib, SharpyExecTimeoutMs); + if (!probe.Holds(run)) + { + problems.Add($"'{reason}' rests on {probe.Expected}, and the probe now gives [{string.Join(",", run.ErrorCodes.Distinct())}{(run.CsCode != null ? " " + run.CsCode : "")}]" + + $"{(run.ErrorCodes.Count == 0 ? $" stdout '{Harness.Normalize(run.Stdout)}'" : "")}: generate the value, or give the exclusion its new reason"); + } + } + Assert.True(problems.Count == 0, string.Join("\n", problems)); + } +} diff --git a/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs index 5f9af85fe..128493ca3 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs @@ -2,6 +2,7 @@ using System.Text.Json; using System.Text.RegularExpressions; using Sharpy.Compiler.Diagnostics; +using Sharpy.Compiler.Semantic.Validation; using Sharpy.Compiler.Tests.Properties.Differential; using Sharpy.TestInfrastructure.Integration; using Sharpy.TestInfrastructure.Oracles; @@ -28,15 +29,21 @@ internal enum ScopeAnnotation } /// What a constant position is handed (#2432's expression-kind axis, the kinds the P77a pool has no cell -/// for; charter §3.20l calls 43 and 45). Closed by those two calls. +/// for; charter §3.20l calls 43 and 45). The three member kinds are the image of what discovery records for a value +/// of a referenced module (FieldSignature.IsConst × IsGuarded, +/// ); the two chains are closed by call 45. internal enum ScopeConstantKind { /// A constant of a referenced assembly: a CLR literal field read through a Stdlib module. ClrLiteralField, - /// A module variable of the .spy stdlib: no constant. + /// A module variable of the .spy stdlib, whose storage is guarded (N3): no constant. StdlibModuleVariable, + /// A static of a referenced assembly that is neither literal nor guarded (a static property, a static + /// readonly field): no constant. + ClrStaticMember, + /// A comparison chain whose every link is a constant. ComparisonChain, @@ -69,28 +76,35 @@ internal enum ScopeOverloadCaller } /// -/// Stage 0 of plan-777361 (P78; verification contract §11), the owner's ruling of 2026-11-20 (#2423 comment -/// 7030074628, item 1): the cells of rules N1, N2, N4 and N7 that the P77a pool +/// Stage 0 of plan-777361 (P78; verification contract §11), the owner's rulings of 2026-11-20 (#2423 comments +/// 7030074628 item 1 and 7039834146 item 5): the cells of rules N1, N2, N4 and N7 that the P77a pool /// () has no program for, as a generated test type of their own. A cell is /// a , and its tag and rule are READ from the rule table (name-resolution-rules.txt, #2487): /// the generator writes the program, what it prints when it runs and the codes a refusal may carry, and never a verdict. /// -/// Six cell sets, each over an enumeration or a set named closed, with every value generated or excluded with its reason -/// (): +/// Six cell sets. Every axis is the image of a compiler enumeration read by reflection, a census of the compiler's own +/// output, the P77a pool, or a set named closed; every value is generated or excluded with its reason +/// (), and an exclusion that rests on what the compiler does today +/// has a probe that goes red when it stops (). The +/// axes and their sources are in ScopeMeaningDifferentialTests.Axes.cs: /// -/// no-initializer (R-QI): × ; -/// typed-read: b: bool = <read>, × × order; -/// callee: a binder's name called under a module def of the name, and the parameter; -/// constant-kind (#2432): the constant positions of × ; +/// no-initializer (R-QI): × × host +/// (TypeKind) × declared type (SemanticType's subclasses); +/// typed-read: a read handed to a bool slot, × +/// × order × Spelling × , the last two as the P77a pool runs them; +/// callee: a binder's name called under an outer binding of the name, binder ( and +/// the parameter) × outer (); +/// constant-kind (#2432): host (AdmissionTable and the enum member's value) × ; /// init-overload: × order; -/// alias-target: × × order. +/// alias-target: declaration site (ScopeKind × TypeKind) × target shape (the properties of the +/// alias's AST records) × × × order. /// /// Known-red cells are rows of scope-meaning-differential-allowlist.txt (a missing file reads as empty), each citing /// the issue whose fix turns it green. A must-refuse cell refused under a code its cell does not admit is listed as /// with the lane wrong-code: the refusal is another rule's. /// [Trait("Category", "GapDiscovery")] -public sealed class ScopeMeaningDifferentialTests : IntegrationTestBase +public sealed partial class ScopeMeaningDifferentialTests : IntegrationTestBase { private const string AllowlistFileName = "scope-meaning-differential-allowlist.txt"; private const int SharpyExecTimeoutMs = 12_000; @@ -133,154 +147,91 @@ private static Case Draft(CellKey key, Family family, string source, string? mod }, twin); + private static string Indent(string text) => string.Join("\n", text.Split('\n').Select(l => " " + l)); + + private static string Lines(IEnumerable lines) => string.Join("\n", lines) + "\n"; + // ------------------------------------------------------------------------------------------- // // no-initializer (R-QI) // ------------------------------------------------------------------------------------------- // - /// How a kind declares x with a type and no value, where the declaration sits and how main reads it. - /// : the statements that give it a value before the read, for the kinds R-QI leaves alone. - internal sealed record Declared(string Text, bool InType, string Read, string? Accessor = null, string[]? Stored = null, bool Twin = false); - - internal static readonly IReadOnlyDictionary Declarations = new Dictionary - { - [BindingKind.ModuleVar] = new("x: int", false, "x", Twin: true), - [BindingKind.ModuleProperty] = new("property x: int", false, "x", Accessor: "property get x() -> int:\n return 5"), - [BindingKind.StaticField] = new("@static\nx: int", true, "H.x", Twin: true), - [BindingKind.StaticProperty] = new("@static\nproperty x: int", true, "H.x", Accessor: "@static\nproperty get x() -> int:\n return 5"), - [BindingKind.InstanceField] = new("x: int", true, "H().x", Stored: new[] { "def __init__(self):", " self.x = 5" }, Twin: true), - [BindingKind.InstanceProperty] = new("property x: int", true, "H().x", Accessor: "property get x(self) -> int:\n return 5", Stored: new[] { "def __init__(self):", " self.x = 5" }), - [BindingKind.LocalVar] = new("x: int", false, "x", Stored: new[] { "x = 5" }, Twin: true), - }; - - private const string NeedsItsValue = "the declaration's grammar takes a value: there is no spelling without one"; - private const string NoValueSlot = "declares no storage with a type annotation, so it has no initializer to leave out"; - - internal static readonly IReadOnlyDictionary ExcludedDeclarations = new Dictionary - { - [BindingKind.ModuleLet] = "a module `let` is refused at every order (SPY0340, P21b)", - [BindingKind.ModuleLiteralConst] = NeedsItsValue, - [BindingKind.ModuleComputedConst] = NeedsItsValue, - [BindingKind.ClassLiteralConst] = NeedsItsValue, - [BindingKind.ClassComputedConst] = NeedsItsValue, - [BindingKind.LocalLet] = NeedsItsValue, - [BindingKind.LocalLiteralConst] = NeedsItsValue, - [BindingKind.LocalComputedConst] = NeedsItsValue, - [BindingKind.LambdaTypedLocal] = "a local `x: T` with another type: the LocalVar cell is its shape", - [BindingKind.ModuleDef] = NoValueSlot, - [BindingKind.ModuleClass] = NoValueSlot, - [BindingKind.ModuleStruct] = NoValueSlot, - [BindingKind.ModuleEnum] = NoValueSlot, - [BindingKind.ModuleUnion] = NoValueSlot, - [BindingKind.ModuleInterface] = NoValueSlot, - [BindingKind.ModuleTypeAlias] = NoValueSlot, - [BindingKind.StaticMethod] = NoValueSlot, - [BindingKind.NestedType] = NoValueSlot, - [BindingKind.InstanceMethod] = NoValueSlot, - [BindingKind.Constructor] = NoValueSlot, - [BindingKind.LocalDef] = NoValueSlot, - [BindingKind.EnclosingLocal] = "a local read from a nested function: the LocalVar cell's declaration", - [BindingKind.Parameter] = "a parameter's value is its argument", - [BindingKind.Inner] = "bound by its comprehension or lambda", - [BindingKind.Builtin] = "not declared by the program", - [BindingKind.ImportedName] = "not declared by the program", - [BindingKind.None] = "no binding", - }; - - private static string Indent(string text) => string.Join("\n", text.Split('\n').Select(l => " " + l)); - private static IEnumerable NoInitializerCases() { foreach (var (kind, d) in Declarations.OrderBy(e => e.Key)) { - foreach (var initializer in Enum.GetValues()) + foreach (var host in d.InType ? DeclarationHosts.Values.SelectMany(h => h).ToArray() : new string?[] { null }) { - if (initializer == ScopeInitializer.AccessorBodies && d.Accessor == null) - continue; - string decl = initializer switch - { - ScopeInitializer.Present => d.Text + " = 5", - ScopeInitializer.Absent => d.Text, - _ => d.Accessor!, - }; - var lines = new List(); - if (kind == BindingKind.LocalVar) + foreach (var type in ValueTypes.OrderBy(e => e.Key.Name, StringComparer.Ordinal).SelectMany(e => e.Value)) { - lines.Add(Main.TrimEnd()); - lines.Add(Indent(decl)); - if (initializer == ScopeInitializer.Absent) - lines.AddRange(d.Stored!.Select(Indent)); - lines.Add($" print({d.Read})"); - } - else - { - if (d.InType) + foreach (var initializer in Enum.GetValues()) { - lines.Add("class H:"); - lines.Add(Indent(decl)); - if (initializer == ScopeInitializer.Absent && d.Stored != null) - lines.AddRange(d.Stored.Select(Indent)); + if (initializer == ScopeInitializer.AccessorBodies && d.Accessor == null) + continue; + // A struct's instance field initializer is a constant position (the 8951 pool's StructFieldInitializer): + // a declared type whose value is no constant has no initializer to write there. + if (initializer == ScopeInitializer.Present && kind == BindingKind.InstanceField && host == "struct" && !type.Constant) + continue; + string F(string text) => text.Replace("{T}", type.Spelling, StringComparison.Ordinal).Replace("{L}", type.Literal, StringComparison.Ordinal); + string decl = initializer switch + { + ScopeInitializer.Present => F(d.Text) + " = " + type.Literal, + ScopeInitializer.Absent => F(d.Text), + _ => F(d.Accessor!), + }; + var lines = new List(); + if (type.Prelude != null) + lines.Add(type.Prelude); + // The read lands in a local of the declared type before it is shown: a member of an untyped read is #2417's. + var print = $" v: {type.Spelling} = {d.Read}\n print({string.Format(System.Globalization.CultureInfo.InvariantCulture, type.Show, "v")})"; + if (kind == BindingKind.LocalVar) + { + lines.Add(Main.TrimEnd()); + lines.Add(Indent(decl)); + if (initializer == ScopeInitializer.Absent) + lines.AddRange(d.Stored!.Select(s => Indent(F(s)))); + lines.Add(print); + } + else + { + if (d.InType) + { + lines.Add($"{host} H:"); + lines.Add(Indent(decl)); + if (initializer == ScopeInitializer.Absent && d.Stored != null) + lines.AddRange(d.Stored.Select(s => Indent(F(s)))); + } + else + lines.Add(decl); + lines.Add(Main.TrimEnd()); + lines.Add(print); + } + // Read where R-QI refuses; the kinds it leaves alone store first, so every cell that runs prints the stored value. + bool twin = d.Twin && type.Twin && host is null or "class" + && (initializer == ScopeInitializer.Present || (initializer == ScopeInitializer.Absent && d.Stored != null)); + yield return Draft(Key("read", "no-initializer", kind, initializer, host, type.Label), Family.Read, Lines(lines), "5", + Array.Empty(), twin, target: kind); } - else - lines.Add(decl); - lines.Add(Main.TrimEnd()); - lines.Add($" print({d.Read})"); } - // Read where R-QI refuses; the kinds it leaves alone store first, so every cell that runs prints 5. - yield return Draft(Key("read", "no-initializer", kind, initializer), Family.Read, string.Join("\n", lines) + "\n", "5", - Array.Empty(), d.Twin && (initializer == ScopeInitializer.Present || (initializer == ScopeInitializer.Absent && d.Stored != null)), target: kind); } } } // ------------------------------------------------------------------------------------------- // - // typed-read: `b: bool = ` is the type mismatch at either order + // typed-read: a read handed to a bool slot is the type mismatch, whatever the order, spelling and position // ------------------------------------------------------------------------------------------- // - /// An int-valued declaration of x per kind, with its inferred spelling where the kind has one, and the read of it. - internal sealed record Typed(string Annotated, string? Inferred, bool InType, string Read, bool NeedsFive = false); - - internal static readonly IReadOnlyDictionary TypedReads = new Dictionary - { - [BindingKind.ModuleVar] = new("x: int = 5", "x: auto = 5", false, "x"), - [BindingKind.ModuleLiteralConst] = new("const x: int = 5", "const x = 5", false, "x"), - [BindingKind.ModuleComputedConst] = new("const x: int = five()", "const x = five()", false, "x", NeedsFive: true), - [BindingKind.ModuleProperty] = new("property x: int = 5", null, false, "x"), - [BindingKind.ModuleDef] = new("def x() -> int:\n return 5", null, false, "x()"), - [BindingKind.StaticField] = new("@static\nx: int = 5", "@static\nx: auto = 5", true, "H.x"), - [BindingKind.StaticMethod] = new("@static\ndef x() -> int:\n return 5", null, true, "H.x()"), - [BindingKind.ClassLiteralConst] = new("const x: int = 5", "const x = 5", true, "H.x"), - [BindingKind.ClassComputedConst] = new("const x: int = five()", "const x = five()", true, "H.x", NeedsFive: true), - }; + /// The probe: a function that takes a bool. Handed an int the checker has typed, the call is + /// SPY0220; handed a read it has not typed, it is C#'s CS1503 behind SPY0908 (measured @ 55846bb3f). + private const string Probe = "def nb(v: bool) -> int:\n return 1"; - private const string NotAnIntValue = "its read is no int value at a module or type level: the mismatch against bool is not a question of order"; + private const string Five = "def five() -> int:\n return 5"; - internal static readonly IReadOnlyDictionary ExcludedTypedReads = new Dictionary + /// The reader of a constant-only position: its slot is declared bool, since a call is no constant there. + private static string[] BoolSlot(ReadPosition p, string read) => p switch { - [BindingKind.ModuleLet] = "a module `let` is refused at every order (SPY0340, P21b)", - [BindingKind.ModuleClass] = NotAnIntValue, - [BindingKind.ModuleStruct] = NotAnIntValue, - [BindingKind.ModuleEnum] = NotAnIntValue, - [BindingKind.ModuleUnion] = NotAnIntValue, - [BindingKind.ModuleInterface] = NotAnIntValue, - [BindingKind.ModuleTypeAlias] = NotAnIntValue, - [BindingKind.NestedType] = NotAnIntValue, - [BindingKind.StaticProperty] = "read through its type's name it is untyped at either order: #2417's class, not a question of order (CS0029 at both, measured @ e5991c887)", - [BindingKind.InstanceField] = "an instance member has no read from another declaration's initializer (kind:SPY0290)", - [BindingKind.InstanceProperty] = "an instance member has no read from another declaration's initializer (kind:SPY0290)", - [BindingKind.InstanceMethod] = "an instance member has no read from another declaration's initializer (kind:SPY0290)", - [BindingKind.Constructor] = NotAnIntValue, - [BindingKind.EnclosingLocal] = "a local: a read above it is R-KX's (P80)", - [BindingKind.Parameter] = "a local: a read above it is R-KX's (P80)", - [BindingKind.Inner] = "a local: a read above it is R-KX's (P80)", - [BindingKind.LocalVar] = "a local: a read above it is R-KX's (P80)", - [BindingKind.LocalLet] = "a local: a read above it is R-KX's (P80)", - [BindingKind.LocalLiteralConst] = "a local: a read above it is R-KX's (P80)", - [BindingKind.LocalComputedConst] = "a local: a read above it is R-KX's (P80)", - [BindingKind.LocalDef] = "a local: a read above it is R-KX's (P80)", - [BindingKind.LambdaTypedLocal] = "a local: a read above it is R-KX's (P80)", - [BindingKind.Builtin] = "not declared by the program", - [BindingKind.ImportedName] = "not declared by the program", - [BindingKind.None] = "no binding", + ReadPosition.ParameterDefault => new[] { $"def r(self, p0: bool = {read}) -> int:", " return 1" }, + ReadPosition.DataclassFieldInitializer or ReadPosition.StructFieldInitializer => new[] { $"r: bool = {read}" }, + _ => throw new ArgumentOutOfRangeException(nameof(p), p, "not a constant-only position"), }; private static IEnumerable TypedReadCases() @@ -292,18 +243,68 @@ private static IEnumerable TypedReadCases() var text = annotation == ScopeAnnotation.Annotated ? t.Annotated : t.Inferred; if (text == null) continue; - foreach (var order in new[] { Harness.Order.Earlier, Harness.Order.Later }) + foreach (var reader in TypedReaders.Where(r => r.Kind == kind)) { - var target = t.InType ? "class H:\n" + Indent(text) : text; - // The reader is a function's local: a body resolves every module-level and type-level name, whatever the order. - var reader = "def r() -> int:\n b: bool = " + t.Read + "\n return 1"; - var lines = new List(); - if (t.NeedsFive) - lines.Add("def five() -> int:\n return 5"); - lines.AddRange(order == Harness.Order.Earlier ? new[] { target, reader } : new[] { reader, target }); - lines.Add(Main + " print(r())"); - yield return Draft(Key("read", "typed-read", kind, annotation, order), Family.Read, string.Join("\n", lines) + "\n", null, - new[] { "SPY0220" }, twin: false, target: kind, position: ReadPosition.FunctionBody); + foreach (var order in new[] { Harness.Order.Earlier, Harness.Order.Later }) + { + string receiver = reader.Spelling switch + { + Harness.Spelling.Bare => "", + Harness.Spelling.SelfDot => "self.", + Harness.Spelling.Alias => t.Level == MemberLevel.Instance ? "A()." : "A.", + Harness.Spelling.Qualified => t.Level == MemberLevel.Instance ? "H()." : "H.", + _ => throw new ArgumentOutOfRangeException(nameof(reader), reader.Spelling, "no receiver"), + }; + string read = receiver + t.Member; + bool constantOnly = Harness.IsConstantOnly(reader.Position); + string probed = constantOnly ? read : $"nb({read})"; + var prelude = new List { Probe }; + if (t.NeedsFive) + prelude.Add(Five); + var body = new List(); + if (reader.Inside) + { + // The reader is a sibling of the member, in the member's own type. + var members = constantOnly ? BoolSlot(reader.Position, probed) : Harness.PlaceInClass(reader.Position, reader.Nesting, probed).Members.ToArray(); + var member = text.Split('\n'); + body.Add(Harness.HostHeader(reader.Position)); + body.AddRange((order == Harness.Order.Earlier ? member.Concat(members) : members.Concat(member)).Select(l => " " + l)); + if (reader.Spelling == Harness.Spelling.Alias) + body.Add("type A = H"); + } + else + { + var target = new List(); + if (t.Level == MemberLevel.Module) + target.Add(text); + else + { + target.Add("class H:\n" + Indent(text)); + if (reader.Spelling == Harness.Spelling.Alias) + target.Add("type A = H"); + } + var host = new List(); + if (constantOnly) + { + host.Add(Harness.HostHeader(reader.Position).Replace("H:", "Rd:", StringComparison.Ordinal)); + host.AddRange(BoolSlot(reader.Position, probed).Select(l => " " + l)); + } + else if (ModulePlacedPositions.Contains(reader.Position)) + host.AddRange(Harness.PlaceAtModule(reader.Position, reader.Nesting, probed).Lines); + else + { + host.Add(Harness.HostHeader(reader.Position).Replace("H:", "Rd:", StringComparison.Ordinal)); + host.AddRange(Harness.PlaceInClass(reader.Position, reader.Nesting, probed).Members.Select(l => " " + l)); + } + body.AddRange(order == Harness.Order.Earlier ? target.Concat(host) : host.Concat(target)); + } + var lines = prelude.Concat(body).ToList(); + if (string.Join("\n", body).Contains("ap(lambda", StringComparison.Ordinal)) + lines.Insert(0, "def ap(f: () -> int) -> int:\n return f()"); + lines.Add(Main + " print(1)"); + yield return Draft(Key("read", "typed-read", kind, annotation, order, reader.Spelling, reader.Position, reader.Nesting), Family.Read, Lines(lines), null, + new[] { "SPY0220" }, twin: false, target: kind, position: reader.Position); + } } } } @@ -313,43 +314,63 @@ private static IEnumerable TypedReadCases() // callee: the innermost binding of a name is what a call of it calls // ------------------------------------------------------------------------------------------- // - /// The statements of main that bind x to a function returning 1 and print its call, per binder. - internal static readonly IReadOnlyDictionary CalleeBinders = new Dictionary - { - [LocalTarget.For] = new[] { "for x in [one]:", " print(x())" }, - [LocalTarget.Comprehension] = new[] { "print([x() for x in [one]][0])" }, - [LocalTarget.WithAs] = new[] { "with CM() as x:", " print(x())" }, - }; - - internal static readonly IReadOnlyDictionary ExcludedCalleeBinders = new Dictionary - { - [LocalTarget.ExceptAs] = "binds an exception, which no call calls", - [LocalTarget.MatchCapture] = "`match one:` / `case x:` over a function value is SPY0908 CS8119 with no module def of the name (measured @ e5991c887): no callee verdict", - [LocalTarget.AsPatternCapture] = "a capture of the same subject: the MatchCapture exclusion's shape", - [LocalTarget.OutLet] = "binds an out argument: a function-typed out parameter is #2154's class", - }; - private const string One = "def one() -> int:\n return 1"; + private const string Twelve = "def twelve() -> int:\n return 12"; private const string CalleeCm = "class CM:\n def __enter__(self) -> () -> int:\n return one\n def __exit__(self) -> None:\n pass"; private static IEnumerable CalleeCases() { - foreach (var outer in new[] { BindingKind.ModuleDef, BindingKind.None }) + foreach (var (outer, o) in CalleeOuters.OrderBy(e => e.Key)) { - var module = outer == BindingKind.ModuleDef ? new[] { "def x() -> int:\n return 12", One } : new[] { One }; - yield return Draft(Key("local", "callee", BindingKind.Parameter, $"outer={outer}"), Family.Local, - string.Join("\n", module.Append("def f(x: () -> int) -> int:\n return x()").Append(Main + " print(f(one))")) + "\n", - "1", Array.Empty(), twin: true, target: BindingKind.Parameter, outer: outer, position: ReadPosition.FunctionBody); - foreach (var (binder, stmts) in CalleeBinders.OrderBy(e => e.Key)) + // The binders: a parameter, which is no LocalTarget, and each construct target. + foreach (var binder in new object[] { BindingKind.Parameter }.Concat(CalleeBinders.Keys.OrderBy(k => k).Cast())) { - var lines = module.ToList(); - if (binder == LocalTarget.WithAs) + string n = o.Name; + bool parameter = binder is BindingKind; + // The statements that bind n to `one` and print its call; a parameter binder's function is declared below. + string[] stmts = parameter ? new[] { "print(f(one))" } : CalleeBinders[(LocalTarget)binder].Select(s => s.Replace("{n}", n, StringComparison.Ordinal)).ToArray(); + var lines = new List { One }; + if (o.Text.Contains("twelve()", StringComparison.Ordinal)) + lines.Add(Twelve); + if (binder is LocalTarget.WithAs) lines.Add(CalleeCm); - lines.Add(Main + string.Join("\n", stmts.Select(s => " " + s))); - yield return Draft(Key("local", "callee", binder, $"outer={outer}"), Family.Local, string.Join("\n", lines) + "\n", - "1", Array.Empty(), twin: binder is LocalTarget.For or LocalTarget.Comprehension, - target: binder == LocalTarget.Comprehension ? BindingKind.Inner : BindingKind.LocalVar, outer: outer, - position: ReadPosition.FunctionBody, construct: binder); + string call; + switch (o.Scope) + { + case OuterScope.Module: + if (o.Text.Length > 0) + lines.Insert(0, o.Text); + if (parameter) + lines.Add($"def f({n}: () -> int) -> int:\n return {n}()"); + lines.Add(Main + string.Join("\n", stmts.Select(s => " " + s))); + break; + case OuterScope.Member: + // The outer binding is a member of H, and the binder sits in a method of H. + lines.Add("class H:\n" + Indent(o.Text) + "\n" + + (parameter + ? $" def m(self, {n}: () -> int) -> int:\n return {n}()" + : " def m(self) -> None:\n" + string.Join("\n", stmts.Select(s => " " + s)))); + call = parameter ? "print(H().m(one))" : "H().m()"; + lines.Add(Main + " " + call); + break; + default: + // The outer binding is a local of the enclosing function, and the binder sits in a nested def. + string signature = outer == BindingKind.Parameter ? $"def outer0({n}: int) -> None:" : "def outer0() -> None:"; + var enclosing = new List { signature }; + if (outer != BindingKind.Parameter) + enclosing.Add(Indent(o.Text)); + enclosing.Add(parameter + ? $" def g({n}: () -> int) -> int:\n return {n}()\n print(g(one))" + : " def g() -> None:\n" + string.Join("\n", stmts.Select(s => " " + s)) + "\n g()"); + lines.Add(string.Join("\n", enclosing)); + lines.Add(Main + (outer == BindingKind.Parameter ? " outer0(12)" : " outer0()")); + break; + } + var construct = binder as LocalTarget?; + yield return Draft(Key("local", "callee", binder, $"outer={outer}"), Family.Local, Lines(lines), "1", Array.Empty(), + twin: o.Twin && binder is BindingKind or LocalTarget.For or LocalTarget.Comprehension, + target: parameter ? BindingKind.Parameter : construct == LocalTarget.Comprehension ? BindingKind.Inner : BindingKind.LocalVar, + outer: outer, position: ReadPosition.FunctionBody, construct: construct, stdlib: o.Stdlib); } } } @@ -358,48 +379,21 @@ private static IEnumerable CalleeCases() // constant-kind (#2432) // ------------------------------------------------------------------------------------------- // - /// The positions that take constants only: 's and the enum member's value. - internal static IReadOnlyList ConstantPositions => - Enum.GetValues().Where(p => Harness.IsConstantOnly(p) || p == ReadPosition.EnumMemberValue).ToList(); - - /// The expression, its type, what it prints and what it imports. - internal sealed record ConstantExpression(string Label, string Text, string Type, string Prints, string? Import); - - internal static readonly IReadOnlyDictionary ConstantExpressions = new Dictionary - { - [ScopeConstantKind.ClrLiteralField] = new[] { new ConstantExpression("subprocess.PIPE", "subprocess.PIPE", "int", "-1", "subprocess") }, - [ScopeConstantKind.StdlibModuleVariable] = new[] - { - new ConstantExpression("socket.AF_INET", "socket.AF_INET", "int", "2", "socket"), - new ConstantExpression("math.pi", "math.pi", "float", "3.141592653589793", "math"), - }, - [ScopeConstantKind.ComparisonChain] = new[] { new ConstantExpression("ordered", "1 < 2 < 3", "bool", "True", null) }, - [ScopeConstantKind.ChainWithNonConstantLink] = new[] { new ConstantExpression("membership", "0 < 2 in [1, 2]", "bool", "True", null) }, - }; - private static IEnumerable ConstantKindCases() { - foreach (var position in ConstantPositions) + foreach (var (table, host) in ConstantHosts.OrderBy(e => e.Key).SelectMany(e => e.Value.Select(h => ((AdmissionTable?)e.Key, h))).Append(((AdmissionTable?)null, EnumMemberHost))) { foreach (var (kind, expressions) in ConstantExpressions.OrderBy(e => e.Key)) { foreach (var e in expressions) { - // An enum member's value is an int: the other types have no cell there. - if (position == ReadPosition.EnumMemberValue && e.Type != "int") + if (host.IntOnly && e.Type != "int") continue; - string host = position switch - { - ReadPosition.ParameterDefault => $"def f(p: {e.Type} = {e.Text}) -> {e.Type}:\n return p\n{Main} print(f())", - ReadPosition.DataclassFieldInitializer => $"@dataclass\nclass H:\n p: {e.Type} = {e.Text}\n{Main} print(H().p)", - ReadPosition.StructFieldInitializer => $"struct H:\n p: {e.Type} = {e.Text}\n{Main} print(H().p)", - ReadPosition.EnumMemberValue => $"enum H:\n RED = {e.Text}\n{Main} print(H.RED.value)", - _ => throw new ArgumentOutOfRangeException(nameof(position), position, "not a constant position"), - }; - var source = (e.Import == null ? "" : $"import {e.Import}\n") + host + "\n"; - yield return Draft(Key("read", "constant-kind", position, kind, e.Label), Family.Read, source, e.Prints, - new[] { "SPY0401" }, twin: kind is ScopeConstantKind.ClrLiteralField or ScopeConstantKind.ComparisonChain && position != ReadPosition.EnumMemberValue, - position: position, stdlib: e.Import != null); + var source = (e.Import == null ? "" : $"import {e.Import}\n") + + host.Program.Replace("{T}", e.Type, StringComparison.Ordinal).Replace("{e}", e.Text, StringComparison.Ordinal) + "\n"; + yield return Draft(Key("read", "constant-kind", table, host.Label, kind, e.Label), Family.Read, source, host.PrintsOne ? "1" : e.Prints, + new[] { host.Refusal }, twin: host.Twin && kind is ScopeConstantKind.ClrLiteralField or ScopeConstantKind.ComparisonChain, + position: host.Position, stdlib: e.Import != null); } } } @@ -437,32 +431,43 @@ private static IEnumerable InitOverloadCases() } // ------------------------------------------------------------------------------------------- // - // alias-target: an alias names a type that exists, used or not + // alias-target: an alias names a type that exists, used or not, wherever it is declared and whatever its shape // ------------------------------------------------------------------------------------------- // + private const string AliasTargetClass = "class C0:\n v: int = 1"; + private static IEnumerable AliasTargetCases() { - foreach (var target in Enum.GetValues()) + foreach (var site in AllAliasSites()) { - foreach (var use in Enum.GetValues()) + foreach (var shape in AliasShapes.Values.DistinctBy(s => s.Label).OrderBy(s => s.Label, StringComparer.Ordinal)) { - foreach (var order in new[] { Harness.Order.Earlier, Harness.Order.Later }) + foreach (var target in Enum.GetValues()) { - // The order is the alias against its target's declaration: a missing target has none. - if (target == ScopeAliasTarget.Missing && order == Harness.Order.Later) - continue; - var alias = target == ScopeAliasTarget.Declared ? "type K0 = C0" : "type K0 = nosuch"; - var lines = new List(); - if (target == ScopeAliasTarget.Declared && order == Harness.Order.Earlier) - lines.Add("class C0:\n v: int = 1"); - lines.Add(alias); - if (target == ScopeAliasTarget.Declared && order == Harness.Order.Later) - lines.Add("class C0:\n v: int = 1"); - if (use == ScopeAliasUse.Used) - lines.Add("def f(k: K0) -> int:\n return 1"); - lines.Add(Main + " print(1)"); - yield return Draft(Key("read", "alias-target", target, use, order), Family.Read, string.Join("\n", lines) + "\n", "1", - new[] { "SPY0202" }, twin: false, target: BindingKind.ModuleTypeAlias, position: ReadPosition.TypeAliasTarget); + foreach (var use in Enum.GetValues()) + { + foreach (var order in new[] { Harness.Order.Earlier, Harness.Order.Later }) + { + // The order is the alias against its target's declaration: a missing target has none. + if (target == ScopeAliasTarget.Missing && order == Harness.Order.Later) + continue; + var alias = $"type K0{(shape.Generic ? "[T]" : "")} = " + shape.Target.Replace("{N}", target == ScopeAliasTarget.Declared ? shape.Declared : "nosuch", StringComparison.Ordinal); + var named = shape.Generic ? "K0[int]" : "K0"; + var lines = new List(); + if (shape.Import != null) + lines.Add($"import {shape.Import}"); + if (target == ScopeAliasTarget.Declared && order == Harness.Order.Earlier) + lines.Add(AliasTargetClass); + lines.Add(site.Program + .Replace("{alias}", alias, StringComparison.Ordinal) + .Replace("{use}", use == ScopeAliasUse.Used ? site.Use.Replace("{K}", named, StringComparison.Ordinal) : site.NoUse, StringComparison.Ordinal)); + if (target == ScopeAliasTarget.Declared && order == Harness.Order.Later) + lines.Add(AliasTargetClass); + lines.Add(Main + " print(1)"); + yield return Draft(Key("read", "alias-target", target, use, order, site.Label, shape.Label), Family.Read, Lines(lines), "1", + new[] { "SPY0202" }, twin: false, target: BindingKind.ModuleTypeAlias, position: ReadPosition.TypeAliasTarget, stdlib: shape.Import != null); + } + } } } } @@ -507,9 +512,11 @@ internal static List TotalityFailures(IReadOnlyList pool) failures.Add($"{c.Cell.Id}: its row says must-run and the generator gives it nothing to print"); if (c.Twin && c.Cell.Tag != SharpyTag.MustRun) failures.Add($"{c.Cell.Id}: a twin is python running the same program, and the cell does not run"); + if (c.Cell.Id.Any(char.IsWhiteSpace)) + failures.Add($"'{c.Cell.Id}': an id is one word, since an allowlist row is ` # `"); } failures.AddRange(Harness.RuleTableRowFailures(rows, Harness.RuleTablePools.SelectMany(p => p.Cells()).ToList())); - return failures; + return failures.Count > 60 ? failures.Take(60).Append($"… {failures.Count} failures in all").ToList() : failures; } [Fact] @@ -519,58 +526,13 @@ public void RuleTable_EveryCaseHasOneRow_AndTakesItsVerdictFromIt() Assert.True(failures.Count == 0, string.Join("\n", failures)); } - /// Each axis against its enumeration: a value is generated or carries its reason, never both, never neither. - [Fact] - public void Axes_EveryValueIsGeneratedOrExcluded() - { - var pool = GeneratedCases(); - var problems = new List(); - - void Partition(string axis, IEnumerable generated, IEnumerable excluded) where T : struct, Enum - { - var g = generated.ToHashSet(); - var e = excluded.ToHashSet(); - foreach (var value in Enum.GetValues()) - { - if (g.Contains(value) == e.Contains(value)) - problems.Add($"{axis}: {value} is {(g.Contains(value) ? "generated and excluded" : "neither generated nor excluded")}"); - } - } - - Partition("no-initializer", Declarations.Keys, ExcludedDeclarations.Keys); - Partition("typed-read", TypedReads.Keys, ExcludedTypedReads.Keys); - Partition("callee", CalleeBinders.Keys, ExcludedCalleeBinders.Keys); - - void Fed(string route, IEnumerable owed) where T : struct, Enum - { - var carried = pool.Where(c => c.Cell.Key!.Route == route).Select(c => c.Cell.Key!.Part()).ToHashSet(); - foreach (var value in owed.Where(v => !carried.Contains(v))) - problems.Add($"{route}: no cell carries {typeof(T).Name}.{value}"); - } - - Fed("no-initializer", Declarations.Keys); - Fed("no-initializer", Enum.GetValues()); - Fed("typed-read", TypedReads.Keys); - Fed("typed-read", Enum.GetValues()); - Fed("callee", CalleeBinders.Keys); - Fed("constant-kind", ConstantPositions); - Fed("constant-kind", Enum.GetValues()); - Fed("init-overload", Enum.GetValues()); - Fed("alias-target", Enum.GetValues()); - Fed("alias-target", Enum.GetValues()); - foreach (var kind in Enum.GetValues().Where(k => !ConstantExpressions.ContainsKey(k))) - problems.Add($"constant-kind: {kind} has no expression"); - - Assert.True(problems.Count == 0, string.Join("\n", problems)); - Assert.Equal(4, ConstantPositions.Count); - } - // ------------------------------------------------------------------------------------------- // // Judge, route, ratchet // ------------------------------------------------------------------------------------------- // /// The issue whose fix turns a red cell of a route green: #2432 for a constant position's verdict, #2423 for the rest - /// (R-QI's cells, the untyped forward read, the callee lookup, the alias refusal: charter §3.20l). + /// (R-QI's cells, the untyped forward read, the callee lookup, the alias refusal: charter §3.20l). A typed read that is + /// red at the EARLIER order is no order defect, and it and its later twin are #2417's (). internal static readonly IReadOnlyDictionary RouteIssues = new Dictionary(StringComparer.Ordinal) { ["no-initializer"] = "#2423", @@ -581,6 +543,9 @@ void Fed(string route, IEnumerable owed) where T : struct, Enum ["alias-target"] = "#2423", }; + /// The class of an untyped member-access read (#2417): typed at neither order. + internal const string UntypedAtEitherOrder = "#2417"; + internal sealed record Result(Case Case, Harness.SharpyRun Run, SharpyKind Kind, VerdictClass Class, bool WrongCode, string? PythonFailure); /// The harness's table, and one more red: a must-refuse cell refused under a code it does not admit. @@ -591,9 +556,21 @@ internal static (VerdictClass Class, bool WrongCode) Judge(NameCell cell, Sharpy return (wrongCode ? VerdictClass.FalseRefusal : verdict, wrongCode); } - internal static string ProposedCite(Result r) + /// The id of a typed-read cell's twin at the earlier order, or null for a cell that has none. + internal static string? EarlierTwinId(NameCell cell) + { + if (cell.Key is not { Route: "typed-read" } key || key.Part() is not { } order) + return null; + return order == Harness.Order.Earlier ? cell.Id : Key(key.Parts.Select(p => p is Harness.Order ? Harness.Order.Earlier : p).ToArray()).Text; + } + + /// The cite a red cell's row must carry. are the ids red in the same run: a typed read + /// whose earlier twin is red is untyped whatever the order, so declaring before reading does not cure it and it is #2417's. + internal static string ProposedCite(Result r, IReadOnlySet redIds) { var issue = RouteIssues.GetValueOrDefault(r.Case.Cell.Key!.Route ?? "", "UNROUTED"); + if (EarlierTwinId(r.Case.Cell) is { } earlier && redIds.Contains(earlier)) + issue = UntypedAtEitherOrder; string lane = r.WrongCode ? "wrong-code" : r.Class switch { VerdictClass.Ice => "ice", @@ -612,6 +589,7 @@ internal static string ProposedCite(Result r) internal static List RatchetFailures(IReadOnlyList results, IReadOnlyDictionary rows) { var failures = new List(); + var redIds = results.Where(r => IsRed(r.Class)).Select(r => r.Case.Cell.Id).ToHashSet(StringComparer.Ordinal); foreach (var r in results) { rows.TryGetValue(r.Case.Cell.Id, out var row); @@ -625,8 +603,8 @@ internal static List RatchetFailures(IReadOnlyList results, IRea failures.Add($"{r.Case.Cell.Id}: listed as {row.Class}, now {r.Class}: MOVED, update or delete the row"); else if (!IsRed(r.Class) && row != null) failures.Add($"{r.Case.Cell.Id}: listed as {row.Class}, now {r.Class}: STALE, delete the row"); - else if (IsRed(r.Class) && row!.Cite != ProposedCite(r)) - failures.Add($"{r.Case.Cell.Id}: the row cites '{row.Cite}' and the route says '{ProposedCite(r)}'"); + else if (IsRed(r.Class) && row!.Cite != ProposedCite(r, redIds)) + failures.Add($"{r.Case.Cell.Id}: the row cites '{row.Cite}' and the route says '{ProposedCite(r, redIds)}'"); } return failures; } @@ -645,10 +623,10 @@ protected override IEnumerable GetAdditionalReferenceAssemblyPaths() yield return SharpyStdlibReference.Location; } - private Harness.SharpyRun RunSharpy(NameCell cell, int timeoutMs) + private Harness.SharpyRun RunSharpy(string source, bool needsStdlib, int timeoutMs) { - _currentCellNeedsStdlib = cell.NeedsStdlib; - var r = CompileAndExecute(cell.Source, "scope_meaning.spy", executionTimeoutMs: timeoutMs); + _currentCellNeedsStdlib = needsStdlib; + var r = CompileAndExecute(source, "scope_meaning.spy", executionTimeoutMs: timeoutMs); var diagnostics = r.RawDiagnostics; var all = diagnostics.Select(d => d.Code).Where(c => c != null).Select(c => c!).ToList(); var errors = diagnostics.Where(d => d.Severity == CompilerDiagnosticSeverity.Error).Select(d => d.Code).Where(c => c != null).Select(c => c!).ToList(); @@ -694,9 +672,9 @@ public void ScopeMeaning_Sweep() if (python != c.Cell.Python) pythonFailure = $"the cell is modelled to print '{c.Cell.Model}' and python {python}"; } - var run = RunSharpy(c.Cell, SharpyExecTimeoutMs); + var run = RunSharpy(c.Cell.Source, c.Cell.NeedsStdlib, SharpyExecTimeoutMs); if (run.TimedOut) - run = RunSharpy(c.Cell, SharpyExecTimeoutMs * 2); + run = RunSharpy(c.Cell.Source, c.Cell.NeedsStdlib, SharpyExecTimeoutMs * 2); var kind = Harness.ClassifySharpy(run); var (cls, wrongCode) = Judge(c.Cell, kind, run); results.Add(new Result(c, run, kind, cls, wrongCode, pythonFailure)); @@ -710,6 +688,7 @@ public void ScopeMeaning_Sweep() wall.Stop(); var red = results.Where(r => IsRed(r.Class)).ToList(); + var redIds = red.Select(r => r.Case.Cell.Id).ToHashSet(StringComparer.Ordinal); var dir = ReportDirectory(); using (var writer = new StreamWriter(Path.Combine(dir, "scope-meaning-differential-cells.jsonl"))) { @@ -731,11 +710,12 @@ public void ScopeMeaning_Sweep() } File.WriteAllLines( Path.Combine(dir, "scope-meaning-differential-proposed-allowlist.txt"), - red.OrderBy(r => r.Case.Cell.Id, StringComparer.Ordinal).Select(r => $"{r.Case.Cell.Id} {r.Class} # {ProposedCite(r)}")); + red.OrderBy(r => r.Case.Cell.Id, StringComparer.Ordinal).Select(r => $"{r.Case.Cell.Id} {r.Class} # {ProposedCite(r, redIds)}")); var report = $"scope-meaning-differential: pool {pool.Count} ({pool.Count(c => c.Cell.Tag == SharpyTag.MustRun)} must-run, {pool.Count(c => c.Cell.Tag == SharpyTag.MustRefuse)} must-refuse), " + $"python agreed {results.Count(r => r.Case.Twin && r.PythonFailure == null)}/{pool.Count(c => c.Twin)}, red {red.Count}, allowlist {rows.Count}, wall {wall.Elapsed.TotalSeconds:F1}s. " - + string.Join(" ", results.GroupBy(r => r.Case.Cell.Key!.Route).Select(g => $"{g.Key}={g.Count()}/red {g.Count(r => IsRed(r.Class))}")); + + string.Join(" ", results.GroupBy(r => r.Case.Cell.Key!.Route).Select(g => $"{g.Key}={g.Count()}/red {g.Count(r => IsRed(r.Class))}")) + + " cites: " + string.Join(" ", rows.Values.GroupBy(r => r.Cite.Split(' ')[0]).OrderBy(g => g.Key, StringComparer.Ordinal).Select(g => $"{g.Key}={g.Count()}")); Output.WriteLine(report); Assert.True(failures.Count == 0, $"{failures.Count} failures. {report}\n{string.Join("\n", failures.Take(120))}"); } @@ -759,7 +739,8 @@ public void Ratchet_ARedCell_NeedsItsRow_AndARowNeedsItsRedCell() { var pool = GeneratedCases(); var running = pool.First(c => c.Cell.Tag == SharpyTag.MustRun && c.Cell.Key!.Route == "callee"); - var refusing = pool.First(c => c.Cell.Tag == SharpyTag.MustRefuse && c.Cell.Key!.Route == "typed-read"); + var later = pool.First(c => c.Cell.Tag == SharpyTag.MustRefuse && c.Cell.Key!.Route == "typed-read" && c.Cell.Key.Part() == Harness.Order.Later); + var earlier = pool.Single(c => c.Cell.Id == EarlierTwinId(later.Cell)); static Harness.SharpyRun Ran(string stdout) => new(true, 0, false, false, stdout, "", Array.Empty(), Array.Empty(), null); static Harness.SharpyRun Refused(string code) => new(false, null, false, false, "", "", new[] { code }, new[] { code }, null); Result Of(Case c, Harness.SharpyRun run, string? pythonFailure = null) @@ -768,22 +749,31 @@ Result Of(Case c, Harness.SharpyRun run, string? pythonFailure = null) var (cls, wrongCode) = Judge(c.Cell, kind, run); return new Result(c, run, kind, cls, wrongCode, pythonFailure); } - var none = new Dictionary(); - var listed = new Dictionary { [running.Cell.Id] = new(VerdictClass.SilentWrong, "#2423 silent-wrong") }; - var wrong = new Dictionary { [refusing.Cell.Id] = new(VerdictClass.FalseRefusal, "#2423 wrong-code") }; + static Dictionary Rows(params (Case Case, VerdictClass Class, string Cite)[] rows) + => rows.ToDictionary(r => r.Case.Cell.Id, r => new InitializerDependencyDifferentialTests.AllowRow(r.Class, r.Cite), StringComparer.Ordinal); + var none = Rows(); + var listed = Rows((running, VerdictClass.SilentWrong, "#2423 silent-wrong")); + var wrong = Rows((later, VerdictClass.FalseRefusal, "#2423 wrong-code")); Assert.Empty(RatchetFailures(new[] { Of(running, Ran("1")) }, none)); Assert.Empty(RatchetFailures(new[] { Of(running, Ran("12")) }, listed)); - Assert.Empty(RatchetFailures(new[] { Of(refusing, Refused("SPY0220")) }, none)); - Assert.Empty(RatchetFailures(new[] { Of(refusing, Refused("SPY0200")) }, wrong)); + Assert.Empty(RatchetFailures(new[] { Of(later, Refused("SPY0220")) }, none)); + Assert.Empty(RatchetFailures(new[] { Of(later, Refused("SPY0200")) }, wrong)); Assert.Contains("model", Assert.Single(RatchetFailures(new[] { Of(running, Ran("12")) }, none))); Assert.Contains("STALE", Assert.Single(RatchetFailures(new[] { Of(running, Ran("1")) }, listed))); Assert.Contains("MOVED", Assert.Single(RatchetFailures(new[] { Of(running, Refused("SPY0200")) }, listed))); - Assert.Contains("FalseRefusal", Assert.Single(RatchetFailures(new[] { Of(refusing, Refused("SPY0200")) }, none))); - Assert.Contains("STALE", Assert.Single(RatchetFailures(new[] { Of(refusing, Refused("SPY0220")) }, wrong))); - Assert.Contains("the route says", Assert.Single(RatchetFailures(new[] { Of(running, Ran("12")) }, - new Dictionary { [running.Cell.Id] = new(VerdictClass.SilentWrong, "#2432 silent-wrong") }))); + Assert.Contains("FalseRefusal", Assert.Single(RatchetFailures(new[] { Of(later, Refused("SPY0200")) }, none))); + Assert.Contains("STALE", Assert.Single(RatchetFailures(new[] { Of(later, Refused("SPY0220")) }, wrong))); + Assert.Contains("the route says", Assert.Single(RatchetFailures(new[] { Of(running, Ran("12")) }, Rows((running, VerdictClass.SilentWrong, "#2432 silent-wrong"))))); Assert.Contains("GeneratorBug", Assert.Single(RatchetFailures(new[] { Of(running, Ran("1"), "python 4") }, none))); + + // By class (contract §10): a typed read red at BOTH orders is no order defect, so both rows are #2417's; red at the + // later order alone it is #2423's, and a row citing the other issue is refused. + var both = new[] { Of(earlier, Refused("SPY0200")), Of(later, Refused("SPY0200")) }; + Assert.Empty(RatchetFailures(both, Rows((earlier, VerdictClass.FalseRefusal, "#2417 wrong-code"), (later, VerdictClass.FalseRefusal, "#2417 wrong-code")))); + Assert.Contains("the route says '#2417", Assert.Single(RatchetFailures(both, Rows((earlier, VerdictClass.FalseRefusal, "#2417 wrong-code"), (later, VerdictClass.FalseRefusal, "#2423 wrong-code"))))); + var laterOnly = new[] { Of(earlier, Refused("SPY0220")), Of(later, Refused("SPY0200")) }; + Assert.Contains("the route says '#2423", Assert.Single(RatchetFailures(laterOnly, Rows((later, VerdictClass.FalseRefusal, "#2417 wrong-code"))))); } } diff --git a/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt b/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt index 091e15f59..fc6c49488 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt +++ b/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt @@ -214,14 +214,18 @@ MustRun P52 family=TypeMember route=class,dataclass,enum,interface,struct,union * seed family=Seed route=- # --- ScopeMeaningDifferentialTests: the cells the P77a pool has no program for (hand-written; the test reads its -# --- verdicts from these rows and carries none) --- +# --- verdicts from these rows and carries none). A constant position's verdict is its table's (`admission`, the +# --- validator's AdmissionTable; `-` is the enum member's value, which has no table): a `const` initializer takes a +# --- non-constant and is then a computed constant (N4), and an attribute argument refuses under its own code. --- MustRefuse R-QI family=Read route=no-initializer initializer=Absent target=ModuleVar,ModuleProperty,StaticField,StaticProperty MustRun N1 family=Read route=no-initializer initializer=Absent target=InstanceField,InstanceProperty,LocalVar MustRun N1 family=Read route=no-initializer initializer=Present,AccessorBodies MustRefuse N1-typed-read family=Read route=typed-read MustRun N1-innermost family=Local route=callee MustRun N4 family=Read route=constant-kind constantKind=ClrLiteralField,ComparisonChain -MustRefuse SPY0401 family=Read route=constant-kind constantKind=StdlibModuleVariable,ChainWithNonConstantLink +MustRun N4 family=Read route=constant-kind admission=ConstInitializer constantKind=StdlibModuleVariable,ClrStaticMember,ChainWithNonConstantLink +MustRefuse SPY0401 family=Read route=constant-kind admission=ParameterDefault,LambdaParameterDefault,PerInstanceFieldDefault,- constantKind=StdlibModuleVariable,ClrStaticMember,ChainWithNonConstantLink +MustRefuse SPY0425 family=Read route=constant-kind admission=DecoratorArgument constantKind=StdlibModuleVariable,ClrStaticMember,ChainWithNonConstantLink MustRun N1 family=Read route=init-overload MustRefuse N1-alias-target family=Read route=alias-target aliasTarget=Missing MustRun N1 family=Read route=alias-target aliasTarget=Declared diff --git a/src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt b/src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt index a2d1ab3d2..32639cf24 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt +++ b/src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt @@ -1,37 +1,645 @@ # Known-red cells of ScopeMeaningDifferentialTests (stage 0 of plan-777361, P78; verification contract §11). # ` # # `: the issue is the one whose fix turns the -# cell green, by the cell's route (ScopeMeaningDifferentialTests.RouteIssues). A row whose cell passes fails the test -# until it is deleted. `wrong-code` is a must-refuse cell refused under a code its cell does not admit. +# cell green, by the cell's class (ScopeMeaningDifferentialTests.ProposedCite): its route's issue, except a typed read +# that is red at the EARLIER order too, which no order cures and is #2417's with its later twin. A row whose cell +# passes fails the test until it is deleted. `wrong-code` is a must-refuse cell refused under a code its cell does not +# admit. The sweep writes the rows it would list to .claude/tmp/scope-meaning-differential-proposed-allowlist.txt. +local/callee/Comprehension/outer=ImportedName Ice # #2423 ice +local/callee/Comprehension/outer=ModuleClass Ice # #2423 ice +local/callee/Comprehension/outer=ModuleComputedConst Ice # #2423 ice local/callee/Comprehension/outer=ModuleDef SilentWrong # #2423 silent-wrong +local/callee/Comprehension/outer=ModuleEnum Ice # #2423 ice +local/callee/Comprehension/outer=ModuleLiteralConst Ice # #2423 ice +local/callee/Comprehension/outer=ModuleProperty Ice # #2423 ice +local/callee/Comprehension/outer=ModuleStruct Ice # #2423 ice +local/callee/Comprehension/outer=ModuleUnion Ice # #2423 ice +local/callee/Comprehension/outer=ModuleVar Ice # #2423 ice +local/callee/For/outer=ImportedName Ice # #2423 ice +local/callee/For/outer=ModuleClass SilentWrong # #2423 silent-wrong +local/callee/For/outer=ModuleComputedConst Ice # #2423 ice local/callee/For/outer=ModuleDef SilentWrong # #2423 silent-wrong +local/callee/For/outer=ModuleEnum Ice # #2423 ice +local/callee/For/outer=ModuleLiteralConst Ice # #2423 ice +local/callee/For/outer=ModuleProperty Ice # #2423 ice +local/callee/For/outer=ModuleStruct SilentWrong # #2423 silent-wrong +local/callee/For/outer=ModuleUnion Ice # #2423 ice +local/callee/For/outer=ModuleVar Ice # #2423 ice +local/callee/Parameter/outer=ImportedName Ice # #2423 ice +local/callee/Parameter/outer=ModuleClass Ice # #2423 ice +local/callee/Parameter/outer=ModuleComputedConst Ice # #2423 ice local/callee/Parameter/outer=ModuleDef SilentWrong # #2423 silent-wrong +local/callee/Parameter/outer=ModuleEnum Ice # #2423 ice +local/callee/Parameter/outer=ModuleLiteralConst Ice # #2423 ice +local/callee/Parameter/outer=ModuleProperty Ice # #2423 ice +local/callee/Parameter/outer=ModuleStruct Ice # #2423 ice +local/callee/Parameter/outer=ModuleUnion Ice # #2423 ice +local/callee/Parameter/outer=ModuleVar Ice # #2423 ice +local/callee/WithAs/outer=ImportedName Ice # #2423 ice +local/callee/WithAs/outer=ModuleClass SilentWrong # #2423 silent-wrong +local/callee/WithAs/outer=ModuleComputedConst Ice # #2423 ice local/callee/WithAs/outer=ModuleDef SilentWrong # #2423 silent-wrong -read/alias-target/Missing/Unused/Earlier SilentWrong # #2423 missing-refusal -read/constant-kind/DataclassFieldInitializer/ComparisonChain/ordered FalseRefusal # #2432 false-refusal -read/constant-kind/DataclassFieldInitializer/StdlibModuleVariable/math.pi Ice # #2432 ice -read/constant-kind/DataclassFieldInitializer/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice -read/constant-kind/EnumMemberValue/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice -read/constant-kind/ParameterDefault/ComparisonChain/ordered FalseRefusal # #2432 false-refusal -read/constant-kind/ParameterDefault/StdlibModuleVariable/math.pi Ice # #2432 ice -read/constant-kind/ParameterDefault/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice -read/constant-kind/StructFieldInitializer/ComparisonChain/ordered FalseRefusal # #2432 false-refusal -read/constant-kind/StructFieldInitializer/StdlibModuleVariable/math.pi Ice # #2432 ice -read/constant-kind/StructFieldInitializer/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice +local/callee/WithAs/outer=ModuleEnum Ice # #2423 ice +local/callee/WithAs/outer=ModuleLiteralConst Ice # #2423 ice +local/callee/WithAs/outer=ModuleProperty Ice # #2423 ice +local/callee/WithAs/outer=ModuleStruct SilentWrong # #2423 silent-wrong +local/callee/WithAs/outer=ModuleUnion Ice # #2423 ice +local/callee/WithAs/outer=ModuleVar Ice # #2423 ice +read/alias-target/Missing/Unused/Earlier/block/callable-parameter SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/block/callable-return SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/block/dotted SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/block/generic-alias SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/block/name SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/block/nullable SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/block/optional SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/block/result-error SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/block/tuple-element SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/block/type-argument SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/class/callable-parameter SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/class/callable-return SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/class/dotted SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/class/generic-alias SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/class/name SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/class/nullable SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/class/optional SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/class/result-error SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/class/tuple-element SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/class/type-argument SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/function/callable-parameter SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/function/callable-return SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/function/dotted SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/function/generic-alias SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/function/name SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/function/nullable SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/function/optional SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/function/result-error SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/function/tuple-element SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/function/type-argument SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/interface/callable-parameter SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/interface/callable-return SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/interface/dotted SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/interface/generic-alias SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/interface/name SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/interface/nullable SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/interface/optional SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/interface/result-error SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/interface/tuple-element SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/interface/type-argument SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/method/callable-parameter SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/method/callable-return SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/method/dotted SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/method/generic-alias SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/method/name SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/method/nullable SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/method/optional SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/method/result-error SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/method/tuple-element SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/method/type-argument SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/module/callable-parameter SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/module/callable-return SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/module/dotted SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/module/generic-alias SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/module/name SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/module/nullable SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/module/optional SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/module/result-error SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/module/tuple-element SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/module/type-argument SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/struct/callable-parameter SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/struct/callable-return SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/struct/dotted SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/struct/generic-alias SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/struct/name SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/struct/nullable SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/struct/optional SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/struct/result-error SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/struct/tuple-element SilentWrong # #2423 missing-refusal +read/alias-target/Missing/Unused/Earlier/struct/type-argument SilentWrong # #2423 missing-refusal +read/constant-kind/ConstInitializer/class-const/StdlibModuleVariable/math.pi Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/StdlibModuleVariable/math.pi Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/StdlibModuleVariable/math.pi Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrLiteralField/subprocess.PIPE Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrStaticMember/sys.maxsize Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ComparisonChain/ordered FalseRefusal # #2432 false-refusal +read/constant-kind/DecoratorArgument/attribute/StdlibModuleVariable/math.pi Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrStaticMember/sys.maxsize Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ComparisonChain/ordered FalseRefusal # #2432 false-refusal +read/constant-kind/LambdaParameterDefault/lambda/StdlibModuleVariable/math.pi Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrStaticMember/sys.maxsize Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ComparisonChain/ordered FalseRefusal # #2432 false-refusal +read/constant-kind/ParameterDefault/def/StdlibModuleVariable/math.pi Ice # #2432 ice +read/constant-kind/ParameterDefault/def/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrStaticMember/sys.maxsize Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ComparisonChain/ordered FalseRefusal # #2432 false-refusal +read/constant-kind/PerInstanceFieldDefault/dataclass/StdlibModuleVariable/math.pi Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrStaticMember/sys.maxsize Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ComparisonChain/ordered FalseRefusal # #2432 false-refusal +read/constant-kind/PerInstanceFieldDefault/struct/StdlibModuleVariable/math.pi Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice +read/constant-kind/enum-member/ClrStaticMember/sys.maxsize Ice # #2432 ice +read/constant-kind/enum-member/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice read/init-overload/InitDelegation/Later FalseRefusal # #2423 false-refusal -read/no-initializer/ModuleProperty/Absent SilentWrong # #2423 missing-refusal -read/no-initializer/ModuleVar/Absent SilentWrong # #2423 missing-refusal -read/no-initializer/StaticField/Absent SilentWrong # #2423 missing-refusal -read/no-initializer/StaticProperty/Absent SilentWrong # #2423 missing-refusal -read/typed-read/ClassComputedConst/Annotated/Later Ice # #2423 ice -read/typed-read/ClassComputedConst/Inferred/Later Ice # #2423 ice -read/typed-read/ClassLiteralConst/Annotated/Later Ice # #2423 ice -read/typed-read/ClassLiteralConst/Inferred/Later Ice # #2423 ice -read/typed-read/ModuleComputedConst/Inferred/Later Ice # #2423 ice -read/typed-read/ModuleLiteralConst/Inferred/Later Ice # #2423 ice -read/typed-read/ModuleProperty/Annotated/Later Ice # #2423 ice -read/typed-read/ModuleVar/Annotated/Later FalseRefusal # #2423 wrong-code -read/typed-read/ModuleVar/Inferred/Later FalseRefusal # #2423 wrong-code -read/typed-read/StaticField/Annotated/Later Ice # #2423 ice -read/typed-read/StaticField/Inferred/Earlier Ice # #2423 ice -read/typed-read/StaticField/Inferred/Later Ice # #2423 ice -read/typed-read/StaticMethod/Annotated/Later Ice # #2423 ice +read/no-initializer/ModuleProperty/Absent/callable RuntimeThrow # #2423 runtime-throw +read/no-initializer/ModuleProperty/Absent/class RuntimeThrow # #2423 runtime-throw +read/no-initializer/ModuleProperty/Absent/enum SilentWrong # #2423 missing-refusal +read/no-initializer/ModuleProperty/Absent/int SilentWrong # #2423 missing-refusal +read/no-initializer/ModuleProperty/Absent/list RuntimeThrow # #2423 runtime-throw +read/no-initializer/ModuleProperty/Absent/literal-string SilentWrong # #2423 missing-refusal +read/no-initializer/ModuleProperty/Absent/nullable SilentWrong # #2423 missing-refusal +read/no-initializer/ModuleProperty/Absent/optional RuntimeThrow # #2423 runtime-throw +read/no-initializer/ModuleProperty/Absent/result RuntimeThrow # #2423 runtime-throw +read/no-initializer/ModuleProperty/Absent/str SilentWrong # #2423 missing-refusal +read/no-initializer/ModuleProperty/Absent/struct SilentWrong # #2423 missing-refusal +read/no-initializer/ModuleProperty/Absent/tuple SilentWrong # #2423 missing-refusal +read/no-initializer/ModuleVar/Absent/callable RuntimeThrow # #2423 runtime-throw +read/no-initializer/ModuleVar/Absent/class RuntimeThrow # #2423 runtime-throw +read/no-initializer/ModuleVar/Absent/enum SilentWrong # #2423 missing-refusal +read/no-initializer/ModuleVar/Absent/int SilentWrong # #2423 missing-refusal +read/no-initializer/ModuleVar/Absent/list RuntimeThrow # #2423 runtime-throw +read/no-initializer/ModuleVar/Absent/literal-string SilentWrong # #2423 missing-refusal +read/no-initializer/ModuleVar/Absent/nullable SilentWrong # #2423 missing-refusal +read/no-initializer/ModuleVar/Absent/optional RuntimeThrow # #2423 runtime-throw +read/no-initializer/ModuleVar/Absent/result RuntimeThrow # #2423 runtime-throw +read/no-initializer/ModuleVar/Absent/str SilentWrong # #2423 missing-refusal +read/no-initializer/ModuleVar/Absent/struct SilentWrong # #2423 missing-refusal +read/no-initializer/ModuleVar/Absent/tuple SilentWrong # #2423 missing-refusal +read/no-initializer/StaticField/Absent/class/callable RuntimeThrow # #2423 runtime-throw +read/no-initializer/StaticField/Absent/class/class RuntimeThrow # #2423 runtime-throw +read/no-initializer/StaticField/Absent/class/enum SilentWrong # #2423 missing-refusal +read/no-initializer/StaticField/Absent/class/int SilentWrong # #2423 missing-refusal +read/no-initializer/StaticField/Absent/class/list RuntimeThrow # #2423 runtime-throw +read/no-initializer/StaticField/Absent/class/literal-string SilentWrong # #2423 missing-refusal +read/no-initializer/StaticField/Absent/class/nullable SilentWrong # #2423 missing-refusal +read/no-initializer/StaticField/Absent/class/optional RuntimeThrow # #2423 runtime-throw +read/no-initializer/StaticField/Absent/class/result RuntimeThrow # #2423 runtime-throw +read/no-initializer/StaticField/Absent/class/str SilentWrong # #2423 missing-refusal +read/no-initializer/StaticField/Absent/class/struct SilentWrong # #2423 missing-refusal +read/no-initializer/StaticField/Absent/class/tuple SilentWrong # #2423 missing-refusal +read/no-initializer/StaticField/Absent/struct/callable RuntimeThrow # #2423 runtime-throw +read/no-initializer/StaticField/Absent/struct/class RuntimeThrow # #2423 runtime-throw +read/no-initializer/StaticField/Absent/struct/enum SilentWrong # #2423 missing-refusal +read/no-initializer/StaticField/Absent/struct/int SilentWrong # #2423 missing-refusal +read/no-initializer/StaticField/Absent/struct/list RuntimeThrow # #2423 runtime-throw +read/no-initializer/StaticField/Absent/struct/literal-string SilentWrong # #2423 missing-refusal +read/no-initializer/StaticField/Absent/struct/nullable SilentWrong # #2423 missing-refusal +read/no-initializer/StaticField/Absent/struct/optional RuntimeThrow # #2423 runtime-throw +read/no-initializer/StaticField/Absent/struct/result RuntimeThrow # #2423 runtime-throw +read/no-initializer/StaticField/Absent/struct/str SilentWrong # #2423 missing-refusal +read/no-initializer/StaticField/Absent/struct/struct SilentWrong # #2423 missing-refusal +read/no-initializer/StaticField/Absent/struct/tuple SilentWrong # #2423 missing-refusal +read/no-initializer/StaticProperty/Absent/class/callable RuntimeThrow # #2423 runtime-throw +read/no-initializer/StaticProperty/Absent/class/class RuntimeThrow # #2423 runtime-throw +read/no-initializer/StaticProperty/Absent/class/enum SilentWrong # #2423 missing-refusal +read/no-initializer/StaticProperty/Absent/class/int SilentWrong # #2423 missing-refusal +read/no-initializer/StaticProperty/Absent/class/list RuntimeThrow # #2423 runtime-throw +read/no-initializer/StaticProperty/Absent/class/literal-string SilentWrong # #2423 missing-refusal +read/no-initializer/StaticProperty/Absent/class/nullable SilentWrong # #2423 missing-refusal +read/no-initializer/StaticProperty/Absent/class/optional RuntimeThrow # #2423 runtime-throw +read/no-initializer/StaticProperty/Absent/class/result RuntimeThrow # #2423 runtime-throw +read/no-initializer/StaticProperty/Absent/class/str SilentWrong # #2423 missing-refusal +read/no-initializer/StaticProperty/Absent/class/struct SilentWrong # #2423 missing-refusal +read/no-initializer/StaticProperty/Absent/class/tuple SilentWrong # #2423 missing-refusal +read/no-initializer/StaticProperty/Absent/struct/callable RuntimeThrow # #2423 runtime-throw +read/no-initializer/StaticProperty/Absent/struct/class RuntimeThrow # #2423 runtime-throw +read/no-initializer/StaticProperty/Absent/struct/enum SilentWrong # #2423 missing-refusal +read/no-initializer/StaticProperty/Absent/struct/int SilentWrong # #2423 missing-refusal +read/no-initializer/StaticProperty/Absent/struct/list RuntimeThrow # #2423 runtime-throw +read/no-initializer/StaticProperty/Absent/struct/literal-string SilentWrong # #2423 missing-refusal +read/no-initializer/StaticProperty/Absent/struct/nullable SilentWrong # #2423 missing-refusal +read/no-initializer/StaticProperty/Absent/struct/optional RuntimeThrow # #2423 runtime-throw +read/no-initializer/StaticProperty/Absent/struct/result RuntimeThrow # #2423 runtime-throw +read/no-initializer/StaticProperty/Absent/struct/str SilentWrong # #2423 missing-refusal +read/no-initializer/StaticProperty/Absent/struct/struct SilentWrong # #2423 missing-refusal +read/no-initializer/StaticProperty/Absent/struct/tuple SilentWrong # #2423 missing-refusal +read/typed-read/ClassComputedConst/Annotated/Later/Alias/FunctionBody/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Annotated/Later/Qualified/FunctionBody/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Alias/ConstInitializer/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Alias/FunctionBody/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Alias/InstanceFieldInitializer/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Alias/MethodBody/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Alias/StaticInitializer/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Bare/ConstInitializer/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Bare/DataclassInitFieldInitializer/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Bare/InstanceFieldInitializer/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Bare/InstancePropertyDefault/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Bare/StaticInitializer/ComprehensionIterable Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Bare/StaticInitializer/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Bare/StaticPropertyDefault/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Bare/StructInitFieldInitializer/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Qualified/AccessorGetBody/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Qualified/AccessorSetBody/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Qualified/ComprehensionElement/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Qualified/ComprehensionIterable/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Qualified/ConstInitializer/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Qualified/DataclassInitFieldInitializer/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Qualified/FunctionBody/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Qualified/GeneratorBody/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Qualified/InitBody/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Qualified/InstanceFieldInitializer/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Qualified/InstancePropertyDefault/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Qualified/LambdaImmediate/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Qualified/LambdaPassed/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Qualified/LambdaStored/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Qualified/MethodBody/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Qualified/NestedClassMethodBody/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Qualified/NestedDefInMethod/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Qualified/StaticInitializer/ComprehensionElement Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Qualified/StaticInitializer/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Qualified/StaticInitializer/Lambda Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Qualified/StaticMethodBody/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Qualified/StaticPropertyDefault/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/Qualified/StructInitFieldInitializer/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/SelfDot/AccessorGetBody/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/SelfDot/AccessorSetBody/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/SelfDot/ComprehensionElement/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/SelfDot/ComprehensionIterable/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/SelfDot/GeneratorBody/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/SelfDot/InitBody/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/SelfDot/LambdaImmediate/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/SelfDot/LambdaPassed/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/SelfDot/LambdaStored/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/SelfDot/MethodBody/Direct Ice # #2423 ice +read/typed-read/ClassComputedConst/Inferred/Later/SelfDot/NestedDefInMethod/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Annotated/Later/Alias/FunctionBody/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Annotated/Later/Qualified/FunctionBody/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Alias/ConstInitializer/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Alias/FunctionBody/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Alias/InstanceFieldInitializer/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Alias/MethodBody/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Alias/StaticInitializer/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Bare/ConstInitializer/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Bare/DataclassFieldInitializer/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Bare/DataclassInitFieldInitializer/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Bare/InstanceFieldInitializer/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Bare/InstancePropertyDefault/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Bare/ParameterDefault/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Bare/StaticInitializer/ComprehensionIterable Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Bare/StaticInitializer/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Bare/StaticPropertyDefault/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Bare/StructFieldInitializer/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Bare/StructInitFieldInitializer/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/AccessorGetBody/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/AccessorSetBody/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/ComprehensionElement/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/ComprehensionIterable/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/ConstInitializer/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/DataclassFieldInitializer/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/DataclassInitFieldInitializer/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/FunctionBody/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/GeneratorBody/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/InitBody/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/InstanceFieldInitializer/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/InstancePropertyDefault/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/LambdaImmediate/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/LambdaPassed/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/LambdaStored/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/MethodBody/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/NestedClassMethodBody/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/NestedDefInMethod/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/ParameterDefault/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/StaticInitializer/ComprehensionElement Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/StaticInitializer/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/StaticInitializer/Lambda Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/StaticMethodBody/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/StaticPropertyDefault/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/StructFieldInitializer/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/Qualified/StructInitFieldInitializer/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/SelfDot/AccessorGetBody/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/SelfDot/AccessorSetBody/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/SelfDot/ComprehensionElement/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/SelfDot/ComprehensionIterable/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/SelfDot/GeneratorBody/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/SelfDot/InitBody/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/SelfDot/LambdaImmediate/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/SelfDot/LambdaPassed/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/SelfDot/LambdaStored/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/SelfDot/MethodBody/Direct Ice # #2423 ice +read/typed-read/ClassLiteralConst/Inferred/Later/SelfDot/NestedDefInMethod/Direct Ice # #2423 ice +read/typed-read/InstanceField/Annotated/Later/Alias/FunctionBody/Direct Ice # #2423 ice +read/typed-read/InstanceField/Annotated/Later/Qualified/FunctionBody/Direct Ice # #2423 ice +read/typed-read/InstanceField/Inferred/Earlier/Alias/FunctionBody/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Earlier/Qualified/FunctionBody/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Earlier/SelfDot/AccessorGetBody/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Earlier/SelfDot/AccessorSetBody/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Earlier/SelfDot/ComprehensionElement/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Earlier/SelfDot/ComprehensionIterable/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Earlier/SelfDot/GeneratorBody/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Earlier/SelfDot/InitBody/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Earlier/SelfDot/LambdaImmediate/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Earlier/SelfDot/LambdaPassed/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Earlier/SelfDot/LambdaStored/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Earlier/SelfDot/MethodBody/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Earlier/SelfDot/NestedDefInMethod/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Later/Alias/FunctionBody/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Later/Qualified/FunctionBody/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Later/SelfDot/AccessorGetBody/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Later/SelfDot/AccessorSetBody/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Later/SelfDot/ComprehensionElement/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Later/SelfDot/ComprehensionIterable/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Later/SelfDot/GeneratorBody/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Later/SelfDot/InitBody/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Later/SelfDot/LambdaImmediate/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Later/SelfDot/LambdaPassed/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Later/SelfDot/LambdaStored/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Later/SelfDot/MethodBody/Direct Ice # #2417 ice +read/typed-read/InstanceField/Inferred/Later/SelfDot/NestedDefInMethod/Direct Ice # #2417 ice +read/typed-read/InstanceMethod/Annotated/Later/Alias/FunctionBody/Direct Ice # #2423 ice +read/typed-read/InstanceMethod/Annotated/Later/Qualified/FunctionBody/Direct Ice # #2423 ice +read/typed-read/InstanceProperty/Annotated/Later/Alias/FunctionBody/Direct Ice # #2423 ice +read/typed-read/InstanceProperty/Annotated/Later/Qualified/FunctionBody/Direct Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/AccessorGetBody/Direct Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/AccessorSetBody/Direct Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/ComprehensionElement/Direct Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/ComprehensionIterable/Direct Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/ConstInitializer/Direct Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/FunctionBody/Direct Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/GeneratorBody/Direct Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/InitBody/Direct Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/InstanceFieldInitializer/Direct Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/InstancePropertyDefault/Direct Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/LambdaImmediate/Direct Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/LambdaPassed/Direct Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/LambdaStored/Direct Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/MethodBody/Direct Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/ModuleAccessorBody/Direct Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/ModuleInitializer/ComprehensionElement Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/ModuleInitializer/ComprehensionIterable Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/ModuleInitializer/Direct Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/ModuleInitializer/Lambda Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/ModulePropertyInitializer/Direct Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/NestedClassMethodBody/Direct Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/NestedDefInFunction/Direct Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/NestedDefInMethod/Direct Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/StaticInitializer/Direct Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/StaticMethodBody/Direct Ice # #2423 ice +read/typed-read/ModuleComputedConst/Inferred/Later/Bare/StaticPropertyDefault/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/AccessorGetBody/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/AccessorSetBody/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/ComprehensionElement/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/ComprehensionIterable/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/ConstInitializer/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/DataclassFieldInitializer/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/FunctionBody/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/GeneratorBody/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/InitBody/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/InstanceFieldInitializer/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/InstancePropertyDefault/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/LambdaImmediate/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/LambdaPassed/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/LambdaStored/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/MethodBody/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/ModuleAccessorBody/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/ModuleInitializer/ComprehensionElement Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/ModuleInitializer/ComprehensionIterable Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/ModuleInitializer/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/ModuleInitializer/Lambda Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/ModulePropertyInitializer/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/NestedClassMethodBody/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/NestedDefInFunction/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/NestedDefInMethod/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/ParameterDefault/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/StaticInitializer/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/StaticMethodBody/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/StaticPropertyDefault/Direct Ice # #2423 ice +read/typed-read/ModuleLiteralConst/Inferred/Later/Bare/StructFieldInitializer/Direct Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/AccessorGetBody/Direct Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/AccessorSetBody/Direct Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/ComprehensionElement/Direct Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/ComprehensionIterable/Direct Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/ConstInitializer/Direct Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/FunctionBody/Direct Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/GeneratorBody/Direct Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/InitBody/Direct Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/InstanceFieldInitializer/Direct Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/InstancePropertyDefault/Direct Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/LambdaImmediate/Direct Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/LambdaPassed/Direct Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/LambdaStored/Direct Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/MethodBody/Direct Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/ModuleAccessorBody/Direct Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/ModuleInitializer/ComprehensionElement Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/ModuleInitializer/ComprehensionIterable Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/ModuleInitializer/Direct Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/ModuleInitializer/Lambda Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/ModulePropertyInitializer/Direct Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/NestedClassMethodBody/Direct Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/NestedDefInFunction/Direct Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/NestedDefInMethod/Direct Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/StaticInitializer/Direct Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/StaticMethodBody/Direct Ice # #2423 ice +read/typed-read/ModuleProperty/Annotated/Later/Bare/StaticPropertyDefault/Direct Ice # #2423 ice +read/typed-read/ModuleVar/Annotated/Later/Bare/AccessorGetBody/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/AccessorSetBody/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/ComprehensionElement/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/ComprehensionIterable/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/ConstInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/FunctionBody/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/GeneratorBody/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/InitBody/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/InstanceFieldInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/InstancePropertyDefault/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/LambdaImmediate/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/LambdaPassed/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/LambdaStored/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/MethodBody/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/ModuleAccessorBody/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/ModuleInitializer/ComprehensionElement FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/ModuleInitializer/ComprehensionIterable FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/ModuleInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/ModuleInitializer/Lambda FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/ModulePropertyInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/NestedClassMethodBody/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/NestedDefInFunction/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/NestedDefInMethod/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/StaticInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/StaticMethodBody/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Annotated/Later/Bare/StaticPropertyDefault/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/AccessorGetBody/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/AccessorSetBody/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/ComprehensionElement/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/ComprehensionIterable/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/ConstInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/FunctionBody/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/GeneratorBody/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/InitBody/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/InstanceFieldInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/InstancePropertyDefault/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/LambdaImmediate/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/LambdaPassed/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/LambdaStored/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/MethodBody/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/ModuleAccessorBody/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/ModuleInitializer/ComprehensionElement FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/ModuleInitializer/ComprehensionIterable FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/ModuleInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/ModuleInitializer/Lambda FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/ModulePropertyInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/NestedClassMethodBody/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/NestedDefInFunction/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/NestedDefInMethod/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/StaticInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/StaticMethodBody/Direct FalseRefusal # #2423 wrong-code +read/typed-read/ModuleVar/Inferred/Later/Bare/StaticPropertyDefault/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticField/Annotated/Later/Alias/FunctionBody/Direct Ice # #2423 ice +read/typed-read/StaticField/Annotated/Later/Bare/ConstInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticField/Annotated/Later/Bare/DataclassInitFieldInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticField/Annotated/Later/Bare/InstanceFieldInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticField/Annotated/Later/Bare/InstancePropertyDefault/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticField/Annotated/Later/Bare/StaticInitializer/ComprehensionIterable FalseRefusal # #2423 wrong-code +read/typed-read/StaticField/Annotated/Later/Bare/StaticInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticField/Annotated/Later/Bare/StaticPropertyDefault/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticField/Annotated/Later/Bare/StructInitFieldInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticField/Annotated/Later/Qualified/FunctionBody/Direct Ice # #2423 ice +read/typed-read/StaticField/Inferred/Earlier/Alias/ConstInitializer/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Alias/FunctionBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Alias/InstanceFieldInitializer/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Alias/MethodBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Alias/StaticInitializer/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Qualified/AccessorGetBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Qualified/AccessorSetBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Qualified/ComprehensionElement/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Qualified/ComprehensionIterable/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Qualified/ConstInitializer/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Qualified/DataclassInitFieldInitializer/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Qualified/FunctionBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Qualified/GeneratorBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Qualified/InitBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Qualified/InstanceFieldInitializer/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Qualified/InstancePropertyDefault/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Qualified/LambdaImmediate/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Qualified/LambdaPassed/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Qualified/LambdaStored/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Qualified/MethodBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Qualified/NestedClassMethodBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Qualified/NestedDefInMethod/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Qualified/StaticInitializer/ComprehensionElement Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Qualified/StaticInitializer/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Qualified/StaticInitializer/Lambda Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Qualified/StaticMethodBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Qualified/StaticPropertyDefault/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/Qualified/StructInitFieldInitializer/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/SelfDot/AccessorGetBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/SelfDot/AccessorSetBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/SelfDot/ComprehensionElement/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/SelfDot/ComprehensionIterable/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/SelfDot/GeneratorBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/SelfDot/InitBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/SelfDot/LambdaImmediate/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/SelfDot/LambdaPassed/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/SelfDot/LambdaStored/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/SelfDot/MethodBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Earlier/SelfDot/NestedDefInMethod/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Alias/ConstInitializer/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Alias/FunctionBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Alias/InstanceFieldInitializer/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Alias/MethodBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Alias/StaticInitializer/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Bare/ConstInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticField/Inferred/Later/Bare/DataclassInitFieldInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticField/Inferred/Later/Bare/InstanceFieldInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticField/Inferred/Later/Bare/InstancePropertyDefault/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticField/Inferred/Later/Bare/StaticInitializer/ComprehensionIterable FalseRefusal # #2423 wrong-code +read/typed-read/StaticField/Inferred/Later/Bare/StaticInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticField/Inferred/Later/Bare/StaticPropertyDefault/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticField/Inferred/Later/Bare/StructInitFieldInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticField/Inferred/Later/Qualified/AccessorGetBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Qualified/AccessorSetBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Qualified/ComprehensionElement/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Qualified/ComprehensionIterable/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Qualified/ConstInitializer/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Qualified/DataclassInitFieldInitializer/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Qualified/FunctionBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Qualified/GeneratorBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Qualified/InitBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Qualified/InstanceFieldInitializer/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Qualified/InstancePropertyDefault/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Qualified/LambdaImmediate/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Qualified/LambdaPassed/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Qualified/LambdaStored/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Qualified/MethodBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Qualified/NestedClassMethodBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Qualified/NestedDefInMethod/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Qualified/StaticInitializer/ComprehensionElement Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Qualified/StaticInitializer/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Qualified/StaticInitializer/Lambda Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Qualified/StaticMethodBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Qualified/StaticPropertyDefault/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/Qualified/StructInitFieldInitializer/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/SelfDot/AccessorGetBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/SelfDot/AccessorSetBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/SelfDot/ComprehensionElement/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/SelfDot/ComprehensionIterable/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/SelfDot/GeneratorBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/SelfDot/InitBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/SelfDot/LambdaImmediate/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/SelfDot/LambdaPassed/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/SelfDot/LambdaStored/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/SelfDot/MethodBody/Direct Ice # #2417 ice +read/typed-read/StaticField/Inferred/Later/SelfDot/NestedDefInMethod/Direct Ice # #2417 ice +read/typed-read/StaticMethod/Annotated/Later/Alias/FunctionBody/Direct Ice # #2423 ice +read/typed-read/StaticMethod/Annotated/Later/Bare/ConstInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticMethod/Annotated/Later/Bare/DataclassInitFieldInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticMethod/Annotated/Later/Bare/InstanceFieldInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticMethod/Annotated/Later/Bare/InstancePropertyDefault/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticMethod/Annotated/Later/Bare/StaticInitializer/ComprehensionIterable FalseRefusal # #2423 wrong-code +read/typed-read/StaticMethod/Annotated/Later/Bare/StaticInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticMethod/Annotated/Later/Bare/StaticPropertyDefault/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticMethod/Annotated/Later/Bare/StructInitFieldInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticMethod/Annotated/Later/Qualified/FunctionBody/Direct Ice # #2423 ice +read/typed-read/StaticProperty/Annotated/Earlier/Qualified/AccessorGetBody/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Earlier/Qualified/AccessorSetBody/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Earlier/Qualified/ComprehensionElement/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Earlier/Qualified/ComprehensionIterable/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Earlier/Qualified/ConstInitializer/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Earlier/Qualified/DataclassInitFieldInitializer/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Earlier/Qualified/FunctionBody/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Earlier/Qualified/GeneratorBody/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Earlier/Qualified/InitBody/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Earlier/Qualified/InstanceFieldInitializer/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Earlier/Qualified/InstancePropertyDefault/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Earlier/Qualified/LambdaImmediate/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Earlier/Qualified/LambdaPassed/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Earlier/Qualified/LambdaStored/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Earlier/Qualified/MethodBody/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Earlier/Qualified/NestedClassMethodBody/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Earlier/Qualified/NestedDefInMethod/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Earlier/Qualified/StaticInitializer/ComprehensionElement Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Earlier/Qualified/StaticInitializer/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Earlier/Qualified/StaticInitializer/Lambda Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Earlier/Qualified/StaticMethodBody/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Earlier/Qualified/StaticPropertyDefault/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Earlier/Qualified/StructInitFieldInitializer/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Later/Alias/FunctionBody/Direct Ice # #2423 ice +read/typed-read/StaticProperty/Annotated/Later/Bare/ConstInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticProperty/Annotated/Later/Bare/DataclassInitFieldInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticProperty/Annotated/Later/Bare/InstanceFieldInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticProperty/Annotated/Later/Bare/InstancePropertyDefault/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticProperty/Annotated/Later/Bare/StaticInitializer/ComprehensionIterable FalseRefusal # #2423 wrong-code +read/typed-read/StaticProperty/Annotated/Later/Bare/StaticInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticProperty/Annotated/Later/Bare/StaticPropertyDefault/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticProperty/Annotated/Later/Bare/StructInitFieldInitializer/Direct FalseRefusal # #2423 wrong-code +read/typed-read/StaticProperty/Annotated/Later/Qualified/AccessorGetBody/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Later/Qualified/AccessorSetBody/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Later/Qualified/ComprehensionElement/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Later/Qualified/ComprehensionIterable/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Later/Qualified/ConstInitializer/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Later/Qualified/DataclassInitFieldInitializer/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Later/Qualified/FunctionBody/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Later/Qualified/GeneratorBody/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Later/Qualified/InitBody/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Later/Qualified/InstanceFieldInitializer/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Later/Qualified/InstancePropertyDefault/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Later/Qualified/LambdaImmediate/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Later/Qualified/LambdaPassed/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Later/Qualified/LambdaStored/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Later/Qualified/MethodBody/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Later/Qualified/NestedClassMethodBody/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Later/Qualified/NestedDefInMethod/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Later/Qualified/StaticInitializer/ComprehensionElement Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Later/Qualified/StaticInitializer/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Later/Qualified/StaticInitializer/Lambda Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Later/Qualified/StaticMethodBody/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Later/Qualified/StaticPropertyDefault/Direct Ice # #2417 ice +read/typed-read/StaticProperty/Annotated/Later/Qualified/StructInitFieldInitializer/Direct Ice # #2417 ice From 656991807f626d3e29baf9b8d2146d87a50d78a1 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 13:49:48 +0000 Subject: [PATCH 10/22] process(plan): plan-777361 (P78) revised after pass 1 Answers the first /verify-plan pass (NEEDS REVISION, Dimension 6 @ a7fbd945d) by rewriting the text each finding names; stage 0 for the revision is 0c5446974. Stamp lines and the Verification Summary are removed; the revision log carries the pass. Body 20,479 -> 20,470 of 20,480 bytes. check_plan_refs.py: RESULT: OK. Owner rulings recorded: #2423 comment 7039834146 (items 5 and 6). Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01LGMKZVcFYGqQRfHgd16DLa --- docs/process/plans/plan-777361.md | 229 ++++++++---------------------- 1 file changed, 62 insertions(+), 167 deletions(-) diff --git a/docs/process/plans/plan-777361.md b/docs/process/plans/plan-777361.md index 7ba882b50..8b472cdf3 100644 --- a/docs/process/plans/plan-777361.md +++ b/docs/process/plans/plan-777361.md @@ -1,137 +1,130 @@ - - - - + # P78 — N1/N2/N4/N7: scope decides meaning ## Context -Rules N1, N2, N4 and N7 of `docs/design/name-resolution.md` (charter §3.20l): #2423 (tracker), #2398, #2432. The rule table #2487 is the group's generator row (R-LO); #2426 closes here. +Rules N1, N2, N4 and N7 of `docs/design/name-resolution.md` (charter §3.20l): #2423 (tracker), #2398, #2432. #2426 closes here; the rule table #2487 (R-LO) lands as a drift guard and stays open. ## Current State -`sharpyc run` (Debug) @ e24aaf9f0; python is CPython 3.15.2. -- **Order decides (N1).** A function reading a module variable declared below it, and a module initializer reading a later one, are SPY0200 (python `3`; NameError by order only). `@static a: int = b + 1` above `b` is SPY0200 bare and runs `5` as `H.b`; an instance initializer splits the same way. -- **Kind decides (N2, N4).** Under a module binding of the name, a later `@static` yields (`64`, as python), a later literal `const` outranks (`3`, python `10`; in a parameter default `2`, python `7`), a later computed `const` is SPY0618. -- **A forward read is untyped.** `b: bool = ` is SPY0908 CS0029; at the earlier order SPY0220. -- **Bodies (#2398).** A nested type's initializer reading the enclosing type's `@static` or instance field: SPY0909. A lambda in an initializer: the method-body steer. `@static def len()` then `v: int = len()`: SPY0224. An interface or union parameter default: SPY0200 + SPY0401. A parameter `x` called as `x()` under a module `def x`: `12` (python `1`). -- **Constant positions (#2432).** Enum member `RED = x` / `= x()`: CS0133. A default through a `@static property`, `math.pi`, `socket.AF_INET`: CS1736. `= 1 < 2 < 3`: SPY0401 (python `True`). -- **No initializer (R-QI).** Module `x: int` and `@static t: int`, read: `0` (python NameError). -- **Instruments @ 8bd4b49fc**. The two generated types, `ClassBodyReadPositionMatrixTests`, `StaticInitializerOrderMatrixTests` and the `ConstantPositionValidator` tests: 303/0/0 (sweep 7 m 26 s; pool 8951 = `CellBudget`; python agrees on 8951 + 18). Seed allowlist 2368 rows: 1076 / 6 / 27 cite #2423 / #2398 / #2432; the new type's 33: 23 / 10 cite #2423 / #2432. Scorecard: seed 2368, outside 605. +`sharpyc run` (Debug) @ 55846bb3f (product code e24aaf9f0); python is CPython 3.15.2. The known-red rows of both sweeps are the state; by class: +- **Order (N1):** a function reading a later module variable is SPY0200 (python `3`); `@static a: int = b + 1` above `b` is SPY0200 bare and `5` as `H.b`. +- **Kind (N2, N4):** under a module binding of the name a later `@static` yields (`64`), a later literal `const` outranks (`3`, python `10`), a later computed `const` is SPY0618. +- **Untyped, bodies (#2398):** a forward read in a `bool` slot is CS0029 behind SPY0908, not SPY0220; a nested type's initializer reading the enclosing type's field is SPY0909; `x()` on a parameter under a module `def x` prints `12` (python `1`). +- **Constants (#2432), R-QI, D10:** `RED = x` is CS0133, a default through `math.pi` CS1736, `= 1 < 2 < 3` SPY0401 (python `True`); module `x: T` reads `0`; an unused `type K0 = nosuch` runs. ## Scope -- **Group:** P78 (chores: none). #2432 stays in (R-KV): 37 of 1142 rows, on `TypeBodyMembership` and the interface/union cell #2398 shares. +- **Group:** P78 (chores: none). #2432 stays in (R-KV): its rows sit on `TypeBodyMembership` and the interface/union cell #2398 shares. - **Tier:** full (c: the seam is under `Semantic/`) — from charter §3.20l - **Alone:** no — verdicts, not layout; no snapshot moves (A12) -- **Gates:** 1 +- **Gates:** 1 — `/ci-gate` on the pushed tip (exit 3: CLAUDE.md's local run), counts `@ sha (measured)`, a red with its control at the base - **Filing:** findings ledger; the lead files by class (contract §10) - **Override:** none ## Defect Class - **Violated contract:** what a module-level or class-level name means, the type a read of it has, and whether the read is legal are one answer for every binding kind, declaration order, spelling and reading position; where python's top-to-bottom reading means something else the read is refused under one code; a constant position refuses a non-constant itself. -- **Meta-class:** silent wrong behavior; position/route missing a shared check; SPY0908 as a net (#2432, the untyped forward read) → **standard cure:** one resolution seam per scope, a semantic-time refusal, the conformance sweep. +- **Meta-class:** silent wrong behavior; position/route missing a shared check; SPY0908 as a net → **standard cure:** one resolution seam per scope, a semantic-time refusal, the conformance sweep. - **Known member cells:** #2423, #2398, #2432; the folded #2415 (C08) and #2416 method-group cells; R-QI's cells (#2427, comment 6967863739). - **Sibling cells this plan must also cover:** none listed; see Generator. - **Lane / reach:** false-refusal + silent-wrong + ice · program; **fidelity-scope row:** "which programs run vs. are refused" and "value of an expression", both COMPARED. -- **Standing harness that should have caught it:** `NameResolutionDifferentialTests` (it does: 1109 rows). `ClassBodyReadPositionMatrixTests` is the hand control (R-KF) for the one axis the generator cannot judge: steer text and diagnostic count per position × host. -- **Generator:** stage 0 (§2.1) @ 8bd4b49fc. **The table** (S0a, #2487): `name-resolution-rules.txt`, 196 rows over 48 rules, each a tag, a rule id and constraints on `RuleTableAxes`' 27 axes, 23 typed. Every cell of both pools matches exactly one row and every row has a cell; `RuleAxes` is deleted. **`NameResolutionDifferentialTests`:** 8951 cases, 2368 known-red rows; the generator's tag and rule must equal the row's. Its 186 rows were derived by splitting the pool on the axes: they state the generator; T8 rewrites those D9 names. **`ScopeMeaningDifferentialTests`** (S0b): 86 cases, 33 known-red rows; it takes every verdict from its row (six cell sets: its summary). Hand lists, closed by the pools: the axes `route`, `mark`, `shape`, `deviation` and the six `Scope*` enums. Excluded: the project route (A3's hand controls), message text (the hand control), a `@static property` typed read (#2417), a match capture as callee (CS8119). Green by D1, D2, D5, D10 (A1, A2, A4, A13), D3, D4, D6, D7 (A5–A7), D8 (A9). -- **Owner rulings:** R-KD, R-KF, R-KG, R-KJ, R-KV, R-LJ, R-LO, R-PM, R-QE, R-QI (charter §4); #2432's call-43 and call-45 cells (§3.20l); owner 2026-11-20, #2423 comment 7030074628: stage 0's test type, D8's nine cells, D10, #2432's close. +- **Standing harness that should have caught it:** `NameResolutionDifferentialTests`; `ClassBodyReadPositionMatrixTests` is the hand control (R-KF) for steer text and diagnostic count per position × host. +- **Generator:** stage 0 (§2.1) @ 0c5446974. `name-resolution-rules.txt` (S0a, #2487): every cell of both pools has exactly one row and every row a cell; for the 8951 pool it copies the `Expect*` arms, a drift guard. `NameResolutionDifferentialTests`: 8951 cases, 2368 known-red rows. `ScopeMeaningDifferentialTests` (S0b): 2225 cases, 639 known-red rows (463 / 26 / 150 cite #2423 / #2432 / #2417), verdicts read from the rows. Each S0b axis is an image, every value generated or excluded with a reason, and a probe where the reason is the compiler's (`Axes_EveryValueIsGeneratedOrExcluded`): constant position ← `AdmissionTable`; member kind ← discovery's `FieldSignature` facts; callee outer ← `BindingKind`; alias site ← `ScopeKind` × `TypeKind`; alias shape ← the alias's AST records; typed-read spelling and position ← `Spelling` and `ReadPosition` through the 8951 pool; R-QI host ← `TypeKind`, type ← `SemanticType`. Closed by decision: the chain pair (call 45), the five other `Scope*` enums, one call site per callee cell (D5's census). Excluded: the project route (A3), message text, a recursive alias (unruled), an interface host (#2383). Green by D1, D2, D5, D10 (A1, A2, A4, A13), D3, D4, D6, D7 (A5–A7), D8 (A9). +- **Owner rulings:** R-KD, R-KF, R-KG, R-KJ, R-KV, R-LJ, R-LO, R-PM, R-QE, R-QI (charter §4); #2432's call-43 and call-45 cells (§3.20l); owner 2026-11-20 on #2423: comment 7030074628 (stage 0's test type, D8's nine cells, D10, #2432's close), comment 7039834146 (S0b's seven axes closed; #2487 stays open). ## Adversarial Review (pre-mortem) -- **Alternative root cause:** "bodies are checked in textual order" — refuted: the same function reads a later `const`, `def`, class and module property (`3`, `4`); only the variable's symbol is missing. The `bool` probe shows the second cause: a symbol that exists is still untyped until its declaration is checked (D2). -- **Alternative layer:** scoping has no `.spy`, dunder or protocol spelling; D8's module-attribute arm is rung 3. +- **Alternative root cause:** "bodies are checked in textual order" — refuted: the same function reads a later `const`, `def`, class and module property; only the variable's symbol is missing. Second cause: a symbol is untyped until its declaration is checked (D2). +- **Alternative layer:** scoping has no `.spy`, dunder or protocol spelling; D8's module arm is rung 3. - **How the fix could be inert:** D1 without D2 prints `3` and leaves CS0029; F2's yield one branch above the N2 refusal keeps `64`; a callee site left on its own lookup keeps `12`. -- **Before/after by direction:** newly refused and `worked`, each ruled: the N2 cells (`6`, `64`, `3`, `2`; R-KD, R-KJ); a module initializer under a later same-named declaration (`7`, python `2`; R-LJ); a module or `@static` declaration with no initializer (R-QI; a regex census of 4,384 `.spy` files finds none); an unused alias to a missing type (`1` today; D10). Newly running: every order-only refusal. A8 is the record. -- **Blast radius:** every project and sweep of the commit gate; Stdlib.Tests (the `.spy` stdlib's module variables), cold/warm and `FrontEndParityTests` first. -- **Generated artifacts touched:** none may move: spy-stdlib C#, spy-test C# and `.expected.cs` are regenerated after T1 and T4 and an empty diff is the guard (A12); the oracle ledger follows `docs/deviations.yaml` at T11. +- **Before/after by direction:** newly refused and `worked`, each ruled: N2's cells whatever the member's kind or position (`64`, `3`; R-KD, R-KJ); a nested type's bare read of its enclosing type's `const` (`7`; R-KG); a class member read bare in a comprehension element of a `@static` initializer (`2`; N1); a module initializer under a later same-named declaration (`2`, python `7`; R-LJ); a declaration with no initializer (R-QI; none in 4,565 `.spy` files, 22 in five spec files: A11); an unused alias to a missing type (`1`; D10). Newly running: every order-only refusal. A8 is the record. +- **Blast radius:** the whole gate; Stdlib.Tests (the `.spy` stdlib's module variables), cold/warm and `FrontEndParityTests` first. +- **Generated artifacts touched:** none may move (A12's regeneration after T1 and T4); the oracle ledger follows T11. ## Design Decisions -Python is evidence where it runs the same program: a NameError by order only becomes a running program (N1 + N3), a different meaning a refusal (N2). D7 and D8 are the tie-breaks' compile error over a silent default or a C# error. No rule below reads a builtin or type name; a rung applies only in D8. -- **D1 (module variables are declared before any read; Semantic).** `NameResolver.ResolveDeclaration` declares every module-level `VariableDeclaration`, annotated or `auto`, as it does a `const` (a module `let` stays SPY0340, P21b); `TypeChecker.CheckVariableDeclaration` completes that symbol and creates none at module level. A second declaration of the name keeps today's verdict (#2125, P21b). Predicates: no module-level `VariableSymbol` is created by `TypeChecker`; a module's export of a variable is its declared symbol on a cold and a warm build, so `ImportedStaticFacts.ImportedStorage` is deleted. -- **D2 (a read is typed whatever the order; Semantic).** The annotated module variables join `CheckModule`'s const type pre-pass. A module-level or type-level value with no annotation is checked on its first read, in its own declaration's scope state, under an in-progress mark; a read that re-enters its own inference is SPY0240 with the annotate steer. Predicate: no read of a declared module-level or type-level name is `Unknown` because of where the declaration stands. -- **D3 (one class-body rule: N1, N2, N4, N7).** `TryResolveClassBodySiblingRead` decides a bare read of a member its type body declares by four facts only — the member's level (`const`, `@static` or nested type; or instance), its order against the reader (earlier, or at-or-after), whether a binding outside the body holds the name (module, enclosing scope, import, builtin), and the position. Earlier: the member. At-or-after with an outer binding: SPY0619, in every position and for every member kind, instance included — N2 is judged before the kind refusal and before SPY0401. At-or-after with none: the member, a forward read (N3); a self read is the cycle graph's SPY0278. Where N2 does not apply an instance member keeps its kind refusal and never yields, a parameter default keeps SPY0401 for a non-constant, and an inherited member keeps R1 (b). Deleted: F1's refusal, F2's yield, the `const` exemption in `IsDeclaredLater`, `ReportAmbiguousLaterConstReads`, SPY0618. Predicate: the verdict never reads `IsConstant`, the compile-time fact or the spelling. -- **D4 (bodies do not see class names: N1, R-KG).** `Scope.ResolveName` crosses a type body from a nested type's body as it does from a function-like scope, so no enclosing type's symbol binds there. `ClassifyClassBodyReadPosition` names three more positions — a nested type's body, a lambda in an initializer, a comprehension's body (all but its first iterable) — each with its own phrase in the one SPY0200 steer (`Outer.s` where that compiles, no steer where nothing does). With an outer binding the read is that binding (R-Y), recorded through `SetModuleAccessCrossesClassMember` for an imported name as for a module variable. Predicate: every scope kind between a read and a type body is classified, with no default arm. -- **D5 (one callee resolver).** A bare callee resolves by the scope walk a bare read uses — local, parameter, class-body sibling at a class-body position, module, builtin — and dispatches on the symbol it bound. The 33 direct `LookupFunctionOverloads` / `BuiltinRegistry.GetFunction` / `GetFunctionOverloads` sites in `TypeChecker*.cs` go behind it; a census test pins the remainder at the helper's own. A constructor's overload set is the whole body's. -- **D6 (N2 at module level; R-LJ).** A read evaluated at load — a module-level or class-level initializer or default — of a builtin name its module declares at or after the reader is SPY0619. A function body is not such a position. An import its module redeclares stays SPY0204 at the declaration, whatever reads it. -- **D7 (R-QI).** A module variable, a `@static` field, and a module or `@static` auto-property with no initializer is SPY0620 at its declaration; the steer names `x: T = ` and `x: T | None = None`. Untouched: an instance field, a local `x: T`, a property with accessor bodies. -- **D8 (#2432; Validation).** `ConstantPositionValidator` judges an enum member's value (a new `AdmissionTable` row) and pushes interface and union hosts on `_enclosingTypes`. `IsMemberConstAdmissible` answers for every member access the checker bound, by what the member is: true for a `const` whose fact is true through any receiver, for an enum member and its `.value`, and — rung 3, since a constant in a referenced assembly has no Sharpy symbol — for a CLR literal field read through `ClrTypeBridge`; false for a `@static` field, property or method, own or inherited. The shape rule keeps only what the checker did not bind. A `ComparisonChain` is admitted when each link is. Predicate: no expression a constant position admits is CS0133 or CS1736, and no constant it admits today is refused. The nine cells tagged must-refuse that run (an enum's `.value`; a literal `const` through a subclass) are must-run since stage 0 (owner). `math.pi` and `socket.AF_INET` are `.spy` module variables: SPY0401 (#2768). -- **D9 (codes).** SPY0619 (N2; the text carries both readings and the qualified spelling) and SPY0620 (R-QI), each with its `DiagnosticExplanations` entry; SPY0618 retires. SPY0200 stays where no binding is visible at the position. T8 edits the table: a bare read at-or-after its member under an outer binding is N2's whatever its target or position (381 cells leave `kind:instance-at-initializer`, 154 leave `SPY0401`), N2 admits SPY0619 alone, N2-module SPY0619 and D6's SPY0204, `kind:enum-member-constant` SPY0401, and `N1-arity` names its code. -- **D10 (an alias names a type that exists; owner).** `type K0 = nosuch` is SPY0202 at the alias whether or not anything names it: the target is resolved where the alias is declared. Predicate: no alias is declared whose target resolves to no type. The 32 `self.N()` / `A.N()` rows are R-LQ's and cite #2397 since stage 0. -- **Out of contract:** a read above a same-scope local (R-KX, P80); a store without `global` (P79); a walrus over `let` (P21b); `ALSO = RED` (#2069, P23); an untyped `@static property` read (#2417); the #2397 rows (P16); `T !E` above its `E` (its row cites #2249, P52); `from m import x` as a live alias (N6). +No rule below reads a builtin or type name; a rung applies only in D8. +- **D1 (module variables are declared first; Semantic).** `NameResolver.ResolveDeclaration` declares every module-level `VariableDeclaration`, annotated or `auto`, as it does a `const`; `TypeChecker.CheckVariableDeclaration` completes that symbol and creates none at module level. A module `let` (SPY0340) and a second declaration of the name (#2125) keep today's verdicts (P21b). Predicates: no module-level `VariableSymbol` is created by `TypeChecker`; a variable's export is its declared symbol, cold and warm, so the identity-bridge arm of `ImportedStaticFacts.ImportedStorage` and `SemanticBinding`'s module-value map are deleted (its first arm stays). +- **D2 (a read is typed whatever the order; Semantic).** `CheckModule` resolves every declared type before it checks a body or an initializer: annotated module variables and module properties beside the consts, and each type's annotated members (fields, consts, properties, method signatures, union cases), nested types included. An unannotated module-level or type-level value is checked on its first read, in its own declaration's scope state, under an in-progress mark; a read that re-enters its own inference stays `Unknown` as today and adds no refusal (the cycle graph's SPY0278 is a ring's). Predicate: no read of a declared module-level or type-level name is `Unknown` because of where the declaration stands. +- **D3 (one class-body rule: N1, N2, N4, N7).** `TryResolveClassBodySiblingRead` decides a bare read of a member its type body declares by four facts only: the member's level (type or instance), its order against the reader, whether a binding outside the body holds the name, and the position. Earlier: the member. At-or-after with an outer binding: SPY0619 in every position and for every member kind, instance included, judged before the kind refusal and SPY0401. At-or-after with none: the member, a forward read (N3); a self read is the cycle graph's. Outside N2 an instance member keeps its kind refusal and never yields, a parameter default keeps SPY0401 for a non-constant, an inherited member R1 (b). Deleted: F1's refusal, F2's yield, the `const` exemption in `IsDeclaredLater`, `ReportAmbiguousLaterConstReads`, SPY0618. Predicate: the verdict never reads `IsConstant`, the compile-time fact or the spelling. +- **D4 (bodies do not see class variables: N1, R-KG).** `Scope.ResolveName` crosses a type body from a nested type's body as from a function-like scope: no field, `const` or property of an enclosing type binds there bare. The crossing is variable-only, as today: a type, alias, type parameter or function still binds (`p: A | None` beside a nested `class A` prints `True`). `ClassifyClassBodyReadPosition` names three more positions — a nested type's body, a lambda in an initializer, a comprehension's body (all but its first iterable) — each with its phrase in the one SPY0200 steer. With an outer binding the read is that binding (R-Y), recorded through `SetModuleAccessCrossesClassMember` for an imported name as for a module variable. Predicate: every scope kind between a read and a type body is classified, with no default arm. +- **D5 (one callee resolver).** A bare callee resolves by the scope walk a bare read uses and dispatches on the symbol it bound, whatever an outer binding of the name is. The 33 direct `LookupFunctionOverloads` / `BuiltinRegistry.GetFunction` / `GetFunctionOverloads` sites in `TypeChecker*.cs` go behind it; a census test pins the remainder at the helper's own. A constructor's overload set is the whole body's. +- **D6 (N2 at module level; R-LJ).** A read evaluated at load — a module-level or class-level initializer or default, never a function body — of a builtin name its module declares at or after the reader is SPY0619. An import its module redeclares stays SPY0204 at the declaration. +- **D7 (R-QI).** A module variable, a `@static` field, and a module or `@static` auto-property with no initializer is SPY0620 at its declaration, whatever its type and host; the steer names `x: T = ` and `x: T | None = None`. Untouched: an instance field, a local `x: T`, a property with accessor bodies. +- **D8 (#2432; Validation, CodeGen).** `ConstantPositionValidator` judges an enum member's value (a new `AdmissionTable` row) and pushes interface and union hosts on `_enclosingTypes`. `IsMemberConstAdmissible` answers for every member access the checker bound: true for a `const` whose fact is true through any receiver, an enum member and its `.value`, and — rung 3: a referenced assembly's constant has no Sharpy symbol — a literal of a referenced module (discovery's `IsConst`); false for every other bound member (a `@static` field, property or method, own or inherited; a module variable; a CLR static that is no literal). The shape rule keeps only what the checker did not bind. Every table reads the answer: a `const` handed a non-constant member is a computed constant, never C#'s `const`; an attribute argument refuses under SPY0425, and `GenerateAttributeArgumentExpression` prints a bound member by the ordinary read route. A `ComparisonChain` is admitted when each link is. Predicate: no expression reaches C# as a non-constant in a constant position, and no constant admitted today is refused. +- **D9 (codes).** SPY0619 (N2; the text carries both readings and the qualified spelling) and SPY0620 (R-QI), each with its `DiagnosticExplanations` entry; SPY0618 retires. T8 edits, in one commit, the table's rows, the `Expect*` arms that mirror them and `AdmittedRefusals`: D3's N2 cells leave `kind:instance-at-initializer` and `SPY0401`, N2 admits SPY0619 alone, N2-module SPY0619 and SPY0204, `kind:enum-member-constant` SPY0401, `N1-arity` names its code; S0b's R-QI cells, which admit none today, admit SPY0620. +- **D10 (an alias names a type that exists; owner).** An alias whose target names a missing type — as the name itself, inside a wrapper, type argument or callable, dotted, or in a generic alias's body — is SPY0202 at the alias, at every site (module, type body, function, block), named or not: both binders resolve the target where the alias is declared. Predicate: no declared alias's target names a missing type. +- **Out of contract:** a read above a same-scope local (P80); a store without `global` (P79); a walrus over `let` (P21b); `ALSO = RED` (#2069); a receiver read untyped at either order (an `auto` field, a `@static property`: #2417, S0b's 150 rows); a recursive alias (unruled); the #2397 rows; `T !E` above its `E` (#2249); `from m import x` as a live alias (N6). ## Implementation ### Phase 1: Names are order-free and typed (N1) -**Goal:** a module-level name has one symbol and one type from every position. +**Goal:** one symbol and one type per name. **Acceptance:** -- **A1.** #2423's module-level rows under N1, N1-nesting and N3 drain (143) — **M1:** declare only annotated variables → the `auto` cells red -- **A2.** S0b's `bool` cells are SPY0220 at both orders — **M2:** drop the first-read check → CS0029 -- **A3.** One symbol: `StaticStorageFactsRoundTripTests` and `ColdWarmBuildDifferentialTests` hold a variable's export equal to its declared symbol, cold and warm, with a project control per importer form — **M3:** create the symbol in `CheckVariableDeclaration` again → the cold cell red -- **A4.** The 96 local rows (N1-innermost) and the module-level N1-type-error and N1-arity rows (46) drain, S0b's callee cells print python's value and its later-`__init__` cell runs — **M4:** send one site back to `LookupFunctionOverloads` → red, and the census pin red -- **A13.** S0b's unused-alias cell is SPY0202 and its five controls keep theirs — **M13:** resolve the target at first use → the cell prints `1` +- **A1.** #2423's module-level rows under N1, N1-nesting and N3 drain: a module variable's by D1, the untyped reads of a later type's member, module property, alias or union by D2 — **M1:** declare only annotated variables → the `auto` cells red +- **A2.** S0b's typed-read rows citing #2423 drain: SPY0220 at both orders, under every spelling and reader position — **M2:** skip a type's members in the pre-pass → the annotated-member cells CS1503; drop the first-read check → the inferred ones +- **A3.** `StaticStorageFactsRoundTripTests` and `ColdWarmBuildDifferentialTests` hold a variable's export equal to its declared symbol, cold and warm, per importer form — **M3:** create the symbol in `CheckVariableDeclaration` again → the cold cell red +- **A4.** The N1-innermost rows and the module-level N1-type-error and N1-arity rows drain; S0b's callee cells print `1` under every outer binding and its later-`__init__` cell runs — **M4:** send one site back to `LookupFunctionOverloads` → red, and the census pin red +- **A13.** S0b's missing-target alias cells are SPY0202 at every site and shape, named or not; their controls run — **M13:** resolve at first use → the unused cells print `1`; skip the function-scoped binder → its cells do #### Tasks -- **T1. Declare module variables (D1)** — `NameResolver.Declarations.cs`, `NameResolver.Members.cs`, `TypeChecker.Statements.cs`, `ProjectCompiler.Phases.cs`, `StaticStorageFacts.cs`; then regenerate (A12). (A1, A3) -- **T2. Types before reads (D2)** — `TypeChecker.cs`, `TypeChecker.Statements.cs`, `TypeChecker.Definitions.cs`. (A2) +- **T1. Module variables (D1)** — `NameResolver.Declarations.cs`, `NameResolver.Members.cs`, `TypeChecker.Statements.cs`, `ProjectCompiler.Phases.cs`, `StaticStorageFacts.cs`; regenerate (A12). (A1, A3) +- **T2. Types before reads (D2)** — `TypeChecker.cs`, `TypeChecker.Statements.cs`, `TypeChecker.Definitions.cs`. (A1, A2) - **T3. One callee resolver (D5)** — `TypeChecker.Expressions.Access.Calls.cs`, `TypeChecker.Expressions.Access.Calls.Overloads.cs`, the census in `DispatchSiteInventoryTests`. (A4) -- **T12. Alias targets (D10)** — `NameResolver.Declarations.cs`. (A13) +- **T12. Alias targets (D10)** — `ResolveTypeAliasDeclaration` (`NameResolver.Members.cs`), `RegisterScopedTypeAlias` (`TypeChecker.Utilities.cs`), `TypeResolver.cs`. (A13) -### Phase 2: Ambiguity and bodies (N2, N4, N7, R-KG, R-QI) +### Phase 2: Ambiguity and bodies (N2, N4, N7) -**Goal:** one verdict and one code per read. +**Goal:** one verdict and code per read. **Acceptance:** -- **A5.** #2423's type-level rows under N2, instance-at-initializer, N1-type-error, N1+N3, N1 and SPY0401 (710) and its N2-module rows (24) drain, C08's pin in `StaticInitializerOrderMatrixTests` moves to SPY0619, and no cell under N2 answers with another code — **M5:** restore F2's yield → `64`; restore the `const` exemption → `3`; report under SPY0200 → red; let a function body count for D6 → its controls red -- **A6.** The 6 #2398 rows and #2423's R-Y, N1-methods and R-KG rows (30) drain; the hand control, with scope {own body, nested type at one and two levels, lambda in an initializer, comprehension body} × host {class, struct, interface, union}, holds one diagnostic whose phrase is its position's — **M6:** drop D4's crossing → SPY0909; give the lambda the method-body text → red -- **A7.** S0b's R-QI cells are SPY0620; their controls (an initializer; an instance field set in `__init__`; a local `x: T`; an accessor-bodied property) run — **M7:** skip `@static` → red; include instance fields → the control red -- **A8.** Direction record: every fixture, spec block and `.spy` stdlib module newly SPY0619, SPY0620 or SPY0202 at an alias, each with its prior behaviour; none `worked` outside the rulings named above +- **A5.** #2423's type-level and N2-module rows drain, C08's pin in `StaticInitializerOrderMatrixTests` moves to SPY0619, and no cell under N2 answers with another code — **M5:** restore F2's yield → `64`; restore the `const` exemption → `3`; report under SPY0200 → red; let a function body count for D6 → its controls red +- **A6.** The #2398 rows and #2423's R-Y, N1-methods and R-KG rows drain; the hand control, scope {own body, nested type at two depths, lambda in an initializer, comprehension body} × host {class, struct, interface, union}, holds one diagnostic with its position's phrase — **M6:** drop D4's crossing → SPY0909; give the lambda the method-body text → red +- **A7.** S0b's R-QI cells are SPY0620 in every host and for every declared type; their controls run — **M7:** skip `@static` → red; include instance fields → the control red +- **A8.** Direction record: every fixture, spec block and `.spy` stdlib module newly refused, under any code (SPY0619, SPY0620, SPY0202, D4's SPY0200, D8's SPY0401 and SPY0425), with its prior behaviour; none `worked` outside the rulings above #### Tasks -- **T4. The class-body rule (D3)** — `TypeChecker.ClassScopeRule.cs`, `TypeBodyMembership.cs`; then regenerate (A12). (A5) +- **T4. The class-body rule (D3)** — `TypeChecker.ClassScopeRule.cs`, `TypeBodyMembership.cs`; regenerate (A12). (A5) - **T5. Bodies and nested types (D4)** — `Scope.cs`, `SymbolTable.cs`, `TypeChecker.ClassScopeRule.cs`. (A6) - **T6. N2 at module level (D6)** — `TypeChecker.Expressions.cs`. (A5) - **T7. No-initializer refusal (D7)** — `TypeChecker.Statements.cs`, `TypeChecker.Definitions.cs`. (A7) -- **T8. Codes (D9)** — `DiagnosticCodes.cs`, `DiagnosticExplanations.Semantic.cs`; the harness's `AdmittedRefusals`. (A5, A7) -- **T9. Hand control** — `ClassBodyReadPositionMatrixTests`: its literal copy of the contract becomes D3 and D4. (A6) +- **T8. Codes (D9)** — `DiagnosticCodes.cs`, `DiagnosticExplanations.Semantic.cs`; `name-resolution-rules.txt` with `ExpectClass` and `AdmittedRefusals`; the codes `NoInitializerCases` admits. (A5, A7) +- **T9. Hand control** — `ClassBodyReadPositionMatrixTests`: its copy of the contract becomes D3 and D4. (A6) ### Phase 3: Constant positions (#2432) **Goal:** a constant position's verdict is the checker's. **Acceptance:** -- **A9.** The 27 #2432 rows and S0b's 10 drain: `math.pi` and `socket.AF_INET` are SPY0401 (python runs them: #2768), a chain is admitted exactly when its links are, and `subprocess.PIPE`, a CLR literal, still prints `-1` — **M9:** answer null for a bound non-constant member → CS1736; skip the enum row → CS0133; admit every chain → `0 < 2 in [1, 2]` reaches C# +- **A9.** The #2432 rows of both allowlists drain: a non-constant member (`math.pi`, `sys.maxsize`) is SPY0401 at a default, a field and an enum member (python runs them: #2768), SPY0425 at an attribute argument, a computed constant at a `const`; a chain is admitted exactly when its links are; `subprocess.PIPE` prints `-1` at every host — **M9:** answer null for a bound non-constant member → CS1736; skip the enum row → CS0133; admit every chain → `0 < 2 in [1, 2]` reaches C#; keep the attribute printer's member arm → CS0103 - **A10.** An interface or union parameter default draws one diagnostic — **M10:** drop either push → two #### Tasks -- **T10. The validator (D8)** — `ConstantPositionValidator.cs`, `ConstantDefaultClassifier.cs`, `ConstEligibility.cs`. (A9, A10) +- **T10. The validator (D8)** — `ConstantPositionValidator.cs`, `ConstantDefaultClassifier.cs`, `ConstEligibility.cs`, `RoslynEmitter.TypeDeclarations.cs`. (A9, A10) ### Phase 4: Spec and record **Acceptance:** -- **A11.** `docs/language_specification/variable_scoping.md` is rewritten around N1–N7: each rule's example executed, each printing something else with its rule off; an `error` block per refusal; the F1, F2, R-JJ and SPY0618 texts gone; touched files drained (R-BG). `docs/language_specification/variable_declaration.md` § Bare Declarations states D7. `docs/deviations.yaml`: `class-body-bare-name-read` is N1 and N2's text. `docs/design/name-resolution.md`: the *Today* notes of N1, N2 and N4 removed, the table named as the source there and in `docs/design/gap-discovery-contracts.md`. #2426's other open items (the block-scope list's `match` case and loop-`else` bodies, the `case x:` constant-pattern row, the walrus and `let` texts) are fixed, or marked pending with the issue that owns each. `check_spec_blocks.sh` green -- **A12.** `regen: no diff` after T1 and after T4, for spy-stdlib C#, spy-test C# and `.expected.cs`; `FrontEndParityTests` green -- Allowlists drain, each row in the commit that turns it green: every #2423, #2398 and #2432 row and every S0b row; `allowlist_rows_seed` lowered with `--lower` +- **A11.** `docs/language_specification/variable_scoping.md` is rewritten around N1–N7: each rule's example executed and printing something else with its rule off; an `error` block per refusal; the F1, F2, R-JJ and SPY0618 texts gone; touched files drained (R-BG). `variable_declaration.md` § Bare Declarations beside it states D7, and the 22 such declarations in `function_types.md`, `collection_types.md`, `type_annotation_shorthand.md`, `parameter_modifiers.md` and `properties.md` get a value or move into a body. `docs/deviations.yaml`: `class-body-bare-name-read` is N1 and N2's text. `docs/design/name-resolution.md`: the *Today* notes of N1, N2 and N4 go, and it and `docs/design/gap-discovery-contracts.md` name the table. #2426's other open items are fixed or marked pending with their issue. `check_spec_blocks.sh` green +- **A12.** `regen: no diff` after T1 and T4, for spy-stdlib C#, spy-test C# and `.expected.cs`; `FrontEndParityTests` green +- Allowlists drain, each row in the commit that turns it green: every #2423, #2398 and #2432 row of both; both scorecard baselines lowered with `--lower` #### Tasks -- **T11. Spec, deviation row, design doc** — the files A11 names. (A11) +- **T11. Spec and record** — A11's files. (A11) ## Testing Strategy -- Fixtures: one `.spy` + `.expected` per rule and one `.error` per refusal (SPY0619 in a class body and at module level, SPY0620, SPY0200 with each D4 phrase, SPY0401 at an enum member, SPY0202 at an unused alias), each with its running control: the same read qualified, the same declaration with an initializer. -- Change of axis beyond the issues: host {struct, interface, union}; reader {property default, synthesized-constructor field}; outer {import, builtin, enclosing function}; the project route (A3). -- Outputs discriminate: member and outer values differ in every cell; an initializer's default is never a member's value. -- Spec: A11, of equal weight. Blast radius and regeneration: A12, early. +- Fixtures: one `.spy` + `.expected` per rule and one `.error` per refusal code and D4 phrase, each with its running control. +- Beyond the generator: host {interface, union}; the project route (A3). +- Outputs discriminate: member and outer values differ in every cell. Spec: A11, of equal weight. Regeneration: A12, early. ## Issues to Close @@ -139,112 +132,14 @@ Python is evidence where it runs the same program: a NameError by order only bec - #2398 — closed by T5, T9, T10; **close criterion:** A6 and A10 @ sha - #2432 — closed by T10; **close criterion:** A9 @ sha: the SPY0401 verdict (owner); the constants are #2768's - #2426 — closed by T11; **close criterion:** A11 @ sha -- #2487 — closed by stage 0 and T11; **close criterion:** S0a's totality test and its two mutations @ the stage-0 sha, and A11's pointer ## Class trackers this plan may post cells to -- #2427 — the name-resolution principle -- #2457 — the harness's residue (P77c) -- #2486 — the rule tables -- #2397, #2417, #2069, #2249 — neighbouring classes named under Out of contract -- #2768 — Stdlib constants as module variables +- #2427 (the principle), #2457 (the harness's residue) +- #2486 — the rule tables; #2487 stays open (owner): rows written from the rules, the generator reading its verdict from the table, every rule id in `name-resolution.md`, no negated constraint, the spec's tables generated from it +- #2397, #2417, #2069, #2249, #2383, #2768 — neighbours named above ## Revision log -- @ 8bd4b49fc — revised before the first pass: stage 0 landed; D8's nine cells are must-run; D10 refuses the alias (A13); #2432 closes on SPY0401 (#2768); 32 rows cite #2397; D9's 169 is 154. -## Verification Summary - -**Result:** NEEDS REVISION (Dimension 6, with Dimension 4 design rows; pass 1 of 2) -**Adequacy:** CELL -**Verified on:** 2026-11-20 @ a7fbd945d (product code == e24aaf9f0; stage 0 @ 8bd4b49fc; Debug `sharpyc` built at this tree; python = CPython 3.15.2, `.venv/bin/python3`) -**Plan file:** `docs/process/plans/plan-777361.md` (committed in §4 at every result, NEEDS REVISION included) - -### Paraphrase -- **Changes:** a module-level or class-level name gets one meaning, one type and one legality verdict wherever it is read. Module variables are declared at name resolution as consts are (D1) and typed before any read (D2). One class-body rule decides a bare sibling read from the member's level, its order against the reader, whether a binding outside the body holds the name, and the position: an earlier member is the member, at-or-after under an outer binding is the new SPY0619, at-or-after with none is a forward read (D3). Nested type bodies, lambdas in initializers and comprehension bodies stop seeing class names bare, with a position phrase in SPY0200 (D4). A bare callee resolves by the walk a bare read uses (D5). A load-time read of a builtin name its module declares at or after the reader is SPY0619 (D6). A module or `@static` declaration with no initializer is the new SPY0620 (D7). The constant-position validator judges enum member values and interface and union hosts, answers a member access by what the member is, and admits a comparison chain link by link (D8). SPY0618 retires and T8 re-labels the rule table (D9). An alias to a missing type is SPY0202 at the alias (D10). The spec is rewritten around N1–N7; rows drain in the commit that turns them green. · **Today:** order decides (a function or initializer reading a later module variable is SPY0200); kind decides (a later `@static` yields to a module binding, a later literal `const` outranks it, a later computed `const` is SPY0618); a forward read is untyped (CS0029 behind SPY0908); a nested type's initializer ICEs (SPY0909); a parameter called as `x()` under a module `def x` calls the module's; constant positions leak CS0133 / CS1736; a declaration with no initializer reads `0`. Instruments: an 8951-cell pool with 2368 known-red rows, and a new 86-cell type with 33. · **Could not paraphrase:** none. Two sentences read two ways and are raised below (D4 "no enclosing type's symbol binds there"; D8 on a CLR static that is no literal). - -### Corrections Made -- None. The body is 20,479 of 20,480 bytes, and every correction found either grows it or is the author's judgment. Each is listed under Findings with its text, for the revision. A revision-log line `(NEEDS REVISION, Dimension 6)` costs bytes too. - -### Stage 0 checks (contract §11) -- **Path check:** `git merge-base origin/dev 8bd4b49fc` = e24aaf9f0; `git diff --name-only e24aaf9f0..8bd4b49fc -- ':!docs/process/plans/'` lists `build_tools/scorecard-baseline.json` and 12 files under `src/Sharpy.Compiler.Tests/Conformance/`. Not seeded (`scorecard_metrics.py` untouched). PASS. -- **Green @ a7fbd945d (measured):** both generated types, `ClassBodyReadPositionMatrixTests`, `StaticInitializerOrderMatrixTests`, `ConstantPositionValidator*`: 303/0/0, 8.5 min. Pool 8951 = `CellBudget`, python agreed 8951/8951, 2368 rows (1076 / 6 / 27 / 239 cite #2423 / #2398 / #2432 / #2397). New type: 86 cells, 33 red, 33 rows (23 / 10), python 18/18. `scorecard_metrics.py --check`: OK, seed 2368, outside 605. Table: 196 rows, 48 rules. CI on #2767 @ a7fbd945d: gate green, `review-line` red (no review line yet). -- **What the totality assertions catch.** `RuleTable_EveryCellHasOneRow_AndEveryRowACell`: a cell of the 8951 with no row or two rows; a cell whose generated tag or rule differs from its row's; a row no cell matches; a table value that is no enum name or (text axes) is carried by no cell; a rule a refusal can answer with no admitted-code entry. `RuleTable_EveryCaseHasOneRow_AndTakesItsVerdictFromIt`: the same for the 86, whose tag and rule come from the row. `Axes_EveryValueIsGeneratedOrExcluded`: each of `BindingKind` (twice) and `LocalTarget` is generated or carries a reason, and each `Scope*` value has a cell. -- **What they do not catch.** (1) For the 8951 cells the table is a second copy of the generator: `derive2.py` induced the 186 rows from the pool's own tags and rules, so a wrong arm in an `Expect*` function is in both and stays green; the only verdicts that differ from the base are the nine the owner ruled (compared with the drafter's base-run dump: 9 cells differ, the nine named). The table catches drift between the two from here on, nothing earlier. (2) 165 of the 196 rows carry a negated constraint (354 `!=`): a new enum value on such an axis is absorbed by a row nobody wrote for it; a negated constraint is a default arm. (3) No assertion reads `name-resolution.md`: 36 of the 48 rule ids do not occur in it (`grep -F`). (4) The axes one cell set fixes at a single value (under Adequacy) have no partition. -- **Mutations re-run, each from a `cp` copy, restored and confirmed by `cmp`:** - - table row L82 (an N2 row) deleted → `RuleTable_EveryCellHasOneRow…` red, 568 cells match no row (1 failed, 1 passed); - - the R-QI row deleted → both `RuleTable_Every…` facts red (4 cells no row; 47 rules, not 48) (2 failed); - - a dead row appended → both red, "no cell of any pool matches" (2 failed); - - generator arm `R1(b)` retagged `R-KG` (both admit SPY0200) → the 8951 fact red, cells differ from rows L127 / L128; and `ExcludedTypedReads[StaticProperty]` removed → `Axes_…` red, "neither generated nor excluded" (2 failed, 1 passed). `Axes_…` had no mutation in a commit body; this is its record; - - `read/alias-target/Declared/Used/Later` listed known-red → `ScopeMeaning_Sweep` red, STALE (1 failed, 3 passed); - - the R-QI row flipped to `MustRun` → `ScopeMeaning_Sweep` red on the four rows' lane (1 failed, 3 passed); - - `read/StaticField/StaticInitializer/Earlier/Bare/outer=ModuleVar` listed known-red → `NameResolutionDifferential_Sweep` red, STALE, allowlist 2369 (1 failed; 7.4 min); - - all restored → the two table facts and the new type's four tests 5/5 passed; `git status --short` empty. -- **Not re-run:** the 8951 sweep after the last restore (its green is the 303/0/0 above, at the same bytes by `cmp`). - -### Adequacy -- **Contract:** named — one answer per name for every binding kind, order, spelling and reading position; a refusal under one code where python's reading differs; a constant position refuses a non-constant itself. -- **Axes:** open. The 8951-cell pool's rosters are P77a's and were not re-graded. The new type carries the axes below as hand lists or single values, each with a value measured red today inside the plan's own contract (`sharpyc run`, each with its control): - - constant position ← `AdmissionTable`, the validator's own enumeration (the test pins 4 positions): a lambda default `lambda r: float = math.pi: r` is CS1736; `const TAU2: float = math.pi` is CS0133; - - constant expression kind ← the member kinds `IsMemberConstAdmissible` answers for (D8): `ScopeConstantKind` has a CLR literal and a `.spy` module variable; a CLR static property, `def f(n: int = sys.maxsize)`, is CS1736 and no cell asks; - - callee `outer` ← the `BindingKind` call and constructor classes the table defines: only `ModuleDef` and none; a parameter `x` called under a module `class x` is CS0029 (python `1`); - - alias declaration site ← the binder census (`ResolveTypeAliasDeclaration` at module and type-body level, `RegisterScopedTypeAlias` in a function), and alias target shape ← the type-annotation node kinds: `type K0 = nosuch`, unused, runs `1` in a function and in a class body, and `list[nosuch]`, `nosuch | None`, `(nosuch) -> int` run `1` at module level. T12 names `NameResolver.Declarations.cs` only; the function-scoped site is in `TypeChecker.Utilities.cs`; - - typed-read reader position ← `ReadPosition` (one value, a function body) and spelling ← `Spelling`: `b: bool = K` at module level above `const K = five()` is CS0029; `def r(p: bool = K)` above `const K = 5` is CS1750. The instance kinds are excluded for a reason ("no read from another declaration's initializer") that does not hold for the reader the set generates; - - R-QI host ← `TypeKind`, and value type: `struct S: @static t: int` reads `0`; module `s: str` reads `None`. - The finding is "close each against the enumeration named, or exclude it with its reason in the test and in the plan", answered by a new stage-0 commit; it is not "add these cells". -- **Cure:** seam + sweep — silent wrong behaviour, a position missing a shared check, SPY0908 as a net. -- **Harness:** named + allowlist delta (1076 + 6 + 27 seed rows, 33 new-type rows; counts re-measured). -- **Layer:** every decision rung-justified (D8's CLR literal is rung 3; no rule reads a builtin or type name). - -### Scope & convergence -- **Group:** one (P78; chores none; #2432 in by R-KV) · **Alone:** no — required? no (verdicts and diagnostics, no emitted layout) · **Gates:** 1 -- **Generator:** existing `NameResolutionDifferentialTests` + stage 0 @ 8bd4b49fc (`ScopeMeaningDifferentialTests`, the rule table), mutations re-run. Hand controls named: the project route (A3); steer text and count per position × host (`ClassBodyReadPositionMatrixTests`, R-KF). -- **Trackers named:** #2427, #2457, #2486, #2397, #2417, #2069, #2249, #2768 · **Fidelity rows:** named ("which programs run vs. are refused", "value of an expression"; both COMPARED). - -### Findings -Dimension 4 (design rows against the code; the author's revision): -- **D2 does not reach what A2 and A1 count.** Its two mechanisms are annotated module variables joining the const pre-pass, and an unannotated value checked on its first read. Of the 13 red `typed-read` cells, five are ANNOTATED members of a later type or an annotated module property (`StaticField`, `ClassLiteralConst`, `ClassComputedConst`, `StaticMethod`, `ModuleProperty` × `Annotated/Later`), which neither sentence names. And 16 of A1's 143 rows are no module variable: a later class's or struct's field through `x().v`, a later module property, alias or union, read in a comprehension, a lambda or a body (CS0266 / CS0149 / CS1503; SPY0224), filed under T1. -- **One A2 cell is not an order defect.** `read/typed-read/StaticField/Inferred/Earlier` is CS0029 with the declaration ABOVE its reader: a member-access read of an `auto` field is untyped at either order (`b: bool = H.x`, and `H().x` for an instance field; the bare `y: bool = x` is SPY0220; the annotated controls are SPY0220). The plan excludes `@static property` for exactly this reason (#2417) and keeps this cell under #2423. Current State's "at the earlier order SPY0220" is false for it, and so is the stage-0 body's "checked after its reader (11)". Either D2 names the cure (where the inferred type of a type-level field is recorded for a member access), or the cell is #2417's. -- **D4, "so no enclosing type's symbol binds there".** `ResolveName`'s crossing is variable-only: types, aliases, type parameters and functions bind through it. Read literally, the sentence refuses `class B: a: A | None = None` beside a nested `class A` (prints `True` today): `worked` → refused with no ruling. Bare `A()` there is CS1955, #2397's. -- **D1, "`ImportedStaticFacts.ImportedStorage` is deleted".** The function has three callers and a first arm (the declaration's own CodeGenInfo through `DeclarationRoot()`). The code's own note deletes the bridge ARM and `SemanticBinding`'s module-value map. -- **D8 is silent on a CLR static that is no literal** (the `sys.maxsize` value above): "false for a `@static` field, property or method" names Sharpy members. It should say false for every bound member that is no constant. - -Dimension 7: -- **The by-direction list is short.** Must-refuse cells that RUN today, from this pass's sweep: N2 334, `kind:instance-at-initializer` 250, N1-type-error 33, SPY0401 15, N2-module 8, N1-methods 6, R-KG 4. The plan names the N2, N2-module, R-QI and alias cells. Not named: R-KG's four (a nested type reading the enclosing type's `const` prints `1` / `7`) and N1-methods' six (a class member read in a comprehension element of a `@static` initializer prints its value); both are ruled, by N1 and R-KG. A8 records only new SPY0619, SPY0620 and SPY0202, so a corpus program newly SPY0200 under D4 or newly SPY0401 has no record. -- **R-QI's census did not read the spec.** `.spy` files: 0 real hits in 4565 (this pass's regex). Spec blocks: 22 candidate module-level `name: T` declarations with no initializer in five files (`function_types.md`, `type_annotation_shorthand.md`, `collection_types.md`, `properties.md`, `parameter_modifiers.md`); whether each block compiles today or carries a marker was not checked. The charter's "the spec … found no such declaration" does not hold as a grep. A11 names none of the five; each would be a touched file for R-BG. -- **D2's SPY0240 arm** (a read re-entering its own inference) has no acceptance bullet, cell, fixture or mutation; SPY0240 is `InvalidAutoVariable` today. -- **T8 does not name what it edits.** The 8951 pool is double-entry, so D9's re-labelling is the table's rows AND the generator's `Expect*` arms in one commit; the new type's R-QI cells admit no code (`Array.Empty()` in `NoInitializerCases`), so SPY0620 is red there as `wrong-code` until that line changes. T8 lists `DiagnosticCodes.cs`, the explanations and `AdmittedRefusals`. - -Dimensions 5 and 8: -- **#2487's close criterion is weaker than the issue.** Its text asks that the classifier READ its verdict from the table, that every rule id exist in `name-resolution.md`, that no arm be a default, and that the spec's verdict tables be generated from or asserted equal to it. Stage 0 gives a double-entry table for 8951 cells, 36 ids outside the doc and 165 rows with a negation; A11 adds a pointer. -- **Gate:** the plan says "the commit gate" and names no command; `/ci-gate` with its fallback, counts `@ sha (measured)` and a control at the base are `/implement-plan`'s (contract §6). - -Decisions that are the owner's (this pass asked nothing): -1. **The hand-listed axes above:** close each against its enumeration (a new stage-0 commit; the new red cells raise `allowlist_rows_outside_seed`, which item 1 of comment 7030074628 reads as covering), or rule an axis out with its reason. Recommended: close those with a measured red value; exclude the rest in the test. -2. **#2487:** (a) leave it open after P78 with the remainder listed; (b) finish it in P78 (rows written from the rules, the generator reading tag and rule from them: a large stage-0 commit); (c) close as planned and move the remainder to #2486. Recommended: (a). -3. **D9 at T8 or in stage 0.** In stage 0 (N2 admitting SPY0619 alone, named as waiting on #2423), 108 + 136 green cells of the two rules and 183 green N2 cells would be refused under a code their rule no longer admits: 427 reds with no row to hold them in that pool, or a `wrong-code` lane there and +427 seed rows, which item 1 did not approve. Recommended: keep it at T8, named as the T8 finding says. -4. **The `auto`-field cell:** in P78 under D2, or re-cited to #2417 (P30) as its `@static property` twin is. Recommended: by cause; if D2 does not record on the type's own field symbol, re-cite. - -### Falsifiability -- A1 / M1, A2 / M2, A3 / M3, A4 / M4 (and the census pin), A5 / M5 (four), A6 / M6 (two), A7 / M7 (with its control), A9 / M9 (three), A10 / M10, A13 / M13: mutation named; exemption not subject; positive control yes; by-direction specified except as found above. -- A8 (the direction record): too narrow by code, above. A11: each example "printing something else with its rule off" discriminates. A12 (`regen: no diff`): an absence assertion whose positive control is the staleness gates. -- Stage 0's facts and two sweeps: mutations re-run above. - -### Deferred findings -- (not CONVERGED: a first pass) - -### Warnings -- A1's, A4's, A5's and A6's row counts are measured (143; 96 + 46; 710 + 24; 30; 27 seeds; 1076 in all). Which decision drains which rule is the drafter's reading, and it fails for the rows named under D2. -- The 32 rows re-cited to #2397 are `NestedType` × `SelfDot` (R-LQ's `self.N()`) and `NestedType` × `Alias`; R-LQ's text names `self.N()` only, so the alias spelling rests on P16's contract. -- Two `.error` fixtures pin F1's text ("declared later than"); they become running programs under the retirement the charter records. -- `python3 -m pytest build_tools/tests -q` @ a7fbd945d: 2 failed, 2216 passed; both `test_check_review_line.py::test_real_lines_on_real_history[…]`, "no merge base", in a shallow clone. No control at the base was run. - -### Missing Steps Added -- None added to the body (the cap). For the revision: the gate command; A8 over every newly refused program whatever its code; T8's edit list; the five spec files; a fixture and a mutation for D2's SPY0240 arm. - -### Unchecked Claims -- "No snapshot moves" (A12): the charter's claim; the regeneration after T1 and T4 proves or refutes it. -- D5's "all 33 sites behind one resolver": the count is measured (33 call sites in `TypeChecker*.cs`); that one resolver can carry them, and which site resolves a type-name callee, were not traced. -- D1's cold and warm export identity and the bridge deletion: read from `ResolveOwnExportedSymbol` and `ModuleLoader.ExtractExportedSymbol`, not run. A value import across an import cycle is SPY0302, so no cycle cell exists. -- D2's first-read check under an in-progress mark: a design with no prototype. -- The nine re-tagged cells against the base: compared with the drafter's sweep dump at e24aaf9f0, not re-run at the base by this pass. -- Not run: the whole-solution gate (CI at a7fbd945d is green on #2767), `check_spec_blocks.sh`, any control at the base sha, the hand controls' own mutations. +- @ 8bd4b49fc — revised before the first pass: stage 0 landed; D8's nine cells must-run; D10 (A13); #2432's close; 32 rows to #2397. +- @ a7fbd945d — revised after the 1st pass (NEEDS REVISION, Dimension 6): stage 0 closes S0b's seven axes; D2 resolves declared types first, with no SPY0240 arm (refusing a ring of unannotated lambdas that runs is unruled); D4 is variable-only; D1 deletes the bridge arm; D8 answers for every bound member and table; D10 names both binders; the `auto`-field read is #2417's; A8 records every code; #2487 stays open. From 19ffa7ad1883a7209821670a0aeadd7996f566a9 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 14:49:28 +0000 Subject: [PATCH 11/22] =?UTF-8?q?process(plan):=20plan-777361=20=E2=80=94?= =?UTF-8?q?=20verified=20NEEDS=20REVISION=20@=20656991807?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /verify-plan pass 2 of 2 on plan-777361 (P78), nine dimensions, at 656991807 (product code == e24aaf9f0; stage 0 @ 0c5446974). Result NEEDS REVISION, Adequacy CELL (Dimension 6 with one Dimension 4 design row, D8). Contract §12 Convergence was applied and does not hold: two findings are not deferrable. 1. D8's list answers true for a literal of a referenced MODULE only, and false for every other bound member. A referenced type's literal (`def f(x: int = int.max_value)`, prints 2147483647 today) would be refused, against D8's own predicate, and no case of either pool or fixture hands a constant position such a member. The member-kind axis is closed against the Stdlib modules' values only. 2. The hosts under an AdmissionTable value are a hand list. A struct's defaulted auto-property (`property p: int = H.x`) is CS1736 behind SPY0908 through CodeGenInfoComputer, a reader outside the validator. Stage 0 re-measured: path check PASS; ScopeMeaning 2225 cases, 639 rows; both generated types and the hand controls 304/0/0; both §11 mutations and one mutation per axis family, each alone, red; a host removed from a table stays green (finding 2's control). The plan body is unchanged (20,470 of 20,480 bytes). Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01LGMKZVcFYGqQRfHgd16DLa --- docs/process/plans/plan-777361.md | 98 ++++++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 1 deletion(-) diff --git a/docs/process/plans/plan-777361.md b/docs/process/plans/plan-777361.md index 8b472cdf3..95b46ed17 100644 --- a/docs/process/plans/plan-777361.md +++ b/docs/process/plans/plan-777361.md @@ -1,4 +1,7 @@ - + + + + # P78 — N1/N2/N4/N7: scope decides meaning @@ -143,3 +146,96 @@ No rule below reads a builtin or type name; a rung applies only in D8. - @ 8bd4b49fc — revised before the first pass: stage 0 landed; D8's nine cells must-run; D10 (A13); #2432's close; 32 rows to #2397. - @ a7fbd945d — revised after the 1st pass (NEEDS REVISION, Dimension 6): stage 0 closes S0b's seven axes; D2 resolves declared types first, with no SPY0240 arm (refusing a ring of unannotated lambdas that runs is unruled); D4 is variable-only; D1 deletes the bridge arm; D8 answers for every bound member and table; D10 names both binders; the `auto`-field read is #2417's; A8 records every code; #2487 stays open. + +## Verification Summary + +**Result:** NEEDS REVISION (Dimension 6, with one Dimension 4 design row: D8; pass 2 of 2, so the open findings go to the owner, R-LW) +**Adequacy:** CELL +**Verified on:** 2026-11-20 @ 656991807 (product code == e24aaf9f0; stage 0 @ 0c5446974; Debug `sharpyc` built at this tree; python = CPython 3.15.2, `.venv/bin/python3`) +**Plan file:** `docs/process/plans/plan-777361.md` (committed in §4 at every result, NEEDS REVISION included) + +### Paraphrase +- **Changes:** a module-level or class-level name gets one meaning, one type and one legality verdict wherever it is read. Name resolution declares every module variable as it does a `const`, and the checker completes that symbol and creates none (D1). `CheckModule` resolves every declared type before any body or initializer; an unannotated value is checked on its first read under an in-progress mark, and a read that re-enters its own inference stays untyped with no new refusal (D2). One class-body rule decides a bare sibling read from the member's level, its order against the reader, whether a binding outside the body holds the name, and the position: earlier is the member; at-or-after under an outer binding is the new SPY0619 for every kind and position; at-or-after with none is a forward read (D3). A nested type's body, a lambda in an initializer and a comprehension's body stop seeing an enclosing type's variables bare, each with its phrase in SPY0200; types, aliases and functions still bind (D4). A bare callee resolves by the walk a bare read uses, with the 33 direct lookup sites behind one resolver (D5). A load-time read of a builtin name its module declares at or after the reader is SPY0619 (D6). A module variable, a `@static` field, and a module or `@static` auto-property with no initializer is the new SPY0620 (D7). The constant-position validator judges an enum member's value, pushes interface and union hosts, and answers a bound member access by what the member is; a chain is admitted link by link; the attribute printer takes the ordinary read route (D8). SPY0618 retires and T8 re-labels the table, the generator's arms and the admitted codes in one commit (D9). An alias whose target names a missing type is SPY0202 at the alias, at every site and shape, used or not (D10). The spec is rewritten around N1–N7; rows drain in the commit that turns them green; #2487 stays open. · **Today:** order decides (a function reading a later module variable is SPY0200); kind decides (a later `@static` yields to a module binding, a later literal `const` outranks it, a later computed `const` is SPY0618); a forward read is untyped (CS0029 behind SPY0908); a nested type's initializer ICEs; `x()` on a parameter under a module `def x` calls the module's; constant positions leak CS0133 / CS1736; a declaration with no initializer reads `0`; an unused alias to a missing type runs. Instruments: an 8951-case pool with 2368 known-red rows and a 2225-case generated type with 639. · **Could not paraphrase:** none. One sentence reads two ways and is raised below (D8's list against its predicate). + +### Corrections Made +- None. The body is 20,470 of 20,480 bytes; every correction below grows it or is the author's or the owner's. + +### Stage 0 checks (contract §11) +- **Path check:** `git merge-base origin/dev 0c5446974` = e24aaf9f0; `git diff --name-only e24aaf9f0..0c5446974 -- ':!docs/process/plans/'` lists `build_tools/scorecard-baseline.json` and 13 files under `src/Sharpy.Compiler.Tests/Conformance/`. Not seeded. PASS. +- **Green @ 656991807 (measured):** `ScopeMeaningDifferentialTests` + the two `RuleTable_` facts 6/0/0 (1.6 min): pool 2225 (683 must-run, 1542 must-refuse), python agreed 30/30, red 639, allowlist 639 (463 / 26 / 150 cite #2423 / #2432 / #2417). Both generated types, `ClassBodyReadPositionMatrixTests`, `StaticInitializerOrderMatrixTests`, `ConstantPositionValidator*`: 304/0/0 (11.3 min) after the last restore; the 8951 pool ran 8951, python agreed 8951/8951, allowlist 2368, no red outside it. Table: 198 rows, 49 rules. `scorecard_metrics.py --check`: OK (seed 2368, outside 1211; the base holds 572). `check_spec_blocks.sh`: sweep clean, failing 0. CI on #2767 at this tip: every gate green; `review-line` red (no review line yet). +- **The enumeration and the totality assertions, as read.** A cell's tag and rule come from its one row of `name-resolution-rules.txt` (`RuleTable_EveryCaseHasOneRow_AndTakesItsVerdictFromIt`); the twelve rows of this type carry no negated constraint. `Axes_EveryValueIsGeneratedOrExcluded` partitions, with no default arm: `BindingKind` (three times), `TypeKind` (twice), `SemanticType`'s concrete subclasses, `Spelling`, `ReadPosition`, `Order` per set, `LocalTarget`, `AdmissionTable`, `ScopeKind`, the declared properties of the alias's three AST records, and the Stdlib census of `FieldSignature` (`IsConst` × `IsGuarded`); it pins the alias binders to the pool's binder census. `Exclusions_RestingOnTheCompiler_GoRedWhenItChanges` runs six probes. +- **Mutations re-run, each ALONE, from a `cp` copy, restored and confirmed by `cmp`:** + - totality: the `N1-alias-target` row deleted → both `RuleTable_` facts red, "matches no row" (2 failed); + - a passing case listed known-red (`read/alias-target/Declared/Unused/Later/struct/optional`) → `ScopeMeaning_Sweep` red, STALE, allowlist 640 (1 failed, 4 passed); + - one per axis family, one run each, `Axes_…` red each time (1 failed): the lambda table's hosts removed ("constant-kind × host: LambdaParameterDefault is neither generated nor excluded"); `sys.maxsize` listed as a CLR literal ("discovery records it (False, False)"); the `(false, false)` census shape removed; `ModuleEnum` removed from the callee outers; the struct alias host removed; `TypeAnnotation.ErrorType` removed; `BaseList`'s exclusion removed; the R-QI struct host removed; the alias set's `Self` exclusion removed. The stage-0 body records these applied together; each alone is this pass's record; + - a falsifier probe handed a compiling program (`x: int = 5` for the module `let`) → `Exclusions_…` red (1 failed); + - **a control that stays green:** the `local-const` host removed from `ConstantHosts[ConstInitializer]` → `Axes_…` 1 passed. The hosts under a table are a hand list (finding 2); + - all restored → the 304/0/0 above; `git status --short` empty. + +### Adequacy +- **Contract:** named — one answer per name for every binding kind, order, spelling and reading position; a refusal under one code where python's reading differs; a constant position refuses a non-constant itself. +- **Axes:** open: constant-kind × member kind ← the kinds of member a constant position's resolver answers for (D8: every member access the checker bound — a type's own members, which are `BindingKind`'s; a referenced TYPE's literal, non-literal static and enum member; a referenced module's values, the one part the census covers); constant-kind × host ← the readers of each `AdmissionTable` value (a call-site census of `ConstantDefaultClassifier.IsAdmitted`: 6 @ e24aaf9f0, three in the validator, two in `ConstEligibility`, one in `CodeGenInfoComputer`). The other axes pass 1 named are roster-closed, each with its assertion and that assertion's mutation. The 8951 pool's rosters are P77a's and were not re-graded. +- **Cure:** seam + sweep — silent wrong behaviour, a position missing a shared check, SPY0908 as a net. +- **Harness:** named + allowlist delta (of the 2368 seed rows, 1076 / 6 / 27 cite #2423 / #2398 / #2432; 639 rows of the new type). +- **Layer:** D8's rung-3 arm names a fact that exists for a module's fields only (finding 1); no rule reads a builtin or type name. + +### Scope & convergence +- **Group:** one (P78; chores none; #2432 in by R-KV) · **Alone:** no — required? no · **Gates:** 1 +- **Generator:** existing `NameResolutionDifferentialTests` + stage 0 @ 0c5446974, mutations re-run. Hand controls named: the project route (A3); steer text and count per position × host. +- **Trackers named:** #2427, #2457, #2486, #2397, #2417, #2069, #2249, #2383, #2768 · **Fidelity rows:** named. +- **Convergence (contract §12):** the previous pass was NEEDS REVISION on Dimension 6, so the rule was applied. Findings 1 and 2 are not deferrable: finding 1 changes what D8's resolver answers and has no catcher; finding 2 is a value missing from a hand-listed refinement. NEEDS REVISION stands. Findings 3 to 6 are deferrable and are also written in the deferred-row form. + +### Findings +Each carries its second-pass label against 55846bb3f. Programs are `sharpyc run` @ 656991807, each with a running control. + +1. **D8's list refuses a constant that works today, and no cell would see it** (Dimension 4 design row + Dimension 6; **re-opened**: the log says stage 0 closes the seven axes, and pass 1 named this one "the member kinds `IsMemberConstAdmissible` answers for"). D8 answers true for a `const`, an enum member and its `.value`, and "a literal of a referenced module (discovery's `IsConst`)", and false for "every other bound member". A literal field of a referenced TYPE is bound by the checker (`b: bool = int.max_value` is SPY0220) and is none of the three. `def f(x: int = int.max_value)` prints `2147483647` today, and `x: float = Math.PI` prints `3.141592653589793`; `Int32.max_value` runs as a parameter default (through `from system import` and through `system.`), a dataclass field, an enum member's value, an attribute argument and a struct property default. `IsConst` is set in one place, `OverloadIndexBuilder.cs:636`, for a module's fields; a type's field has no such fact. Read as written, D8 makes these SPY0401: `worked` → refused, unruled, against D8's own predicate ("no constant admitted today is refused"). No case of either pool hands a constant position a referenced type's member, and a grep of the `.spy` fixtures for `int.`, `Int32.` and `Math.` in a default found none, so nothing goes red. The same axis has two more parts with no case: a referenced type's non-literal static (`String.empty`, `Environment.processor_count` as a default: CS1736 behind SPY0908), and a type's OWN members at the four hosts the 8951 pool has no position for (lambda default, attribute argument, module and local `const`). `@[system.component_model.default_value(H.x)]` with `x` a `@static` field, an `auto` field, a `@static property`, an inherited field or a computed `const` is CS0182 behind SPY0908, and `E.RED.value` there is SPY0909 (`Unsupported decorator argument expression: MemberAccess`); the lambda-default twins are SPY0401 already. +2. **The hosts that reach a table are a hand list, and one reader sits outside the validator** (Dimension 6; **new**). `CodeGenInfoComputer.MarkStructConstructorProperty` classifies a struct's defaulted auto-property against `AdmissionTable.ParameterDefault` with no resolver, so the shape rule answers alone. `struct S: property p: int = H.x` (a `@static` field), `= math.pi` and `= sys.maxsize` are CS1736 behind SPY0908; `= five()`, a bare module variable, a `const`, and the same property in a class or in a struct with its own `__init__` all run `5`. It is #2432's class by its title ("a default through H.x is CS1736"). D8 names the validator; T10 does not list `CodeGenInfoComputer.cs`; the 8951 pool's `InstancePropertyDefault` host is a class; this type's `ParameterDefault` host is a `def`. The green control above shows the assertion cannot see a missing host. +3. **D8's "bound" does not hold at an attribute argument** (Dimension 4; **new**; deferrable). The checker visits no bracket-attribute argument: its one reader of a decorator is `DetectGeneratorAttributes`, and the `DecoratorArgument` cells carry SPY0452 (unused import) on the import their argument names. "The shape rule keeps only what the checker did not bind" therefore keeps every attribute argument, and "prints a bound member by the ordinary read route" has no binding to print. A9's attribute bullets need the checker to check each attribute argument first, in a `TypeChecker` file T10 does not list. +4. **Nothing pins an unused self-reaching alias** (Dimension 7; **new**; deferrable). `type K0 = K0`, `type K0 = list[K0]`, a two-alias ring and a function-scoped one, all unused, run `1` today. D10 resolves a target at the declaration; the alias set excludes orders `Self` and `Cycle` whole; #2769's body carries the warning and the plan does not. Resolved eagerly they recurse in `ExpandTypeAlias`, and a stack overflow is no diagnostic. +5. **D10's module-level binder runs before imports and before later types exist** (Dimension 3; **new**; deferrable). `ResolveTypeAliasDeclaration` is name resolution's; a dotted target and a target declared later cannot be judged there. The `dotted` and `Later` must-run cells are the catcher. +6. **A reason that is false as written** (Dimension 1; **new**; deferrable). `TypeKind.Delegate` is excluded twice as "no Sharpy declaration"; `delegate` is a keyword with `DelegateDef`. The exclusion stands for another reason: a delegate declaration has no body to host a member or an alias. + +**settled** (an owner ruling decides it; not raised): #2487 stays open (comment 7039834146 item 6); the nine must-run cells, D10's refusal and #2432's close on SPY0401 (7030074628). **declined:** none in the log. **churn:** none; no cure above undoes an answer the revision gave. + +The orchestrator's decisions and defaults, graded as claims: +- D9 stays at T8 (7039834146): sound; stage 0 cannot hold it without seed rows item 1 did not approve. +- The `auto` field typed read cites #2417 (7039834146): sound, and held by a rule (`ProposedCite`, with its fact): 150 rows, each red at the earlier order or the later twin of one. +- D4's crossing stays variable-only (7039834146): matches `Scope.ResolveName` (`hit is VariableSymbol`). +- A recursive alias is out of P78 (7041455175 item 1): sound as scope, and it needs no owner's word while it changes no behaviour; finding 4 is what makes that hold. +- No SPY0240 for a ring of unannotated lambdas (7041455175 item 2): sound; the ring runs `1` today and D2 adds no refusal. It needs no owner's word. + +Decisions that are the owner's (this pass asked nothing): +1. **Finding 1.** (a) One more revision and a stage-0 commit: D8 answers true for a literal field of any referenced type or module, by a CLR-keyed fact (rung 3) where discovery has none, and the member-kind axis is closed against the bound-member kinds named under Axes; `allowlist_rows_outside_seed` rises by the measured red count; a third pass, limited to D8 and the constant-kind set, needs the line `Extra verify pass 3: owner …`. (b) D8 answers only for the members it lists and leaves every other bound member to the shape rule, and the referenced-type and own-member cells go to #2432, which then does not close in P78. (c) Implement as written. Recommended: (a). Under (c) a refusal of `int.max_value` as a default lands with nothing to catch it. +2. **Finding 2.** (a) The same stage-0 commit pins the hosts to the reader census and adds the struct auto-property host (must-run: the default keeps its initializer, as `five()` does today); T10 gains `CodeGenInfoComputer.cs`. (b) The host goes to #2432 as a cell and #2432 stays open. Recommended: (a). + +### Falsifiability +- A1 / M1, A2 / M2 (two), A3 / M3, A4 / M4 (and the census pin), A5 / M5 (four), A6 / M6 (two), A7 / M7 (with its control), A9 / M9 (four), A10 / M10, A13 / M13 (two): mutation named; exemption not subject; positive control yes; by-direction specified. +- D2's in-progress mark: mutation MISSING — expected: remove the mark → `@static a: auto = lambda: H.b` beside `@static b: auto = lambda: H.a` (runs `1` today) no longer terminates; restored → `1`. +- A8 (the direction record): every code now. It cannot see finding 1's programs: none is in a fixture, a spec block or the `.spy` stdlib. +- A11: each example discriminates. A12: an absence assertion whose positive control is the staleness gates. +- Stage 0's facts and sweeps: mutations re-run above, each alone. + +### Deferred findings +- (not CONVERGED; findings 3 to 6 in the form a CONVERGED stamp would list them) +- D8's "bound" at an attribute argument ← the checker's visits of `Decorator.Arguments` (none) — fix: the checker checks each bracket-attribute argument as an expression — proved by `ScopeMeaning_Sweep` (the `DecoratorArgument` rows stay red until it does) and M9's fourth mutation. +- alias-target × order `Self`, `Cycle` ← `Order` — fix: generate the unused cells as must-run and keep the used ones excluded citing #2769 (`ExcludedOrders["alias-target"]`) — proved by `Axes_EveryValueIsGeneratedOrExcluded` and the sweep. +- D10's module-level judgement ← the pipeline order — fix: judge the target once every type and import is declared — proved by the `dotted` and `Later` must-run cells. +- `ExcludedDeclarationHosts[Delegate]`, `ExcludedAliasTypeHosts[Delegate]` ← `DelegateDef` — fix: the reason's text — proved by `Parser.cs` (`TokenType.Delegate => ParseDelegateDef()`). + +### Warnings +- T3 lists two `TypeChecker` files; the 33 sites are in ten (count re-measured: 33). The census pin is the catcher. +- A1's, A4's, A5's and A6's "which decision drains which rule" is the author's reading, not run. +- The Generator line does not name "one value per declared type" or "the hosts under a table" among its hand lists. +- `case subprocess.PIPE:` and `case m.K:` (SPY0202 "Undefined type … in pattern"; python `1`) are outside this plan's contract: the pass report's ledger. + +### Missing Steps Added +- None added to the body (the cap). For the revision: D8's list and its rung; `CodeGenInfoComputer.cs` in T10; the `TypeChecker` file that checks attribute arguments; the mutation for D2's mark; the unused self-reaching alias control. + +### Unchecked Claims +- D2's pre-pass and first-read check drain the 280 typed-read rows that cite #2423: a design with no prototype. That D2 also types the #2417 cells: not run; the ratchet's STALE arm reports it. +- D5's "one resolver carries all 33 sites": the count is measured, the rest untraced. +- D1's cold and warm export identity and the bridge arm's deletion: the code's own note says the same; not run. +- "No snapshot moves" (A12): the regeneration after T1 and T4 proves or refutes it. +- A11's 22 declarations in five spec files, and that each becomes SPY0620: pass 1's count, not re-taken. +- `TypeResolver.cs` as where a generic alias's body resolves: `ExpandTypeAlias` is there and is reached at a use; the type-parameter substitution was not traced. +- Not run: a control at the base sha (product code at this tip is the base's), the whole `build_tools/tests` suite, the hand controls' own mutations, a local whole-solution gate (CI at this tip is green). From 3a422a6fe5e8b02324231010a3e6c658ce2a4f06 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 16:20:27 +0000 Subject: [PATCH 12/22] test(conformance): P78 stage 0: pin constant readers, member kinds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stage 0 of plan-777361 (P78; verification contract §11), answering the second /verify-plan pass (NEEDS REVISION, Dimension 6 @ 656991807) as the owner ruled on 2026-11-20 (#2423 comment 7042723494, items 7 to 9). Test code and the scorecard baseline only; no product path. Finding 1, ruling 7: the constant member-kind axis is closed against the bound-member kinds. ScopeConstantKind is the image of what the compiler records for a member, per where the member lives: - a referenced module's value <- the Stdlib census of FieldSignature (IsConst x IsGuarded), as before, now also named bare through `from m import x` (N7: a spelling); - a referenced type's member <- the subclasses of ClrMemberResolution, a Field refined by FieldInfo.IsLiteral and an enum owner. Generated: literal field (int.max_value through a builtin's name, an imported name and a module-qualified one; Math.PI), enum member (DayOfWeek.Monday), static readonly field, static property, a method and a method group read uncalled. Excluded: NestedType (SPY0220), AbsentResult (SPY0203), InconclusiveResult (nothing is bound). Each expression is checked against ClrMemberTypeResolver's own answer; - the program's own enum <- EnumMemberAccessKind and the member itself, per enum shape (six kinds); - any other name of the program <- BindingKind: the typed-read set's 13 kinds under each annotation, through the type's name or a subclass's, a callable read uncalled, and a builtin. Excluded: the type-denoting kinds (SPY0220), a constructor and every call form (EmittableConstantKind.Call by shape), the locals, ModuleLet. Own names are generated at every host, the 8951 pool's five positions included: that pool's qualified reads sit inside the member's own type. Finding 2, ruling 8: a host is keyed by the READER that judges it, a call site of ConstantDefaultClassifier.IsAdmitted found by a syntax census of src/Sharpy.Compiler (ScopeMeaningDifferentialTests.Readers.cs; a site whose table is its method's parameter is counted at each caller that passes one). The six call sites are nine readers: the validator's def, lambda, dataclass and struct defaults, an attribute's positional and named arguments, ConstEligibility.Compute (a `const`, refined by ScopeKind x TypeKind into six sites), MarkStructConstructorProperty (the struct auto-property host, new: every expression must run there), and IsExportedConstCompileTime (excluded: the cross-module route, the plan's hand control A3). A host's AdmissionTable is read from its reader's call. 9 hosts become 14: +attribute-keyword, +block-const, +struct-const, +interface-const, +struct-auto-property. Finding 4, ruling 9: an alias whose target reaches the alias itself has its UNUSED cells (ScopeAliasTarget.Itself, orders Self and Cycle, every site and shape but the module-qualified one: 126 cells), tagged must-run; all 126 run. The used ones stay excluded citing #2769: named by an annotation the alias overflows the compiler's stack, so no in-process probe can hold it (`type K0 = list[K0]` named by a parameter: `sharpyc run` exits 134, stack overflow in TypeResolver.ExpandTypeAlias, re-measured here). A red one would cite #2769 (ProposedCite; the ratchet fact holds it). Finding 6: TypeKind.Delegate's exclusion says why it stands (a `delegate` declaration has no body), with its probe (SPY0100). Rule table: 198 -> 207 rows, 49 -> 52 rules (+#1938: a struct auto-property keeps a non-constant default's initializer; +kind:SPY0336; +#2769). A string enum's member, its `.value` and any `.name` are tagged as non-constants (SPY0401 at a default): by call 43, not ruled. Counts @ this commit (product code == e24aaf9f0): ScopeMeaningDifferentialTests 3070 cases (1224 must-run, 1846 must-refuse; python agreed 30/30), 829 known-red rows: 463 cite #2423, 216 #2432, 150 #2417. constant-kind 770 cells / 216 red (was 51 / 26): module value 96/38, type member 119/33, own enum 79/54, own name 450/85, chain 26/6. alias-target 546 / 70 red (was 420 / 70). The other routes are unchanged. NameResolutionDifferentialTests unchanged: 8951 cases, 2368 rows. Scorecard: allowlist_rows_outside_seed 1211 -> 1401 (+190), by `scorecard_metrics.py --set-baseline allowlist_rows_outside_seed`; then `--check`: OK. The owner's word is item 7 of #2423 comment 7042723494: "Admit; close the axis (Recommended)", whose option read "The outside-seed allowlist baseline rises by the measured red count", and which decides "`allowlist_rows_outside_seed` may be raised by that commit's measured red count". Not raised: CellBudget, allowlist_rows_seed; no seed registration. New probes (Exclusions_RestingOnTheCompiler_GoRedWhenItChanges, 6 -> 15): a delegate body (SPY0100), a `const` in an enum body (SPY0101) and a union body (SPY0104), a lambda parameter of function type with a default (SPY0103), a float enum member value (SPY0253), a nested type in an int slot (SPY0220), a missing member (SPY0203), a call as a default (SPY0401), a local as a lambda's default (SPY0401). Mutations: each ALONE, from a cp copy, restored with cp and confirmed by cmp; the six facts that run no cell were run each time (6 tests), the sweep alone for the last two. Red -> the failing fact's first line: - totality: the kind:SPY0336 row deleted -> both RuleTable_ facts red (4 passed, 2 failed; 51 rules, not 52) - a reader removed (the struct auto-property entry) -> Axes_ red, "constant-kind x reader: CodeGenInfoComputer.cs: MarkStructConstructorProperty is neither generated nor excluded", and both RuleTable_ facts (3 failed) - PRODUCT side, never committed: a tenth IsAdmitted call added to CodeGenInfoComputer.cs -> Axes_ red, "constant-kind x reader: CodeGenInfoComputer.cs:P78StageZeroMutation is neither generated nor excluded" (1 failed) - a reader's host emptied (lambda) -> Axes_ red, "... has no host" - the local-const host removed, pass 2's control that stayed green -> Axes_ red, "constant-kind x const site: FunctionLike is neither generated nor excluded" - the struct-const host removed -> "... const type body: Struct ..." - NestedType's exclusion removed -> "constant-kind x type member: NestedType is neither generated nor excluded" - an expression under the wrong kind (a property under ClrTypeStaticField) -> "the checker's resolver answers Property for Array.max_length"; (sys.maxsize under ClrLiteralField) -> "discovery records sys.maxsize (IsConst, IsGuarded) = (False, False)" - StringEnumName removed -> "constant-kind x enum access: StringName is neither generated nor excluded" - Constructor's exclusion removed -> "constant-kind x own name: ..."; Form.Ctor's -> "constant-kind x read form: Ctor ..." - (Itself, Used)'s exclusion removed -> "alias-target x target x use: (Itself, Used) is neither generated nor excluded"; the dotted shape's -> "alias-target x self-reaching shape: dotted ..." - the Itself cells not generated -> Axes_, both RuleTable_ facts and Ratchet_ red (4 failed) - the census no longer following a table parameter -> ConstantReaders_TheCensusSeesACallSite... red (A and B missing), Axes_ and both RuleTable_ facts (4 failed) - ProposedCite's #2769 branch removed -> Ratchet_ red (1 failed) - each of the nine new probes handed a program that compiles, one run each -> Exclusions_ red, "rests on SPY0xxx, and the probe now gives [] stdout '1'" (1 failed each) - a passing case listed known-red (struct-auto-property/ ClrTypeLiteralField/int.max_value) -> ScopeMeaning_Sweep red, "listed as Ice, now Match: STALE", allowlist 830 (1 failed) - a known-red row deleted (struct-auto-property/OwnMember/StaticField/ Annotated) -> ScopeMeaning_Sweep red, "Ice ... (MustRun, #1938): Sharpy Ice [SPY0908 CS1736]; model '5'" (1 failed) - all restored -> green, the run below; `git status` lists this commit's files only. Runs @ 19ffa7ad1 + this diff: ScopeMeaningDifferentialTests + NameResolution's RuleTable fact: 7/0/0 (2.4 min). After the last restore: both generated types, ClassBodyReadPositionMatrixTests, StaticInitializerOrderMatrixTests, ConstantPositionValidator*: 305/0/0 (14.1 min). pytest build_tools/tests -k "scorecard or allowlist or plan_caps or plan_refs": 199 passed. `dotnet format whitespace --verify-no-changes` on the four .cs files: clean. Not run: the whole solution (CI on the plan pull request is the gate), check_spec_blocks.sh (no spec or product path moves). Hand lists that remain, named in the plan: one host per reader (the `const` reader's excepted), one expression per member kind, three receivers of a type's literal, the int-enum host of an enum member's value. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01LGMKZVcFYGqQRfHgd16DLa --- build_tools/scorecard-baseline.json | 2 +- .../NameResolutionDifferentialTests.Checks.cs | 5 +- .../ScopeMeaningDifferentialTests.Axes.cs | 469 +++++++++++++++--- .../ScopeMeaningDifferentialTests.Readers.cs | 130 +++++ .../ScopeMeaningDifferentialTests.cs | 169 ++++++- .../Conformance/name-resolution-rules.txt | 26 +- .../scope-meaning-differential-allowlist.txt | 197 +++++++- 7 files changed, 900 insertions(+), 98 deletions(-) create mode 100644 src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Readers.cs diff --git a/build_tools/scorecard-baseline.json b/build_tools/scorecard-baseline.json index ac0de6096..f6d197a48 100644 --- a/build_tools/scorecard-baseline.json +++ b/build_tools/scorecard-baseline.json @@ -1,6 +1,6 @@ { "procedure_bytes": 145560, "claude_md_bytes": 9304, - "allowlist_rows_outside_seed": 1211, + "allowlist_rows_outside_seed": 1401, "allowlist_rows_seed": 2368 } diff --git a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Checks.cs b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Checks.cs index 028d6e23d..b1bc2b243 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Checks.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/NameResolutionDifferentialTests.Checks.cs @@ -810,8 +810,9 @@ public void RuleTable_EveryCellHasOneRow_AndEveryRowACell() "a cell's tag and rule are its one row's, a row no cell matches rules nothing, and a refusal under a rule says which codes it admits"); // Measured literals: a table or a generator that stopped citing a rule would otherwise pass an emptier check. 44 rules of this - // pool, and the five only ScopeMeaningDifferentialTests has cells for (R-QI, N1-typed-read, N4, SPY0425, N1-alias-target). - RuleTable().Select(r => r.Rule).Distinct(StringComparer.Ordinal).Should().HaveCount(49); + // pool, and the eight only ScopeMeaningDifferentialTests has cells for (R-QI, N1-typed-read, N4, #1938, SPY0425, kind:SPY0336, + // N1-alias-target, #2769). + RuleTable().Select(r => r.Rule).Distinct(StringComparer.Ordinal).Should().HaveCount(52); // 29 rules with an entry, and the seeds', which carry their own codes. pool.Where(RefusalIsAnOutcome).Select(c => c.Rule).Distinct(StringComparer.Ordinal).Should().HaveCount(30); } diff --git a/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Axes.cs b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Axes.cs index 060a3aca6..d2db958b2 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Axes.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Axes.cs @@ -1,4 +1,5 @@ using System.Reflection; +using Sharpy.Compiler.Discovery; using Sharpy.Compiler.Discovery.Caching; using Sharpy.Compiler.Semantic; using Sharpy.Compiler.Semantic.Validation; @@ -23,10 +24,14 @@ namespace Sharpy.Compiler.Tests.Conformance; /// typed-read × spelling, × reader positionSpelling and , as the /// P77a pool runs a read of the kind (): the pool's own rosters decide where a read is legal /// callee × outer (Enum.GetValues) -/// constant-kind × hostAdmissionTable, the validator's own enumeration of constant positions -/// constant-kind × member kinda census of what discovery records for every value of every -/// Stdlib module (FieldSignature.IsConst × IsGuarded), which is what a checker's answer for a bound module -/// member can rest on +/// constant-kind × hostthe call sites of ConstantDefaultClassifier.IsAdmitted in the compiler's +/// source (a census: ScopeMeaningDifferentialTests.Readers.cs), each with the AdmissionTable it passes; the one +/// site that judges a const at every scope is refined by ScopeKind × TypeKind +/// constant-kind × member kindwhat the compiler records for a member, per where the member +/// lives: a referenced module's value (a census of discovery's FieldSignature.IsConst × IsGuarded over the +/// Stdlib), a referenced type's member (the subclasses of ClrMemberResolution, a field refined by +/// FieldInfo.IsLiteral), the program's own enum (EnumMemberAccessKind), and any other name of the program +/// () /// alias-target × siteScopeKind × TypeKind: the scope an alias's binder declares into /// alias-target × shapethe public properties of the alias's three AST records /// (TypeAlias, TypeAnnotation, FunctionType): each place a target can hold a type's name @@ -62,6 +67,15 @@ private static bool Refused(Harness.SharpyRun run, string code, string? cs = nul [EnumBodyHoldsCases] = new("enum H:\n type K0 = int\n RED = 1\n" + TailMain, "SPY0103", r => Refused(r, "SPY0103") || Refused(r, "SPY0101")), [UnionBodyHoldsCases] = new("union H:\n type K0 = int\n case A()\n" + TailMain, "SPY0104", r => Refused(r, "SPY0104")), [NeedsItsValue] = new("const x: int\ndef main() -> None:\n let y: int\n print(1)\n", "SPY0104", r => r.ErrorCodes.Count(c => c == "SPY0104") == 2), + [DelegateHasNoBody] = new("delegate D(x: int) -> int:\n type K0 = int\n" + TailMain, "SPY0100", r => Refused(r, "SPY0100")), + [EnumBodyHoldsNoConst] = new("enum H:\n const K: int = 1\n RED = 1\n" + TailMain, "SPY0101", r => Refused(r, "SPY0101")), + [UnionBodyHoldsNoConst] = new("union H:\n const K: int = 1\n case A()\n" + TailMain, "SPY0104", r => Refused(r, "SPY0104")), + [LambdaTakesNoCallableSlot] = new("def five() -> int:\n return 5\ndef main() -> None:\n f = lambda p: () -> int = five: p\n print(1)\n", "SPY0103", r => Refused(r, "SPY0103")), + [AnIntEnum] = new("enum H:\n RED = 1.5\n" + TailMain, "SPY0253", r => Refused(r, "SPY0253")), + [NamesAType] = new("class G:\n class x:\n v: int = 5\ndef f(p: int = G.x) -> int:\n return p\n" + TailMain, "SPY0220", r => Refused(r, "SPY0220")), + [NoSuchMember] = new("def f(p: int = int.nosuch) -> int:\n return p\n" + TailMain, "SPY0203", r => Refused(r, "SPY0203")), + [ACallByShape] = new("def five() -> int:\n return 5\ndef f(p: int = five()) -> int:\n return p\n" + TailMain, "SPY0401", r => Refused(r, "SPY0401")), + [ALocalInAConstantPosition] = new("def main() -> None:\n y: int = 5\n f = lambda p: int = y: p\n print(f())\n", "SPY0401", r => Refused(r, "SPY0401")), }; // ------------------------------------------------------------------------------------------- // @@ -133,7 +147,7 @@ internal sealed record Declared(string Text, bool InType, string Read, string? A [TypeKind.Interface] = InterfaceStaticIsNoStatic, [TypeKind.Enum] = EnumBodyHoldsCases, [TypeKind.Union] = UnionBodyHoldsCases, - [TypeKind.Delegate] = "no Sharpy declaration: `() -> int` is an annotation, never a host", + [TypeKind.Delegate] = DelegateHasNoBody, }; /// A declared type: its label in a cell's id, its spelling, a value of it, how main shows that value as @@ -310,14 +324,26 @@ internal sealed record TypedReader(BindingKind Kind, Harness.Spelling Spelling, private const string AReadOfItself = "a declaration that reads itself, directly or through a ring, is N3-cycle's: refused or thrown whatever its slot's type (the 8951 pool's Self and Cycle cells)"; private const string ARecursion = "a constructor that calls itself is a recursion, not an order of two declarations"; - private const string ARecursiveAlias = "an alias that names itself, directly or through a ring, has a target that is neither missing nor a declared type: a recursive alias is unruled (owner question raised with plan-777361's first revision)"; + private const string OverflowsTheCompiler = "#2769: named by an annotation, an alias whose target reaches the alias overflows the compiler's stack (`TypeResolver.ExpandTypeAlias`), and a process that dies leaves no verdict a cell can read (so no probe either: it would take the test host with it). The class is unruled and out of P78 (owner, #2423 comment 7042723494 item 9), so only the UNUSED alias has cells, and they keep running"; /// The orders with no cell, per cell set that has the axis: total over Order with the two every set generates. internal static readonly IReadOnlyDictionary> ExcludedOrders = new Dictionary>(StringComparer.Ordinal) { ["typed-read"] = new Dictionary { [Harness.Order.Self] = AReadOfItself, [Harness.Order.Cycle] = AReadOfItself }, ["init-overload"] = new Dictionary { [Harness.Order.Self] = ARecursion, [Harness.Order.Cycle] = ARecursion }, - ["alias-target"] = new Dictionary { [Harness.Order.Self] = ARecursiveAlias, [Harness.Order.Cycle] = ARecursiveAlias }, + ["alias-target"] = new Dictionary(), + }; + + /// The target × use pairs with no cell, total over the two enums with the pairs a cell carries. + internal static readonly IReadOnlyDictionary<(ScopeAliasTarget Target, ScopeAliasUse Use), string> ExcludedAliasUses = new Dictionary<(ScopeAliasTarget, ScopeAliasUse), string> + { + [(ScopeAliasTarget.Itself, ScopeAliasUse.Used)] = OverflowsTheCompiler, + }; + + /// The shapes whose name cannot be the alias itself, by label: every other shape has its self-reaching cells. + internal static readonly IReadOnlyDictionary ExcludedSelfReachingShapes = new Dictionary(StringComparer.Ordinal) + { + ["dotted"] = "the name is qualified by a module, and an alias is no member of one: `pathlib.K0` names nothing, which is the Missing cell", }; // ------------------------------------------------------------------------------------------- // @@ -399,63 +425,196 @@ internal sealed record OuterBinding(string Name, string Text, OuterScope Scope, }; // ------------------------------------------------------------------------------------------- // - // constant-kind (#2432): host × kind + // constant-kind (#2432): reader site × host × kind // ------------------------------------------------------------------------------------------- // - /// A host of a constant position: its label, the program around {e} typed {T}, the code its refusal - /// carries, the 8951 pool's position where it has one, whether the program prints 1 and not the value, whether it - /// takes an int only, and whether python has the same position. - internal sealed record ConstantHost(string Label, string Program, string Refusal, ReadPosition? Position = null, bool PrintsOne = false, bool IntOnly = false, bool Twin = false); + /// A host of a constant position: its label, the program around {e} typed {T} (with {s} where + /// main shows the slot's value, read into the local v), the code its refusal carries, the 8951 pool's position + /// where it has one, the imports the program itself needs, whether the program prints 1 and not the value, whether + /// it takes an int only, whether its slot can be given a function type, and whether python has the same position. + internal sealed record ConstantHost(string Label, string Program, string Refusal, ReadPosition? Position = null, string? Imports = null, bool PrintsOne = false, + bool IntOnly = false, bool NoCallableSlot = false, bool Twin = false); + + /// main for a host whose slot is read by , after . + private static string ShowIn(string read, string before = "") => $"{Main}{before} v: {{T}} = {read}\n print({{s}})"; + + private const string AttributeTarget = " def f(self) -> int:\n return 1\n" + Main + " print(H().f())"; + + private const string DelegateHasNoBody = "a `delegate` declaration is a signature on one line (`delegate D(x: int) -> int`, `DelegateDef`): it has no body to hold a member, a `const` or an alias (SPY0100)"; + private const string EnumBodyHoldsNoConst = "an enum body holds `NAME = value` cases and nothing else: a `const` there is SPY0101"; + private const string UnionBodyHoldsNoConst = "a union body holds cases and methods and nothing else: a `const` there is SPY0104"; + private const string NotADeclarationScope = "the scope of an initializer EXPRESSION's own locals: a declaration statement is no expression"; + private const string HoldsTypeParameters = "pushed to hold type parameters for one resolution step: it declares nothing a program writes"; + + /// Where a const is declared, total over ScopeKind with : the one + /// classifier call that judges a const initializer (ConstEligibility.Compute) judges it at every scope a + /// declaration can stand in. A type body is refined by . + internal static readonly IReadOnlyDictionary ConstSites = new Dictionary + { + [ScopeKind.Module] = new[] { new ConstantHost("module-const", "const K: {T} = {e}\n" + ShowIn("K"), "SPY0401") }, + [ScopeKind.TypeBody] = Array.Empty(), + [ScopeKind.FunctionLike] = new[] { new ConstantHost("local-const", ShowIn("K", " const K: {T} = {e}\n"), "SPY0401") }, + [ScopeKind.Block] = new[] { new ConstantHost("block-const", $"{Main} if True:\n const K: {{T}} = {{e}}\n v: {{T}} = K\n print({{s}})", "SPY0401") }, + }; + + internal static readonly IReadOnlyDictionary ExcludedConstScopes = new Dictionary + { + [ScopeKind.InitializerHost] = NotADeclarationScope, + [ScopeKind.Transparent] = HoldsTypeParameters, + }; - /// The constant positions, total over AdmissionTable with : every table the - /// validator judges a position by, each with the hosts that reach it. - internal static readonly IReadOnlyDictionary ConstantHosts = new Dictionary + /// The type bodies a const is declared in, total over TypeKind with . + internal static readonly IReadOnlyDictionary ConstTypeHosts = new Dictionary { - [AdmissionTable.ParameterDefault] = new[] + [TypeKind.Class] = new[] { new ConstantHost("class-const", "class H:\n const K: {T} = {e}\n" + ShowIn("H.K"), "SPY0401", ReadPosition.ConstInitializer) }, + [TypeKind.Struct] = new[] { new ConstantHost("struct-const", "struct H:\n const K: {T} = {e}\n w: int = 1\n" + ShowIn("H.K"), "SPY0401") }, + [TypeKind.Interface] = new[] { new ConstantHost("interface-const", "interface H:\n const K: {T} = {e}\n def m(self) -> int: ...\n" + ShowIn("H.K"), "SPY0401") }, + }; + + internal static readonly IReadOnlyDictionary ExcludedConstTypeHosts = new Dictionary + { + [TypeKind.Enum] = EnumBodyHoldsNoConst, + [TypeKind.Union] = UnionBodyHoldsNoConst, + [TypeKind.Delegate] = DelegateHasNoBody, + }; + + internal static IEnumerable AllConstSites() + => ConstSites.OrderBy(e => e.Key).SelectMany(e => e.Key == ScopeKind.TypeBody ? ConstTypeHosts.OrderBy(h => h.Key).SelectMany(h => h.Value) : e.Value); + + private const string OutsideOneFile = "the cross-module route: `ModuleLoader` judging a const another module of a project exports, with no SemanticInfo; this type compiles one file, and the route is plan-777361's hand control (A3)"; + + /// + /// The hosts of a constant position, keyed by the READER that judges them: a call site of + /// ConstantDefaultClassifier.IsAdmitted, as finds it in the compiler's source + /// (File:Method, #n for a method's nth site; a site whose table is its method's parameter is counted at each + /// caller that passes one). Total over that census with , so a reader the compiler gains + /// has no host here and is red, and a reader whose host is deleted is red too (the owner's ruling 8 of 2026-11-20). A host's + /// AdmissionTable is READ from its reader's call, never written here. + /// + internal static readonly IReadOnlyDictionary ConstantReaders = new Dictionary(StringComparer.Ordinal) + { + ["ConstantPositionValidator.cs:ValidateFunctionDefaults"] = new[] { - new ConstantHost("def", $"def f(p: {{T}} = {{e}}) -> {{T}}:\n return p\n{Main} print(f())", "SPY0401", ReadPosition.ParameterDefault, Twin: true), + new ConstantHost("def", "def f(p: {T} = {e}) -> {T}:\n return p\n" + ShowIn("f()"), "SPY0401", ReadPosition.ParameterDefault, Twin: true), }, - [AdmissionTable.LambdaParameterDefault] = new[] + ["ConstantPositionValidator.cs:ValidateLambdaDefaults"] = new[] { - new ConstantHost("lambda", $"{Main} f = lambda p: {{T}} = {{e}}: p\n print(f())", "SPY0401"), + new ConstantHost("lambda", ShowIn("f()", " f = lambda p: {T} = {e}: p\n"), "SPY0401", NoCallableSlot: true), }, - [AdmissionTable.DecoratorArgument] = new[] + // The two loops of one method: an attribute's positional arguments, then its named ones. + ["ConstantPositionValidator.cs:ValidateDecoratorConstantArguments"] = new[] { - new ConstantHost("attribute", $"class H:\n @[system.component_model.default_value({{e}})]\n def f(self) -> int:\n return 1\n{Main} print(H().f())", "SPY0425", PrintsOne: true), + new ConstantHost("attribute", "class H:\n @[system.component_model.default_value({e})]\n" + AttributeTarget, "SPY0425", PrintsOne: true), }, - [AdmissionTable.ConstInitializer] = new[] + ["ConstantPositionValidator.cs:ValidateDecoratorConstantArguments#2"] = new[] { - new ConstantHost("module-const", $"const K: {{T}} = {{e}}\n{Main} print(K)", "SPY0401"), - new ConstantHost("class-const", $"class H:\n const K: {{T}} = {{e}}\n{Main} print(H.K)", "SPY0401", ReadPosition.ConstInitializer), - new ConstantHost("local-const", $"{Main} const K: {{T}} = {{e}}\n print(K)", "SPY0401"), + new ConstantHost("attribute-keyword", "class Mark(Attribute):\n w: object = 0\nclass H:\n @[Mark(w={e})]\n" + AttributeTarget, "SPY0425", + Imports: "from system import Attribute", PrintsOne: true), }, - [AdmissionTable.PerInstanceFieldDefault] = new[] + ["ConstantPositionValidator.cs:ValidateDataclassFieldDefaults"] = new[] { - new ConstantHost("dataclass", $"@dataclass\nclass H:\n p: {{T}} = {{e}}\n{Main} print(H().p)", "SPY0401", ReadPosition.DataclassFieldInitializer, Twin: true), - new ConstantHost("struct", $"struct H:\n p: {{T}} = {{e}}\n{Main} print(H().p)", "SPY0401", ReadPosition.StructFieldInitializer, Twin: true), + new ConstantHost("dataclass", "@dataclass\nclass H:\n p: {T} = {e}\n" + ShowIn("H().p"), "SPY0401", ReadPosition.DataclassFieldInitializer, Twin: true), + }, + ["ConstantPositionValidator.cs:ValidateStructFieldDefaults"] = new[] + { + new ConstantHost("struct", "struct H:\n p: {T} = {e}\n" + ShowIn("H().p"), "SPY0401", ReadPosition.StructFieldInitializer, Twin: true), + }, + ["ConstEligibility.cs:Compute"] = AllConstSites().ToArray(), + // A struct's defaulted auto-property (#1938): a constant default becomes the synthesized constructor's parameter default, + // and any other default keeps its initializer, so every expression must run here (ruling 8). + ["CodeGenInfoComputer.cs:MarkStructConstructorProperty"] = new[] + { + new ConstantHost("struct-auto-property", "struct H:\n property p: {T} = {e}\n" + ShowIn("H().p"), "SPY0401"), }, }; + internal static readonly IReadOnlyDictionary ExcludedConstantReaders = new Dictionary(StringComparer.Ordinal) + { + ["ConstEligibility.cs:IsExportedConstCompileTime"] = OutsideOneFile, + }; + internal static readonly IReadOnlyDictionary ExcludedAdmissionTables = new Dictionary(); - /// The one constant position the validator judges by no table: an enum member's value. A table value added for it - /// has no entry in , which is red until this host moves under it. + /// The one constant position no classifier call judges: an enum member's value. A table value added for it has no + /// reader here, which is red until this host moves under it. internal static readonly ConstantHost EnumMemberHost = new("enum-member", $"enum H:\n RED = {{e}}\n{Main} print(H.RED.value)", "SPY0401", ReadPosition.EnumMemberValue, IntOnly: true); - /// The expression, its type, what it prints and what it imports. - internal sealed record ConstantExpression(string Label, string Text, string Type, string Prints, string? Import); + /// Every host with the table its reader passes; the enum member's value last, with none. + internal static IEnumerable<(AdmissionTable? Table, ConstantHost Host)> AllConstantHosts() + { + var census = ClassifierReaders.Value.Sites; + return ConstantReaders.Where(r => census.ContainsKey(r.Key)) + .SelectMany(r => r.Value.Select(h => (Table: (AdmissionTable?)census[r.Key], Host: h))) + .OrderBy(h => h.Table).ThenBy(h => h.Host.Label, StringComparer.Ordinal) + .Append((Table: null, Host: EnumMemberHost)); + } + + private const string LambdaTakesNoCallableSlot = "a lambda parameter's annotation cannot be a function type and take a default: `lambda p: () -> int = five: p` is SPY0103"; + private const string AnIntEnum = "the host is an int enum, whose member's value is an int: a `str` value declares a string enum, another host, and any other type is SPY0253"; + + /// Why a host has no cell for a slot of , or null when it has one. + internal static string? HostSkips(ConstantHost host, string type) + => host.IntOnly && type != "int" ? AnIntEnum + : host.NoCallableSlot && type.Contains("->", StringComparison.Ordinal) ? LambdaTakesNoCallableSlot + : null; + + /// The expression: its label, text, type and what it prints; the import line and the declarations it needs; how + /// main shows a value of its type ({0} the read); the codes its own kind's refusal carries beside the host's; + /// the binding kind a bare name of it has; the value of a referenced module it names (module.name, what + /// is keyed by) or the member of a referenced type; and its read form where it has one. + internal sealed record ConstantExpression(string Label, string Text, string Type, string Prints, string? Import = null, string? Prelude = null, string Show = "{0}", + string[]? Refusals = null, BindingKind Target = BindingKind.None, string? ModuleValue = null, Type? Owner = null, string? Member = null, Harness.Form? Form = null) + { + public bool Stdlib => ModuleValue != null; + } + + private static ConstantExpression ModuleValue(string module, string name, string type, string prints) + => new($"{module}.{name}", $"{module}.{name}", type, prints, Import: $"import {module}", ModuleValue: $"{module}.{name}"); + + /// The same value named bare through from module import name: a spelling, which changes no verdict (N7). + private static ConstantExpression ImportedValue(string module, string name, string type, string prints) + => new($"from-{module}-import-{name}", name, type, prints, Import: $"from {module} import {name}", Target: BindingKind.ImportedName, ModuleValue: $"{module}.{name}"); + + private static ConstantExpression TypeMember(string text, string type, string prints, Type owner, string member, string? import = null, string show = "{0}", string[]? refusals = null, Harness.Form? form = null) + => new(text, text, type, prints, Import: import, Show: show, Refusals: refusals, Owner: owner, Member: member, Form: form); + + private const string IntEnum = "enum E0:\n RED = 5"; + private const string StringEnum = "enum E0:\n RED = \"r\""; internal static readonly IReadOnlyDictionary ConstantExpressions = new Dictionary { - [ScopeConstantKind.ClrLiteralField] = new[] { new ConstantExpression("subprocess.PIPE", "subprocess.PIPE", "int", "-1", "subprocess") }, + [ScopeConstantKind.ClrLiteralField] = new[] { ModuleValue("subprocess", "PIPE", "int", "-1"), ImportedValue("subprocess", "PIPE", "int", "-1") }, [ScopeConstantKind.StdlibModuleVariable] = new[] { - new ConstantExpression("socket.AF_INET", "socket.AF_INET", "int", "2", "socket"), - new ConstantExpression("math.pi", "math.pi", "float", "3.141592653589793", "math"), + ModuleValue("socket", "AF_INET", "int", "2"), + ModuleValue("math", "pi", "float", "3.141592653589793"), + ImportedValue("math", "pi", "float", "3.141592653589793"), + }, + [ScopeConstantKind.ClrStaticMember] = new[] { ModuleValue("sys", "maxsize", "int", "2147483647"), ImportedValue("sys", "maxsize", "int", "2147483647") }, + // A literal field through each receiver a type has: a builtin's own name, an imported name, a module-qualified name. + [ScopeConstantKind.ClrTypeLiteralField] = new[] + { + TypeMember("int.max_value", "int", "2147483647", typeof(int), "max_value"), + TypeMember("Int32.max_value", "int", "2147483647", typeof(int), "max_value", "from system import Int32"), + TypeMember("system.Int32.max_value", "int", "2147483647", typeof(int), "max_value", "import system"), + TypeMember("Math.PI", "float", "3.141592653589793", typeof(Math), "PI", "from system import Math"), }, - [ScopeConstantKind.ClrStaticMember] = new[] { new ConstantExpression("sys.maxsize", "sys.maxsize", "int", "2147483647", "sys") }, - [ScopeConstantKind.ComparisonChain] = new[] { new ConstantExpression("ordered", "1 < 2 < 3", "bool", "True", null) }, - [ScopeConstantKind.ChainWithNonConstantLink] = new[] { new ConstantExpression("membership", "0 < 2 in [1, 2]", "bool", "True", null) }, + [ScopeConstantKind.ClrTypeEnumMember] = new[] { TypeMember("DayOfWeek.Monday", "DayOfWeek", "DayOfWeek.Monday", typeof(DayOfWeek), "Monday", "from system import DayOfWeek") }, + [ScopeConstantKind.ClrTypeStaticField] = new[] { TypeMember("BitConverter.is_little_endian", "bool", "True", typeof(BitConverter), "is_little_endian", "from system import BitConverter") }, + [ScopeConstantKind.ClrTypeStaticProperty] = new[] { TypeMember("Array.max_length", "int", "2147483591", typeof(Array), "max_length", "from system import Array") }, + [ScopeConstantKind.ClrTypeMethod] = new[] { TypeMember("Math.sqrt", "(float) -> float", "5.0", typeof(Math), "sqrt", "from system import Math", "{0}(25.0)", form: Harness.Form.Value) }, + [ScopeConstantKind.ClrTypeMethodGroup] = new[] + { + TypeMember("Math.abs", "(int) -> int", "5", typeof(Math), "abs", "from system import Math", "{0}(-5)", new[] { "SPY0336" }, Harness.Form.Value), + }, + [ScopeConstantKind.IntEnumMember] = new[] { new ConstantExpression("member", "E0.RED", "E0", "5", Prelude: IntEnum, Show: "{0}.value", Target: BindingKind.ModuleEnum) }, + [ScopeConstantKind.IntEnumValue] = new[] { new ConstantExpression("value", "E0.RED.value", "int", "5", Prelude: IntEnum, Target: BindingKind.ModuleEnum, Form: Harness.Form.EnumValue) }, + [ScopeConstantKind.IntEnumName] = new[] { new ConstantExpression("name", "E0.RED.name", "str", "RED", Prelude: IntEnum, Target: BindingKind.ModuleEnum) }, + [ScopeConstantKind.StringEnumMember] = new[] { new ConstantExpression("member", "E0.RED", "E0", "r", Prelude: StringEnum, Show: "{0}.value", Target: BindingKind.ModuleEnum) }, + [ScopeConstantKind.StringEnumValue] = new[] { new ConstantExpression("value", "E0.RED.value", "str", "r", Prelude: StringEnum, Target: BindingKind.ModuleEnum, Form: Harness.Form.EnumValue) }, + [ScopeConstantKind.StringEnumName] = new[] { new ConstantExpression("name", "E0.RED.name", "str", "RED", Prelude: StringEnum, Target: BindingKind.ModuleEnum) }, + [ScopeConstantKind.ComparisonChain] = new[] { new ConstantExpression("ordered", "1 < 2 < 3", "bool", "True") }, + [ScopeConstantKind.ChainWithNonConstantLink] = new[] { new ConstantExpression("membership", "0 < 2 in [1, 2]", "bool", "True") }, }; /// What discovery records for a value of a referenced module, and the kind that is its image: the two facts of @@ -473,9 +632,6 @@ internal sealed record ConstantExpression(string Label, string Text, string Type [(true, true)] = "a literal has no storage to guard", }; - /// The kinds that are no member of a module: closed by call 45 (a chain is admitted when each link is). - internal static readonly IReadOnlySet ChainKinds = new HashSet { ScopeConstantKind.ComparisonChain, ScopeConstantKind.ChainWithNonConstantLink }; - /// Every value of every module of the Stdlib, as discovery records it. private static readonly Lazy> StdlibModuleValues = new(() => { @@ -489,6 +645,141 @@ internal sealed record ConstantExpression(string Label, string Text, string Type return values; }); + private const string LiteralFieldShape = "Field/literal"; + private const string EnumFieldShape = "Field/enum"; + private const string StaticFieldShape = "Field/static"; + + /// + /// What the checker's resolver of a referenced type's member (ClrMemberTypeResolver) answers for a member read through + /// the type, and the kind that is its image: the subclasses of ClrMemberResolution, by name, with a field refined by + /// the two facts reflection has and discovery does not (FieldInfo.IsLiteral; a literal of an enum type is the enum's + /// member). Total over those subclasses with . + /// + internal static readonly IReadOnlyDictionary ClrTypeMemberShapes = new Dictionary(StringComparer.Ordinal) + { + [LiteralFieldShape] = ScopeConstantKind.ClrTypeLiteralField, + [EnumFieldShape] = ScopeConstantKind.ClrTypeEnumMember, + [StaticFieldShape] = ScopeConstantKind.ClrTypeStaticField, + [nameof(ClrMemberResolution.Property)] = ScopeConstantKind.ClrTypeStaticProperty, + [nameof(ClrMemberResolution.Method)] = ScopeConstantKind.ClrTypeMethod, + [nameof(ClrMemberResolution.MethodGroup)] = ScopeConstantKind.ClrTypeMethodGroup, + }; + + private const string UncheckedAtAnAttribute = "; at an attribute argument, which the checker does not visit today, it is one more cell of the class the instance-member and method-group cells there hold red, with the same cure"; + private const string NamesAType = "names a type: handed to a slot of another type it is the checker's own mismatch (SPY0220) at every position the checker checks" + UncheckedAtAnAttribute; + private const string NoSuchMember = "no member of the name: the checker refuses the read itself (SPY0203) and binds nothing" + UncheckedAtAnAttribute; + private const string TheCheckerDeclines = "the resolver declines to describe the member, so the checker binds nothing: a member nothing bound is outside the bound-member kinds by definition, and plan-777361's D8 leaves it to the shape rule"; + + internal static readonly IReadOnlyDictionary ExcludedClrTypeMemberShapes = new Dictionary(StringComparer.Ordinal) + { + [nameof(ClrMemberResolution.NestedType)] = NamesAType, + [nameof(ClrMemberResolution.AbsentResult)] = NoSuchMember, + [nameof(ClrMemberResolution.InconclusiveResult)] = TheCheckerDeclines, + }; + + /// The shape of read through , as the checker's resolver answers it. + internal static string ClrTypeMemberShape(Type owner, string member) + { + var resolution = new ClrMemberTypeResolver(new ClrTypeBridge()).Resolve(owner, member, ClrReceiverKind.StaticType); + if (resolution is not ClrMemberResolution.Field field) + return resolution.GetType().Name; + var info = owner.GetField(field.ClrName, BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy); + return info is not { IsLiteral: true } ? StaticFieldShape : owner.IsEnum ? EnumFieldShape : LiteralFieldShape; + } + + /// The enum reads, total over EnumMemberAccessKind (which half of which enum shape a .name / .value + /// read takes) and the member itself per shape, which has no access kind. + internal static readonly IReadOnlyDictionary EnumReadKinds = new Dictionary + { + [ScopeConstantKind.IntEnumMember] = (true, null), + [ScopeConstantKind.IntEnumValue] = (true, EnumMemberAccessKind.IntValue), + [ScopeConstantKind.IntEnumName] = (true, EnumMemberAccessKind.IntName), + [ScopeConstantKind.StringEnumMember] = (false, null), + [ScopeConstantKind.StringEnumValue] = (false, EnumMemberAccessKind.StringValue), + [ScopeConstantKind.StringEnumName] = (false, EnumMemberAccessKind.StringName), + }; + + /// The kinds that are no member: closed by call 45 (a chain is admitted when each link is). + internal static readonly IReadOnlySet ChainKinds = new HashSet { ScopeConstantKind.ComparisonChain, ScopeConstantKind.ChainWithNonConstantLink }; + + /// A read of a name the program declares: the kind, the spelling of its declaration's type, through which type the + /// member is named (Base: a subclass), its read form where it is a callable, the declarations, the read, the slot's + /// type, how main shows the value, and the codes the kind's own refusal carries. + internal sealed record OwnRead(BindingKind Kind, ScopeAnnotation? Annotation, DeclaringRelation? Relation, Harness.Form? Form, string? Prelude, string Text, string Type, string Show, string[]? Refusals); + + private const string ACallByShape = "read as a call it is `EmittableConstantKind.Call`, which every table refuses by the expression's shape before a name is resolved (SPY0401 at a default), so no member's kind is asked; at an enum member's value, which no table judges, a call is the 8951 pool's kind:enum-member-constant cell"; + private const string ALocalInAConstantPosition = "a local: only a lambda's default and a local `const` can name one, as a bare name the identifier resolver answers (a local that is no const is SPY0401 at a lambda's default)"; + + /// The kinds with no cell as a name of the program's own, total over with the kinds + /// generates, ModuleEnum (the enum reads) and ImportedName (a referenced module's value + /// named bare). + internal static readonly IReadOnlyDictionary ExcludedOwnReads = new Dictionary + { + [BindingKind.ModuleLet] = ModuleLetRefused, + [BindingKind.ModuleClass] = NamesAType, + [BindingKind.ModuleStruct] = NamesAType, + [BindingKind.ModuleUnion] = NamesAType, + [BindingKind.ModuleInterface] = NamesAType, + [BindingKind.ModuleTypeAlias] = NamesAType, + [BindingKind.NestedType] = NamesAType, + [BindingKind.Constructor] = ACallByShape, + [BindingKind.EnclosingLocal] = ALocalInAConstantPosition, + [BindingKind.Parameter] = ALocalInAConstantPosition, + [BindingKind.Inner] = ALocalInAConstantPosition, + [BindingKind.LocalVar] = ALocalInAConstantPosition, + [BindingKind.LocalLet] = ALocalInAConstantPosition, + [BindingKind.LocalLiteralConst] = ALocalInAConstantPosition, + [BindingKind.LocalComputedConst] = ALocalInAConstantPosition, + [BindingKind.LocalDef] = ALocalInAConstantPosition, + [BindingKind.LambdaTypedLocal] = ALocalInAConstantPosition, + [BindingKind.None] = "no binding", + }; + + /// The read forms with no cell, total over the 8951 pool's Form with the two a cell carries (Value: a + /// callable read uncalled; EnumValue: an enum member's .value). + internal static readonly IReadOnlyDictionary ExcludedConstantForms = new Dictionary + { + [Harness.Form.Call] = ACallByShape, + [Harness.Form.Ctor] = ACallByShape, + }; + + /// + /// The program's own names as a constant position is handed them: every kind of the typed-read set (: + /// each kind with an int-valued declaration of x), under each spelling of its declaration's type, named bare at module + /// level and through its type's name or a subclass's otherwise, a callable read UNCALLED (called, it is + /// ); and a builtin function, which is declared by no program. An instance member named through a + /// type is the kind refusal SPY0290 whatever the position. + /// + internal static readonly IReadOnlyList OwnReads = BuildOwnReads().ToList(); + + private static IEnumerable BuildOwnReads() + { + foreach (var (kind, t) in TypedReads.OrderBy(e => e.Key)) + { + bool callable = t.Member.EndsWith("()", StringComparison.Ordinal); + string name = callable ? t.Member[..^2] : t.Member; + foreach (var annotation in Enum.GetValues()) + { + var declaration = annotation == ScopeAnnotation.Annotated ? t.Annotated : t.Inferred; + if (declaration == null) + continue; + foreach (var relation in t.Level == MemberLevel.Module ? new DeclaringRelation?[] { null } : new DeclaringRelation?[] { null, DeclaringRelation.Base }) + { + var prelude = new List(); + if (t.NeedsFive) + prelude.Add(Five); + prelude.Add(t.Level == MemberLevel.Module ? declaration : "class G:\n" + Indent(declaration)); + if (relation == DeclaringRelation.Base) + prelude.Add("class D(G):\n pass"); + string receiver = t.Level == MemberLevel.Module ? "" : relation == DeclaringRelation.Base ? "D." : "G."; + yield return new OwnRead(kind, annotation, relation, callable ? Harness.Form.Value : null, string.Join("\n", prelude), receiver + name, + callable ? "() -> int" : "int", callable ? "{0}()" : "{0}", t.Level == MemberLevel.Instance ? new[] { "SPY0290" } : null); + } + } + } + yield return new OwnRead(BindingKind.Builtin, null, null, Harness.Form.Value, null, "abs", "(int) -> int", "{0}(-5)", null); + } + // ------------------------------------------------------------------------------------------- // // alias-target: site × shape × target × use × order // ------------------------------------------------------------------------------------------- // @@ -517,8 +808,8 @@ internal sealed record AliasSite(string Label, string Program, string Use, strin internal static readonly IReadOnlyDictionary ExcludedAliasScopes = new Dictionary { - [ScopeKind.InitializerHost] = "the scope of an initializer EXPRESSION's own locals: a `type` statement is no expression", - [ScopeKind.Transparent] = "pushed to hold type parameters for one resolution step: it declares nothing a program writes", + [ScopeKind.InitializerHost] = NotADeclarationScope, + [ScopeKind.Transparent] = HoldsTypeParameters, }; /// The type bodies an alias is declared in, total over TypeKind with . @@ -533,7 +824,7 @@ internal sealed record AliasSite(string Label, string Program, string Use, strin { [TypeKind.Enum] = EnumBodyHoldsCases, [TypeKind.Union] = UnionBodyHoldsCases, - [TypeKind.Delegate] = "no Sharpy declaration: `() -> int` is an annotation, never a host", + [TypeKind.Delegate] = DelegateHasNoBody, }; /// A target's shape: where in it the type's name {N} sits, whether the alias is generic, what it imports, and the @@ -654,29 +945,79 @@ void Carried(string route, IEnumerable owed, Func> re Carried("callee", CalleeOuters.Keys, c => new[] { c.Cell.Outer }); Carried("callee", new[] { BindingKind.Parameter }, c => new[] { c.Cell.Target }); - // constant-kind - Partition("constant-kind × host", Enum.GetValues(), ConstantHosts.Keys, ExcludedAdmissionTables.Keys); - Carried("constant-kind", ConstantHosts.Keys, Part); - Carried("constant-kind", ConstantHosts.Values.SelectMany(h => h).Append(EnumMemberHost).Select(h => h.Label), Marks); + // constant-kind: the readers, their hosts and their tables + var readers = ClassifierReaders.Value; + problems.AddRange(readers.Problems.Select(p => $"constant-kind × reader: {p}")); + Partition("constant-kind × reader", readers.Sites.Keys, ConstantReaders.Keys, ExcludedConstantReaders.Keys); + foreach (var hostless in ConstantReaders.Where(r => r.Value.Length == 0)) + problems.Add($"constant-kind × reader: {hostless.Key} has no host"); + var tables = ConstantReaders.Keys.Where(readers.Sites.ContainsKey).Select(k => readers.Sites[k]).Distinct().ToList(); + Partition("constant-kind × table", Enum.GetValues(), tables, ExcludedAdmissionTables.Keys); + Partition("constant-kind × const site", Enum.GetValues(), ConstSites.Keys, ExcludedConstScopes.Keys); + Partition("constant-kind × const type body", Enum.GetValues(), ConstTypeHosts.Keys, ExcludedConstTypeHosts.Keys); + foreach (var empty in ConstSites.Where(e => e.Key != ScopeKind.TypeBody && e.Value.Length == 0).Select(e => e.Key.ToString()) + .Concat(ConstTypeHosts.Where(e => e.Value.Length == 0).Select(e => e.Key.ToString()))) + problems.Add($"constant-kind × const site: {empty} is listed with no host"); + var hostLabels = AllConstantHosts().Select(h => h.Host.Label).ToList(); + foreach (var twice in hostLabels.GroupBy(l => l, StringComparer.Ordinal).Where(g => g.Count() > 1)) + problems.Add($"constant-kind × host: {twice.Key} is the label of {twice.Count()} hosts"); + Carried("constant-kind", tables, Part); + Carried("constant-kind", hostLabels, Marks); Carried("constant-kind", Enum.GetValues(), Part); + + // constant-kind: the member kinds, each against what the compiler records for the member var census = StdlibModuleValues.Value; - Partition("constant-kind × member kind", census.Values.Distinct().Concat(UnproducedModuleValueShapes.Keys), ModuleValueShapes.Keys, UnproducedModuleValueShapes.Keys); + Partition("constant-kind × module value", census.Values.Distinct().Concat(UnproducedModuleValueShapes.Keys), ModuleValueShapes.Keys, UnproducedModuleValueShapes.Keys); foreach (var shape in UnproducedModuleValueShapes.Keys.Where(s => census.Values.Contains(s))) - problems.Add($"constant-kind × member kind: {census.First(v => v.Value == shape).Key} is {shape}, which is listed as a shape no value has"); - Partition("constant-kind × kind", Enum.GetValues(), ModuleValueShapes.Values, ChainKinds); + problems.Add($"constant-kind × module value: {census.First(v => v.Value == shape).Key} is {shape}, which is listed as a shape no value has"); + Partition("constant-kind × type member", + typeof(ClrMemberResolution).GetNestedTypes(BindingFlags.Public | BindingFlags.NonPublic).Where(t => t.IsSubclassOf(typeof(ClrMemberResolution))) + .SelectMany(t => t.Name == nameof(ClrMemberResolution.Field) ? new[] { LiteralFieldShape, EnumFieldShape, StaticFieldShape } : new[] { t.Name }), + ClrTypeMemberShapes.Keys, ExcludedClrTypeMemberShapes.Keys); + Partition("constant-kind × enum access", Enum.GetValues(), EnumReadKinds.Values.Where(v => v.Access != null).Select(v => v.Access!.Value), Array.Empty()); + foreach (var intShape in new[] { true, false }.Where(isInt => !EnumReadKinds.Values.Contains((isInt, (EnumMemberAccessKind?)null)))) + problems.Add($"constant-kind × enum access: the member of {(intShape ? "an int" : "a string")} enum has no kind"); + Partition("constant-kind × kind", Enum.GetValues(), + ModuleValueShapes.Values.Concat(ClrTypeMemberShapes.Values).Concat(EnumReadKinds.Keys).Append(ScopeConstantKind.OwnMember), ChainKinds); + var ownKinds = OwnReads.Select(r => r.Kind).Append(BindingKind.ModuleEnum).Append(BindingKind.ImportedName).Distinct().ToList(); + Partition("constant-kind × own name", Enum.GetValues(), ownKinds, ExcludedOwnReads.Keys); + Carried("constant-kind", ownKinds, c => new[] { c.Cell.Target }); + Carried("constant-kind", Enum.GetValues(), Part); + Carried("constant-kind", new[] { DeclaringRelation.Base }, Part); + Partition("constant-kind × read form", Enum.GetValues(), Route("constant-kind").SelectMany(Part), ExcludedConstantForms.Keys); foreach (var (kind, expressions) in ConstantExpressions) { foreach (var e in expressions) { - if (ChainKinds.Contains(kind) != (e.Import == null)) - problems.Add($"constant-kind: {e.Label} is listed under {kind}, and a member kind is read off an imported module while a chain is not"); - else if (e.Import != null && !census.ContainsKey(e.Text)) - problems.Add($"constant-kind: discovery records no value {e.Text}"); - else if (e.Import != null && ModuleValueShapes.GetValueOrDefault(census[e.Text], kind) != kind) - problems.Add($"constant-kind: {e.Text} is listed under {kind}, and discovery records it (IsConst, IsGuarded) = {census[e.Text]}"); + if (e.ModuleValue != null) + { + if (!census.TryGetValue(e.ModuleValue, out var recorded)) + problems.Add($"constant-kind: discovery records no value {e.ModuleValue}"); + else if (!ModuleValueShapes.TryGetValue(recorded, out var image) || image != kind) + problems.Add($"constant-kind: {e.Label} is listed under {kind}, and discovery records {e.ModuleValue} (IsConst, IsGuarded) = {recorded}"); + } + else if (e.Owner != null) + { + var shape = ClrTypeMemberShape(e.Owner, e.Member!); + if (!ClrTypeMemberShapes.TryGetValue(shape, out var image) || image != kind) + problems.Add($"constant-kind: {e.Label} is listed under {kind}, and the checker's resolver answers {shape} for {e.Owner.Name}.{e.Member}"); + } + else if (EnumReadKinds.TryGetValue(kind, out var read)) + { + string suffix = read.Access switch + { + null => ".RED", + EnumMemberAccessKind.IntValue or EnumMemberAccessKind.StringValue => ".RED.value", + _ => ".RED.name", + }; + if (e.Prelude != (read.IntShape ? IntEnum : StringEnum) || !e.Text.EndsWith(suffix, StringComparison.Ordinal)) + problems.Add($"constant-kind: {e.Text} is listed under {kind}, which is `{suffix}` of {(read.IntShape ? "an int" : "a string")} enum"); + } + else if (!ChainKinds.Contains(kind) || e.Import != null || e.Prelude != null) + problems.Add($"constant-kind: {e.Label} is listed under {kind} and names no member the kind can be checked against"); } } - foreach (var kind in Enum.GetValues().Where(k => !ConstantExpressions.ContainsKey(k))) + foreach (var kind in Enum.GetValues().Where(k => k != ScopeConstantKind.OwnMember && !ConstantExpressions.ContainsKey(k))) problems.Add($"constant-kind: {kind} has no expression"); // init-overload @@ -690,6 +1031,12 @@ void Carried(string route, IEnumerable owed, Func> re Carried("alias-target", AllAliasSites().Select(s => s.Label).Concat(AliasShapes.Values.Select(s => s.Label)), Marks); Carried("alias-target", Enum.GetValues(), Part); Carried("alias-target", Enum.GetValues(), Part); + Partition("alias-target × target × use", + Enum.GetValues().SelectMany(t => Enum.GetValues().Select(u => (Target: t, Use: u))), + Route("alias-target").Select(c => (Target: c.Cell.Key!.Part()!.Value, Use: c.Cell.Key.Part()!.Value)), ExcludedAliasUses.Keys); + // A shape's name is the alias itself in some cell, or the shape says why it cannot be. + var selfReaching = Route("alias-target").Where(c => c.Cell.Key!.Part() == ScopeAliasTarget.Itself).SelectMany(Marks).ToHashSet(StringComparer.Ordinal); + Partition("alias-target × self-reaching shape", AliasShapes.Values.Select(v => v.Label).Distinct(), AliasShapes.Values.Select(v => v.Label).Where(selfReaching.Contains), ExcludedSelfReachingShapes.Keys); // The two binders of an alias, by the 8951 pool's census of binder sites: a third is a site this axis has not placed. var binders = NameResolutionRosters.BinderSites.Keys.Where(k => k.Contains("TypeAliasSymbol.CreateFrom", StringComparison.Ordinal)).OrderBy(k => k, StringComparer.Ordinal).ToList(); if (!binders.SequenceEqual(AliasBinderSites.OrderBy(k => k, StringComparer.Ordinal))) @@ -699,7 +1046,11 @@ void Carried(string route, IEnumerable owed, Func> re var reasons = ExcludedDeclarations.Values.Concat(ExcludedDeclarationHosts.Values).Concat(ExcludedValueTypes.Values).Concat(ExcludedTypedReads.Values) .Concat(ExcludedTypedSpellings.Values).Concat(ExcludedTypedPositions.Values).Concat(ExcludedCalleeBinders.Values).Concat(ExcludedCalleeOuters.Values) .Concat(ExcludedAdmissionTables.Values).Concat(UnproducedModuleValueShapes.Values).Concat(ExcludedAliasScopes.Values).Concat(ExcludedAliasTypeHosts.Values) - .Concat(ExcludedAliasShapeProperties.Values).Concat(ExcludedOrders.Values.SelectMany(o => o.Values)).ToHashSet(StringComparer.Ordinal); + .Concat(ExcludedAliasShapeProperties.Values).Concat(ExcludedOrders.Values.SelectMany(o => o.Values)) + .Concat(ExcludedConstScopes.Values).Concat(ExcludedConstTypeHosts.Values).Concat(ExcludedConstantReaders.Values).Concat(ExcludedClrTypeMemberShapes.Values) + .Concat(ExcludedOwnReads.Values).Concat(ExcludedConstantForms.Values).Concat(ExcludedAliasUses.Values).Concat(ExcludedSelfReachingShapes.Values) + .Concat(AllConstantHosts().SelectMany(h => new[] { "int", "() -> int" }.Select(t => HostSkips(h.Host, t))).Where(r => r != null).Select(r => r!)) + .ToHashSet(StringComparer.Ordinal); foreach (var orphan in BehaviourProbes.Keys.Where(k => !reasons.Contains(k))) problems.Add($"a probe guards the reason '{orphan}', and no exclusion gives it"); foreach (var blank in reasons.Where(string.IsNullOrWhiteSpace)) diff --git a/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Readers.cs b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Readers.cs new file mode 100644 index 000000000..6dfeca280 --- /dev/null +++ b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Readers.cs @@ -0,0 +1,130 @@ +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Sharpy.Compiler.Semantic.Validation; +using Sharpy.Compiler.Tests.Infrastructure; +using Xunit; + +namespace Sharpy.Compiler.Tests.Conformance; + +/// +/// The readers of a constant position's admission table, by a census of the compiler's source: what +/// is total over (plan-777361's stage 0; the owner's ruling 8 of +/// 2026-11-20, #2423 comment 7042723494). In its own file for the Roslyn namespaces, whose TypeKind is not the compiler's. +/// +public sealed partial class ScopeMeaningDifferentialTests +{ + /// The readers of an AdmissionTable value in a set of sources, and the calls whose table cannot be traced. + internal sealed record ReaderCensus(IReadOnlyDictionary Sites, IReadOnlyList Problems); + + /// + /// The call-site census of ConstantDefaultClassifier.IsAdmitted: a syntax scan, so a fact can hand it a snippet. A call + /// that names its table (AdmissionTable.X) is a reader, keyed File:Method. A call whose table is a parameter of + /// its method is no reader itself: the readers are that method's callers in the same file, each keyed by ITS method with the + /// table it passes. Anything else (a table that is neither, a method group, a method nobody calls) is a problem, never a + /// silent skip. + /// + internal static ReaderCensus ScanClassifierReaders(IEnumerable<(string File, string Text)> sources) + { + var sites = new Dictionary(StringComparer.Ordinal); + var problems = new List(); + var seen = new Dictionary(StringComparer.Ordinal); + + static string? Rightmost(ExpressionSyntax e) => e switch + { + IdentifierNameSyntax id => id.Identifier.ValueText, + MemberAccessExpressionSyntax m => m.Name.Identifier.ValueText, + _ => null, + }; + static AdmissionTable? TableOf(ExpressionSyntax e) + => e is MemberAccessExpressionSyntax m && Rightmost(m.Expression) == nameof(AdmissionTable) && Enum.TryParse(m.Name.Identifier.ValueText, out var table) ? table : null; + static MethodDeclarationSyntax? MethodOf(SyntaxNode node) => node.Ancestors().OfType().FirstOrDefault(); + static string Where(string file, SyntaxNode node) => $"{file}:{node.GetLocation().GetLineSpan().StartLinePosition.Line + 1}"; + + void Add(string file, SyntaxNode at, AdmissionTable table) + { + var key = $"{file}:{MethodOf(at)?.Identifier.ValueText ?? ""}"; + int ordinal = seen[key] = seen.GetValueOrDefault(key) + 1; + sites[ordinal == 1 ? key : $"{key}#{ordinal}"] = table; + } + + foreach (var (file, text) in sources.OrderBy(s => s.File, StringComparer.Ordinal)) + { + var root = CSharpSyntaxTree.ParseText(text).GetRoot(); + foreach (var name in root.DescendantNodes().OfType() + .Where(m => m.Name.Identifier.ValueText == nameof(ConstantDefaultClassifier.IsAdmitted) && Rightmost(m.Expression) == nameof(ConstantDefaultClassifier))) + { + if (name.Parent is not InvocationExpressionSyntax call || call.Expression != name || call.ArgumentList.Arguments.Count != 2) + { + problems.Add($"{Where(file, name)}: `{name.Parent}` uses the classifier's admission as something other than a call with a kind and a table"); + continue; + } + var tableArgument = call.ArgumentList.Arguments[1].Expression; + if (TableOf(tableArgument) is { } named) + { + Add(file, call, named); + continue; + } + var method = MethodOf(call); + int index = method == null || tableArgument is not IdentifierNameSyntax parameter + ? -1 + : method.ParameterList.Parameters.ToList().FindIndex(p => p.Identifier.ValueText == parameter.Identifier.ValueText); + if (index < 0) + { + problems.Add($"{Where(file, call)}: `{call}` takes its table from neither an AdmissionTable value nor a parameter of its method"); + continue; + } + var callers = root.DescendantNodes().OfType() + .Where(c => Rightmost(c.Expression) == method!.Identifier.ValueText && c.ArgumentList.Arguments.Count > index).ToList(); + if (callers.Count == 0) + problems.Add($"{Where(file, call)}: {method!.Identifier.ValueText} takes its table as a parameter, and nothing in {file} calls it"); + foreach (var caller in callers) + { + if (TableOf(caller.ArgumentList.Arguments[index].Expression) is { } passed) + Add(file, caller, passed); + else + problems.Add($"{Where(file, caller)}: `{caller}` passes {method!.Identifier.ValueText} a table that is no AdmissionTable value"); + } + } + } + return new ReaderCensus(sites, problems); + } + + /// The census over the compiler's own source. + private static readonly Lazy ClassifierReaders = new(() => + { + var dir = Path.Combine(DispatchSiteScan.FindRepoRoot(), "src", "Sharpy.Compiler"); + return ScanClassifierReaders(Directory.GetFiles(dir, "*.cs", SearchOption.AllDirectories) + .Where(f => !f.Contains($"{Path.DirectorySeparatorChar}bin{Path.DirectorySeparatorChar}", StringComparison.Ordinal) + && !f.Contains($"{Path.DirectorySeparatorChar}obj{Path.DirectorySeparatorChar}", StringComparison.Ordinal)) + .Select(f => (Path.GetFileName(f), File.ReadAllText(f)))); + }); + + /// The census's own control: it sees a call that names its table, follows a table that is a parameter to each + /// caller, numbers a method's second site, and reports a call it cannot trace. An absence ("no reader without a host") is + /// only as good as this. + [Fact] + public void ConstantReaders_TheCensusSeesACallSite_AndFollowsATableParameter() + { + const string source = + "class V {\n" + + " void A(S s) { Judge(s, AdmissionTable.ParameterDefault); }\n" + + " void B(S s) { Judge(s, Validation.AdmissionTable.ConstInitializer); }\n" + + " void Judge(S s, AdmissionTable table) { if (!ConstantDefaultClassifier.IsAdmitted(K(s), table)) return; }\n" + + " void C() { var a = ConstantDefaultClassifier.IsAdmitted(k, AdmissionTable.DecoratorArgument); var b = Validation.ConstantDefaultClassifier.IsAdmitted(k, AdmissionTable.DecoratorArgument); }\n" + + " void D(AdmissionTable[] ts) { ConstantDefaultClassifier.IsAdmitted(k, ts[0]); }\n" + + " void E() { System.Func f = ConstantDefaultClassifier.IsAdmitted; }\n" + + "}\n"; + var census = ScanClassifierReaders(new[] { ("V.cs", source) }); + Assert.Equal( + new[] { "V.cs:A=ParameterDefault", "V.cs:B=ConstInitializer", "V.cs:C#2=DecoratorArgument", "V.cs:C=DecoratorArgument" }, + census.Sites.Select(s => $"{s.Key}={s.Value}").OrderBy(s => s, StringComparer.Ordinal)); + Assert.Equal(2, census.Problems.Count); + Assert.Contains(census.Problems, p => p.StartsWith("V.cs:6:", StringComparison.Ordinal) && p.Contains("neither an AdmissionTable value nor a parameter", StringComparison.Ordinal)); + Assert.Contains(census.Problems, p => p.StartsWith("V.cs:7:", StringComparison.Ordinal) && p.Contains("something other than a call", StringComparison.Ordinal)); + + // The compiler's own readers: every one traced, none a problem. + Assert.Empty(ClassifierReaders.Value.Problems); + Assert.NotEmpty(ClassifierReaders.Value.Sites); + } +} diff --git a/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs index 128493ca3..d8cd876f8 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs @@ -28,10 +28,20 @@ internal enum ScopeAnnotation Inferred, } -/// What a constant position is handed (#2432's expression-kind axis, the kinds the P77a pool has no cell -/// for; charter §3.20l calls 43 and 45). The three member kinds are the image of what discovery records for a value -/// of a referenced module (FieldSignature.IsConst × IsGuarded, -/// ); the two chains are closed by call 45. +/// What a constant position is handed (#2432's expression-kind axis; charter §3.20l calls 43 and 45; the +/// owner's ruling 7 of 2026-11-20, #2423 comment 7042723494): every kind of member a constant position's answer is +/// asked about, and the two chains. Each member kind is the image of what the compiler records for the member: +/// +/// a value of a referenced MODULE: discovery's FieldSignature.IsConst × IsGuarded +/// (); +/// a member of a referenced TYPE: the subclasses of ClrMemberResolution, a field refined by +/// FieldInfo.IsLiteral and whether its type is an enum (); +/// a member of an enum the program declares: EnumMemberAccessKind and the member itself, per enum shape +/// (); +/// any other name the program declares: , refined by +/// (). +/// +/// The two chains are closed by call 45. internal enum ScopeConstantKind { /// A constant of a referenced assembly: a CLR literal field read through a Stdlib module. @@ -40,10 +50,50 @@ internal enum ScopeConstantKind /// A module variable of the .spy stdlib, whose storage is guarded (N3): no constant. StdlibModuleVariable, - /// A static of a referenced assembly that is neither literal nor guarded (a static property, a static - /// readonly field): no constant. + /// A static of a referenced assembly's module that is neither literal nor guarded (a static property, a + /// static readonly field): no constant. ClrStaticMember, + /// A literal field of a referenced type (int.max_value, Math.PI): a C# constant. + ClrTypeLiteralField, + + /// A member of a referenced enum (DayOfWeek.Monday): a C# constant. + ClrTypeEnumMember, + + /// A static field of a referenced type that is no literal (static readonly): no constant. + ClrTypeStaticField, + + /// A static property of a referenced type: no constant. + ClrTypeStaticProperty, + + /// A static method of a referenced type with one overload, read uncalled: a function value, no constant. + ClrTypeMethod, + + /// A static method group of a referenced type, read uncalled: no value at all (SPY0336). + ClrTypeMethodGroup, + + /// A member of an int enum of the program: a C# constant. + IntEnumMember, + + /// An int enum member's .value: the underlying integer, a C# constant (ruling 2). + IntEnumValue, + + /// An int enum member's .name: a call of the name channel, no constant. + IntEnumName, + + /// A member of a string enum of the program: a singleton object, no C# constant. + StringEnumMember, + + /// A string enum member's .value: the singleton's property, no constant. + StringEnumValue, + + /// A string enum member's .name: the singleton's property, no constant. + StringEnumName, + + /// A name the program declares, read where its kind says (bare at module level, through its type's + /// name or a subclass's): the cell's target is the kind. + OwnMember, + /// A comparison chain whose every link is a constant. ComparisonChain, @@ -51,11 +101,13 @@ internal enum ScopeConstantKind ChainWithNonConstantLink, } -/// Whether a type alias's target exists. Closed. +/// What a type alias's target names: a type that exists, nothing, or the alias itself, directly or +/// through a ring of aliases. Closed. internal enum ScopeAliasTarget { Declared, Missing, + Itself, } /// Whether anything names a type alias. Closed. @@ -77,7 +129,7 @@ internal enum ScopeOverloadCaller /// /// Stage 0 of plan-777361 (P78; verification contract §11), the owner's rulings of 2026-11-20 (#2423 comments -/// 7030074628 item 1 and 7039834146 item 5): the cells of rules N1, N2, N4 and N7 that the P77a pool +/// 7030074628 item 1, 7039834146 item 5 and 7042723494 items 7 to 9): the cells of rules N1, N2, N4 and N7 that the P77a pool /// () has no program for, as a generated test type of their own. A cell is /// a , and its tag and rule are READ from the rule table (name-resolution-rules.txt, #2487): /// the generator writes the program, what it prints when it runs and the codes a refusal may carry, and never a verdict. @@ -94,10 +146,12 @@ internal enum ScopeOverloadCaller /// × order × Spelling × , the last two as the P77a pool runs them; /// callee: a binder's name called under an outer binding of the name, binder ( and /// the parameter) × outer (); -/// constant-kind (#2432): host (AdmissionTable and the enum member's value) × ; +/// constant-kind (#2432): host (the call sites of ConstantDefaultClassifier.IsAdmitted, each with its +/// AdmissionTable, and the enum member's value) × ; /// init-overload: × order; /// alias-target: declaration site (ScopeKind × TypeKind) × target shape (the properties of the -/// alias's AST records) × × × order. +/// alias's AST records) × × × order. An alias that reaches +/// itself has its unused cells, which must run, and no used one (#2769). /// /// Known-red cells are rows of scope-meaning-differential-allowlist.txt (a missing file reads as empty), each citing /// the issue whose fix turns it green. A must-refuse cell refused under a code its cell does not admit is listed as @@ -381,24 +435,47 @@ private static IEnumerable CalleeCases() private static IEnumerable ConstantKindCases() { - foreach (var (table, host) in ConstantHosts.OrderBy(e => e.Key).SelectMany(e => e.Value.Select(h => ((AdmissionTable?)e.Key, h))).Append(((AdmissionTable?)null, EnumMemberHost))) + foreach (var (table, host) in AllConstantHosts()) { foreach (var (kind, expressions) in ConstantExpressions.OrderBy(e => e.Key)) { foreach (var e in expressions) { - if (host.IntOnly && e.Type != "int") + if (HostSkips(host, e.Type) != null) continue; - var source = (e.Import == null ? "" : $"import {e.Import}\n") - + host.Program.Replace("{T}", e.Type, StringComparison.Ordinal).Replace("{e}", e.Text, StringComparison.Ordinal) + "\n"; - yield return Draft(Key("read", "constant-kind", table, host.Label, kind, e.Label), Family.Read, source, host.PrintsOne ? "1" : e.Prints, - new[] { host.Refusal }, twin: host.Twin && kind is ScopeConstantKind.ClrLiteralField or ScopeConstantKind.ComparisonChain, - position: host.Position, stdlib: e.Import != null); + yield return ConstantCase(Key("read", "constant-kind", table, host.Label, kind, e.Form, e.Label), table, host, kind, e.Text, e.Type, e.Prints, e.Show, + imports: e.Import, prelude: e.Prelude, refusals: e.Refusals, target: e.Target, stdlib: e.Stdlib, + twin: host.Twin && e.Target == BindingKind.None && kind is ScopeConstantKind.ClrLiteralField or ScopeConstantKind.ComparisonChain); } } + foreach (var own in OwnReads) + { + if (HostSkips(host, own.Type) != null) + continue; + yield return ConstantCase(Key("read", "constant-kind", table, host.Label, ScopeConstantKind.OwnMember, own.Kind, own.Annotation, own.Relation, own.Form), table, host, + ScopeConstantKind.OwnMember, own.Text, own.Type, "5", own.Show, imports: null, prelude: own.Prelude, refusals: own.Refusals, target: own.Kind, stdlib: false, twin: false); + } } } + /// One cell: the expression's imports and declarations, then the host's program around it. What main shows is + /// the slot's value read into a local of the slot's type first, since a call on a function-typed property is #2770's. + private static Case ConstantCase(CellKey key, AdmissionTable? table, ConstantHost host, ScopeConstantKind kind, string text, string type, string prints, string show, + string? imports, string? prelude, string[]? refusals, BindingKind target, bool stdlib, bool twin) + { + var lines = new List(); + if (host.Imports != null) + lines.Add(host.Imports); + if (imports != null) + lines.Add(imports); + if (prelude != null) + lines.Add(prelude); + lines.Add(host.Program.Replace("{T}", type, StringComparison.Ordinal).Replace("{e}", text, StringComparison.Ordinal) + .Replace("{s}", string.Format(System.Globalization.CultureInfo.InvariantCulture, show, "v"), StringComparison.Ordinal)); + return Draft(key, Family.Read, Lines(lines), host.PrintsOne ? "1" : prints, new[] { host.Refusal }.Concat(refusals ?? Array.Empty()).ToArray(), twin, + target: target, position: host.Position, stdlib: stdlib); + } + // ------------------------------------------------------------------------------------------- // // init-overload: a constructor's overload set is the whole body's // ------------------------------------------------------------------------------------------- // @@ -436,6 +513,15 @@ private static IEnumerable InitOverloadCases() private const string AliasTargetClass = "class C0:\n v: int = 1"; + /// The orders an alias has against what its target names: a declared type stands above or below it, a missing one + /// has no declaration to stand anywhere, and the alias itself is reached directly or through a ring. + internal static Harness.Order[] AliasOrders(ScopeAliasTarget target) => target switch + { + ScopeAliasTarget.Declared => new[] { Harness.Order.Earlier, Harness.Order.Later }, + ScopeAliasTarget.Missing => new[] { Harness.Order.Earlier }, + _ => new[] { Harness.Order.Self, Harness.Order.Cycle }, + }; + private static IEnumerable AliasTargetCases() { foreach (var site in AllAliasSites()) @@ -444,23 +530,39 @@ private static IEnumerable AliasTargetCases() { foreach (var target in Enum.GetValues()) { + // A name a module qualifies is never the alias (ExcludedSelfReachingShapes says so, and the axes fact holds the two together). + if (target == ScopeAliasTarget.Itself && shape.Import != null) + continue; foreach (var use in Enum.GetValues()) { - foreach (var order in new[] { Harness.Order.Earlier, Harness.Order.Later }) + // Named by an annotation, a self-reaching alias kills the compiler's process (#2769; ExcludedAliasUses). + if (target == ScopeAliasTarget.Itself && use == ScopeAliasUse.Used) + continue; + foreach (var order in AliasOrders(target)) { - // The order is the alias against its target's declaration: a missing target has none. - if (target == ScopeAliasTarget.Missing && order == Harness.Order.Later) - continue; - var alias = $"type K0{(shape.Generic ? "[T]" : "")} = " + shape.Target.Replace("{N}", target == ScopeAliasTarget.Declared ? shape.Declared : "nosuch", StringComparison.Ordinal); - var named = shape.Generic ? "K0[int]" : "K0"; + string generic = shape.Generic ? "[T]" : ""; + // What the target names: the program's class, nothing, the alias itself, or the next alias of a ring of two. + string named = target switch + { + ScopeAliasTarget.Declared => shape.Declared, + ScopeAliasTarget.Missing => "nosuch", + _ when order == Harness.Order.Self => "K0" + generic, + _ => "K1", + }; + var aliases = new List { $"type K0{generic} = " + shape.Target.Replace("{N}", named, StringComparison.Ordinal) }; + if (target == ScopeAliasTarget.Itself && order == Harness.Order.Cycle) + aliases.Add("type K1 = K0" + (shape.Generic ? "[int]" : "")); var lines = new List(); if (shape.Import != null) lines.Add($"import {shape.Import}"); if (target == ScopeAliasTarget.Declared && order == Harness.Order.Earlier) lines.Add(AliasTargetClass); + // Every alias of the site stands at the site's own indentation. + var slot = site.Program.Split('\n').First(l => l.Contains("{alias}", StringComparison.Ordinal)); + var indent = slot[..slot.IndexOf("{alias}", StringComparison.Ordinal)]; lines.Add(site.Program - .Replace("{alias}", alias, StringComparison.Ordinal) - .Replace("{use}", use == ScopeAliasUse.Used ? site.Use.Replace("{K}", named, StringComparison.Ordinal) : site.NoUse, StringComparison.Ordinal)); + .Replace("{alias}", string.Join("\n" + indent, aliases), StringComparison.Ordinal) + .Replace("{use}", use == ScopeAliasUse.Used ? site.Use.Replace("{K}", shape.Generic ? "K0[int]" : "K0", StringComparison.Ordinal) : site.NoUse, StringComparison.Ordinal)); if (target == ScopeAliasTarget.Declared && order == Harness.Order.Later) lines.Add(AliasTargetClass); lines.Add(Main + " print(1)"); @@ -532,7 +634,8 @@ public void RuleTable_EveryCaseHasOneRow_AndTakesItsVerdictFromIt() /// The issue whose fix turns a red cell of a route green: #2432 for a constant position's verdict, #2423 for the rest /// (R-QI's cells, the untyped forward read, the callee lookup, the alias refusal: charter §3.20l). A typed read that is - /// red at the EARLIER order is no order defect, and it and its later twin are #2417's (). + /// red at the EARLIER order is no order defect, and it and its later twin are #2417's; an alias that reaches itself is + /// #2769's (). internal static readonly IReadOnlyDictionary RouteIssues = new Dictionary(StringComparer.Ordinal) { ["no-initializer"] = "#2423", @@ -546,6 +649,10 @@ public void RuleTable_EveryCaseHasOneRow_AndTakesItsVerdictFromIt() /// The class of an untyped member-access read (#2417): typed at neither order. internal const string UntypedAtEitherOrder = "#2417"; + /// The class of an alias whose target reaches the alias itself (#2769): unruled, so the unused cells keep running + /// and a red one is that tracker's. + internal const string SelfReachingAlias = "#2769"; + internal sealed record Result(Case Case, Harness.SharpyRun Run, SharpyKind Kind, VerdictClass Class, bool WrongCode, string? PythonFailure); /// The harness's table, and one more red: a must-refuse cell refused under a code it does not admit. @@ -571,6 +678,8 @@ internal static string ProposedCite(Result r, IReadOnlySet redIds) var issue = RouteIssues.GetValueOrDefault(r.Case.Cell.Key!.Route ?? "", "UNROUTED"); if (EarlierTwinId(r.Case.Cell) is { } earlier && redIds.Contains(earlier)) issue = UntypedAtEitherOrder; + if (r.Case.Cell.Key.Part() == ScopeAliasTarget.Itself) + issue = SelfReachingAlias; string lane = r.WrongCode ? "wrong-code" : r.Class switch { VerdictClass.Ice => "ice", @@ -775,5 +884,13 @@ Result Of(Case c, Harness.SharpyRun run, string? pythonFailure = null) Assert.Contains("the route says '#2417", Assert.Single(RatchetFailures(both, Rows((earlier, VerdictClass.FalseRefusal, "#2417 wrong-code"), (later, VerdictClass.FalseRefusal, "#2423 wrong-code"))))); var laterOnly = new[] { Of(earlier, Refused("SPY0220")), Of(later, Refused("SPY0200")) }; Assert.Contains("the route says '#2423", Assert.Single(RatchetFailures(laterOnly, Rows((later, VerdictClass.FalseRefusal, "#2417 wrong-code"))))); + + // An alias whose target reaches the alias itself is unruled (#2769): its unused cell must run, and one that stops + // running is that tracker's row, never the alias refusal's (#2423). + var itself = pool.First(c => c.Cell.Key!.Part() == ScopeAliasTarget.Itself); + Assert.Equal(SharpyTag.MustRun, itself.Cell.Tag); + var refusedItself = new[] { Of(itself, Refused("SPY0202")) }; + Assert.Empty(RatchetFailures(refusedItself, Rows((itself, VerdictClass.FalseRefusal, "#2769 false-refusal")))); + Assert.Contains("the route says '#2769", Assert.Single(RatchetFailures(refusedItself, Rows((itself, VerdictClass.FalseRefusal, "#2423 false-refusal"))))); } } diff --git a/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt b/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt index fc6c49488..6cac55779 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt +++ b/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt @@ -214,18 +214,30 @@ MustRun P52 family=TypeMember route=class,dataclass,enum,interface,struct,union * seed family=Seed route=- # --- ScopeMeaningDifferentialTests: the cells the P77a pool has no program for (hand-written; the test reads its -# --- verdicts from these rows and carries none). A constant position's verdict is its table's (`admission`, the -# --- validator's AdmissionTable; `-` is the enum member's value, which has no table): a `const` initializer takes a -# --- non-constant and is then a computed constant (N4), and an attribute argument refuses under its own code. --- +# --- verdicts from these rows and carries none). A constant position's verdict is its reader's: the table the reader +# --- passes (`admission`, the validator's AdmissionTable; `-` is the enum member's value, which has no table), and the +# --- host (`mark`) where one table has two readers. Handed a constant, every position runs. Handed a non-constant: a +# --- `const` initializer is then a computed constant (N4), a struct's auto-property keeps its initializer (#1938), an +# --- attribute argument refuses under its own code, and every other position refuses under SPY0401. A name that is no +# --- value there refuses under its kind's own code. An alias that reaches itself is unruled (#2769): unused, it runs. --- MustRefuse R-QI family=Read route=no-initializer initializer=Absent target=ModuleVar,ModuleProperty,StaticField,StaticProperty MustRun N1 family=Read route=no-initializer initializer=Absent target=InstanceField,InstanceProperty,LocalVar MustRun N1 family=Read route=no-initializer initializer=Present,AccessorBodies MustRefuse N1-typed-read family=Read route=typed-read MustRun N1-innermost family=Local route=callee -MustRun N4 family=Read route=constant-kind constantKind=ClrLiteralField,ComparisonChain -MustRun N4 family=Read route=constant-kind admission=ConstInitializer constantKind=StdlibModuleVariable,ClrStaticMember,ChainWithNonConstantLink -MustRefuse SPY0401 family=Read route=constant-kind admission=ParameterDefault,LambdaParameterDefault,PerInstanceFieldDefault,- constantKind=StdlibModuleVariable,ClrStaticMember,ChainWithNonConstantLink -MustRefuse SPY0425 family=Read route=constant-kind admission=DecoratorArgument constantKind=StdlibModuleVariable,ClrStaticMember,ChainWithNonConstantLink +MustRun N4 family=Read route=constant-kind constantKind=ClrLiteralField,ClrTypeLiteralField,ClrTypeEnumMember,IntEnumMember,IntEnumValue,ComparisonChain +MustRun N4 family=Read route=constant-kind constantKind=OwnMember target=ModuleLiteralConst,ClassLiteralConst +MustRun N4 family=Read route=constant-kind admission=ConstInitializer constantKind=StdlibModuleVariable,ClrStaticMember,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink +MustRun N4 family=Read route=constant-kind admission=ConstInitializer constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin +MustRun #1938 family=Read route=constant-kind mark=struct-auto-property constantKind=StdlibModuleVariable,ClrStaticMember,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink +MustRun #1938 family=Read route=constant-kind mark=struct-auto-property constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin +MustRefuse SPY0401 family=Read route=constant-kind admission=ParameterDefault,LambdaParameterDefault,PerInstanceFieldDefault,- mark=def,lambda,dataclass,struct,enum-member constantKind=StdlibModuleVariable,ClrStaticMember,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink +MustRefuse SPY0401 family=Read route=constant-kind admission=ParameterDefault,LambdaParameterDefault,PerInstanceFieldDefault,- mark=def,lambda,dataclass,struct,enum-member constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin +MustRefuse SPY0425 family=Read route=constant-kind admission=DecoratorArgument constantKind=StdlibModuleVariable,ClrStaticMember,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink +MustRefuse SPY0425 family=Read route=constant-kind admission=DecoratorArgument constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin +MustRefuse kind:SPY0290 family=Read route=constant-kind constantKind=OwnMember target=InstanceField,InstanceProperty,InstanceMethod +MustRefuse kind:SPY0336 family=Read route=constant-kind constantKind=ClrTypeMethodGroup MustRun N1 family=Read route=init-overload MustRefuse N1-alias-target family=Read route=alias-target aliasTarget=Missing MustRun N1 family=Read route=alias-target aliasTarget=Declared +MustRun #2769 family=Read route=alias-target aliasTarget=Itself diff --git a/src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt b/src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt index 32639cf24..738cb8b47 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt +++ b/src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt @@ -1,9 +1,10 @@ # Known-red cells of ScopeMeaningDifferentialTests (stage 0 of plan-777361, P78; verification contract §11). # ` # # `: the issue is the one whose fix turns the # cell green, by the cell's class (ScopeMeaningDifferentialTests.ProposedCite): its route's issue, except a typed read -# that is red at the EARLIER order too, which no order cures and is #2417's with its later twin. A row whose cell -# passes fails the test until it is deleted. `wrong-code` is a must-refuse cell refused under a code its cell does not -# admit. The sweep writes the rows it would list to .claude/tmp/scope-meaning-differential-proposed-allowlist.txt. +# that is red at the EARLIER order too, which no order cures and is #2417's with its later twin, and an alias whose +# target reaches the alias itself, which is #2769's. A row whose cell passes fails the test until it is deleted. +# `wrong-code` is a must-refuse cell refused under a code its cell does not admit. The sweep writes the rows it would +# list to .claude/tmp/scope-meaning-differential-proposed-allowlist.txt. local/callee/Comprehension/outer=ImportedName Ice # #2423 ice local/callee/Comprehension/outer=ModuleClass Ice # #2423 ice local/callee/Comprehension/outer=ModuleComputedConst Ice # #2423 ice @@ -114,31 +115,221 @@ read/alias-target/Missing/Unused/Earlier/struct/optional SilentWrong # #2423 mis read/alias-target/Missing/Unused/Earlier/struct/result-error SilentWrong # #2423 missing-refusal read/alias-target/Missing/Unused/Earlier/struct/tuple-element SilentWrong # #2423 missing-refusal read/alias-target/Missing/Unused/Earlier/struct/type-argument SilentWrong # #2423 missing-refusal +read/constant-kind/ConstInitializer/block-const/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/IntEnumName/name Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/StdlibModuleVariable/math.pi Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/StringEnumMember/member Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/StringEnumName/name Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/StringEnumValue/EnumValue/value Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/IntEnumName/name Ice # #2432 ice read/constant-kind/ConstInitializer/class-const/StdlibModuleVariable/math.pi Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/StringEnumMember/member Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/StringEnumName/name Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/StringEnumValue/EnumValue/value Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/IntEnumName/name Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/StdlibModuleVariable/math.pi Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/StringEnumMember/member Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/StringEnumName/name Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/StringEnumValue/EnumValue/value Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/IntEnumName/name Ice # #2432 ice read/constant-kind/ConstInitializer/local-const/StdlibModuleVariable/math.pi Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/StringEnumMember/member Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/StringEnumName/name Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/StringEnumValue/EnumValue/value Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/IntEnumName/name Ice # #2432 ice read/constant-kind/ConstInitializer/module-const/StdlibModuleVariable/math.pi Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/StringEnumMember/member Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/StringEnumName/name Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/StringEnumValue/EnumValue/value Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/IntEnumName/name Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/StdlibModuleVariable/math.pi Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/StringEnumMember/member Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/StringEnumName/name Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/StringEnumValue/EnumValue/value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrLiteralField/from-subprocess-import-PIPE FalseRefusal # #2432 false-refusal +read/constant-kind/DecoratorArgument/attribute-keyword/ClrLiteralField/subprocess.PIPE Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrStaticMember/sys.maxsize Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeLiteralField/int.max_value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeLiteralField/system.Int32.max_value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeMethod/Value/Math.sqrt Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeMethodGroup/Value/Math.abs Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticProperty/Array.max_length Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ComparisonChain/ordered FalseRefusal # #2432 false-refusal +read/constant-kind/DecoratorArgument/attribute-keyword/IntEnumName/name Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/IntEnumValue/EnumValue/value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassComputedConst/Annotated Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassComputedConst/Annotated/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassComputedConst/Inferred Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassComputedConst/Inferred/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceField/Annotated Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceField/Annotated/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceField/Inferred Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceField/Inferred/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceMethod/Annotated/Base/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceMethod/Annotated/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceProperty/Annotated Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceProperty/Annotated/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ModuleLiteralConst/Annotated Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ModuleLiteralConst/Inferred Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticField/Annotated Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticField/Annotated/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticField/Inferred Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticField/Inferred/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticMethod/Annotated/Base/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticMethod/Annotated/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticProperty/Annotated Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticProperty/Annotated/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/StdlibModuleVariable/math.pi Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/StringEnumMember/member Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/StringEnumName/name Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/StringEnumValue/EnumValue/value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrLiteralField/from-subprocess-import-PIPE FalseRefusal # #2432 false-refusal read/constant-kind/DecoratorArgument/attribute/ClrLiteralField/subprocess.PIPE Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute/ClrStaticMember/sys.maxsize Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeLiteralField/int.max_value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeLiteralField/system.Int32.max_value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeMethod/Value/Math.sqrt Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeMethodGroup/Value/Math.abs Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticProperty/Array.max_length Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute/ComparisonChain/ordered FalseRefusal # #2432 false-refusal +read/constant-kind/DecoratorArgument/attribute/IntEnumName/name Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/IntEnumValue/EnumValue/value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassComputedConst/Annotated Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassComputedConst/Annotated/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassComputedConst/Inferred Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassComputedConst/Inferred/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceField/Annotated Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceField/Annotated/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceField/Inferred Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceField/Inferred/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceMethod/Annotated/Base/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceMethod/Annotated/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceProperty/Annotated Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceProperty/Annotated/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ModuleLiteralConst/Annotated Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ModuleLiteralConst/Inferred Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticField/Annotated Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticField/Annotated/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticField/Inferred Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticField/Inferred/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticMethod/Annotated/Base/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticMethod/Annotated/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticProperty/Annotated Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticProperty/Annotated/Base Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute/StdlibModuleVariable/math.pi Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/StringEnumMember/member Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/StringEnumName/name Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/StringEnumValue/EnumValue/value Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrLiteralField/from-subprocess-import-PIPE FalseRefusal # #2432 false-refusal read/constant-kind/LambdaParameterDefault/lambda/ClrStaticMember/sys.maxsize Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticProperty/Array.max_length Ice # #2432 ice read/constant-kind/LambdaParameterDefault/lambda/ComparisonChain/ordered FalseRefusal # #2432 false-refusal +read/constant-kind/LambdaParameterDefault/lambda/IntEnumName/name Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/OwnMember/StaticProperty/Annotated Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/OwnMember/StaticProperty/Annotated/Base Ice # #2432 ice read/constant-kind/LambdaParameterDefault/lambda/StdlibModuleVariable/math.pi Ice # #2432 ice read/constant-kind/LambdaParameterDefault/lambda/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/StringEnumMember/member Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/StringEnumName/name Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/StringEnumValue/EnumValue/value Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrLiteralField/from-subprocess-import-PIPE FalseRefusal # #2432 false-refusal read/constant-kind/ParameterDefault/def/ClrStaticMember/sys.maxsize Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeMethod/Value/Math.sqrt Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeStaticProperty/Array.max_length Ice # #2432 ice read/constant-kind/ParameterDefault/def/ComparisonChain/ordered FalseRefusal # #2432 false-refusal +read/constant-kind/ParameterDefault/def/IntEnumName/name Ice # #2432 ice +read/constant-kind/ParameterDefault/def/OwnMember/StaticMethod/Annotated/Base/Value Ice # #2432 ice +read/constant-kind/ParameterDefault/def/OwnMember/StaticMethod/Annotated/Value Ice # #2432 ice +read/constant-kind/ParameterDefault/def/OwnMember/StaticProperty/Annotated Ice # #2432 ice +read/constant-kind/ParameterDefault/def/OwnMember/StaticProperty/Annotated/Base Ice # #2432 ice read/constant-kind/ParameterDefault/def/StdlibModuleVariable/math.pi Ice # #2432 ice read/constant-kind/ParameterDefault/def/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice +read/constant-kind/ParameterDefault/def/StringEnumMember/member Ice # #2432 ice +read/constant-kind/ParameterDefault/def/StringEnumName/name Ice # #2432 ice +read/constant-kind/ParameterDefault/def/StringEnumValue/EnumValue/value Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrStaticMember/sys.maxsize Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeMethod/Value/Math.sqrt Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticProperty/Array.max_length Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/IntEnumName/name Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/ClassComputedConst/Annotated Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/ClassComputedConst/Annotated/Base Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/ClassComputedConst/Inferred Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/ClassComputedConst/Inferred/Base Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticField/Annotated Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticField/Annotated/Base Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticField/Inferred Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticField/Inferred/Base Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticMethod/Annotated/Base/Value Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticMethod/Annotated/Value Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticProperty/Annotated Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticProperty/Annotated/Base Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/StdlibModuleVariable/math.pi Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/StringEnumMember/member Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/StringEnumName/name Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/StringEnumValue/EnumValue/value Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrLiteralField/from-subprocess-import-PIPE FalseRefusal # #2432 false-refusal read/constant-kind/PerInstanceFieldDefault/dataclass/ClrStaticMember/sys.maxsize Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeMethod/Value/Math.sqrt Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticProperty/Array.max_length Ice # #2432 ice read/constant-kind/PerInstanceFieldDefault/dataclass/ComparisonChain/ordered FalseRefusal # #2432 false-refusal +read/constant-kind/PerInstanceFieldDefault/dataclass/IntEnumName/name Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticMethod/Annotated/Base/Value Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticMethod/Annotated/Value Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticProperty/Annotated Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticProperty/Annotated/Base Ice # #2432 ice read/constant-kind/PerInstanceFieldDefault/dataclass/StdlibModuleVariable/math.pi Ice # #2432 ice read/constant-kind/PerInstanceFieldDefault/dataclass/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/StringEnumMember/member Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/StringEnumName/name Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/StringEnumValue/EnumValue/value Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrLiteralField/from-subprocess-import-PIPE FalseRefusal # #2432 false-refusal read/constant-kind/PerInstanceFieldDefault/struct/ClrStaticMember/sys.maxsize Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeMethod/Value/Math.sqrt Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticProperty/Array.max_length Ice # #2432 ice read/constant-kind/PerInstanceFieldDefault/struct/ComparisonChain/ordered FalseRefusal # #2432 false-refusal +read/constant-kind/PerInstanceFieldDefault/struct/IntEnumName/name Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticMethod/Annotated/Base/Value Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticMethod/Annotated/Value Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticProperty/Annotated Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticProperty/Annotated/Base Ice # #2432 ice read/constant-kind/PerInstanceFieldDefault/struct/StdlibModuleVariable/math.pi Ice # #2432 ice read/constant-kind/PerInstanceFieldDefault/struct/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/StringEnumMember/member Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/StringEnumName/name Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/StringEnumValue/EnumValue/value Ice # #2432 ice +read/constant-kind/enum-member/ClrStaticMember/from-sys-import-maxsize Ice # #2432 ice read/constant-kind/enum-member/ClrStaticMember/sys.maxsize Ice # #2432 ice +read/constant-kind/enum-member/ClrTypeStaticProperty/Array.max_length Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/ClassComputedConst/Annotated Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/ClassComputedConst/Annotated/Base Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/ClassComputedConst/Inferred Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/ClassComputedConst/Inferred/Base Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/ModuleComputedConst/Annotated Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/ModuleComputedConst/Inferred Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/ModuleProperty/Annotated Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/ModuleVar/Annotated Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/ModuleVar/Inferred Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/StaticField/Annotated Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/StaticField/Annotated/Base Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/StaticField/Inferred Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/StaticField/Inferred/Base Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/StaticProperty/Annotated Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/StaticProperty/Annotated/Base Ice # #2432 ice read/constant-kind/enum-member/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice read/init-overload/InitDelegation/Later FalseRefusal # #2423 false-refusal read/no-initializer/ModuleProperty/Absent/callable RuntimeThrow # #2423 runtime-throw From 56dbb009ff1a22a8ececff1c35a5b93c74d66775 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 16:21:43 +0000 Subject: [PATCH 13/22] process(plan): plan-777361 (P78) revised after pass 2 Revised after the second /verify-plan pass (NEEDS REVISION, Dimension 6 @ 656991807; stamp commit 19ffa7ad1) as the owner ruled on 2026-11-20 (#2423 comment 7042723494, items 7 to 9). The plan returns to DRAFT; the stamp lines and the Verification Summary are deleted, and the Revision log carries the pass's dimension. Stage 0 for this revision is 3a422a6fe. Each finding of the pass: 1. D8 answers per name the checker bound, under every spelling, and admits a literal field of a referenced type as well as of a module (ruling 7). A9, M9 and the by-direction entry follow; the member-kind axis is closed in stage 0. 2. The struct auto-property host is in D8 and must run; T10 gains CodeGenInfoComputer.cs; the hosts are pinned to the reader census in stage 0 (ruling 8). 3. The checker checks each bracket-attribute argument as an expression; T10 gains TypeChecker.Definitions.cs (ruling 9). 4. An unused self-reaching alias must run: stage 0's cells, D10's clause and M13's third mutation (ruling 9). 5. Deferred (ruling 9), as a row of the Revision log line: D10's module-level judgement against the pipeline order, proved by the `dotted` and `Later` must-run cells. 6. The delegate exclusion's reason: stage 0 (ruling 9). Also from the pass: M2 gains the mutation of D2's in-progress mark; T3 names the files that hold the 33 sites; the Generator line names the hand lists that remain. Not ruled, taken from call 43 and written in the log: D8 answers false for a string enum's member, its `.value` and any `.name` (CS1736 behind SPY0908 today, so no program that runs is refused). Body 20,471 -> 20,473 bytes (cap 20,480). Paid for by cutting: the per-axis source list of the Generator line (the test's header carries it), two Current State examples, the three phase Goal lines, A9's restatement of the rows' verdicts, the five spec file names in A11, the detail of the two earlier Revision log lines, and the descriptors of the owner comments. check_plan_refs.py: RESULT: OK; 2 verify passes / 2. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01LGMKZVcFYGqQRfHgd16DLa --- docs/process/plans/plan-777361.md | 158 ++++++------------------------ 1 file changed, 28 insertions(+), 130 deletions(-) diff --git a/docs/process/plans/plan-777361.md b/docs/process/plans/plan-777361.md index 95b46ed17..0771f9c93 100644 --- a/docs/process/plans/plan-777361.md +++ b/docs/process/plans/plan-777361.md @@ -1,7 +1,4 @@ - - - - + # P78 — N1/N2/N4/N7: scope decides meaning @@ -11,18 +8,17 @@ Rules N1, N2, N4 and N7 of `docs/design/name-resolution.md` (charter §3.20l): # ## Current State -`sharpyc run` (Debug) @ 55846bb3f (product code e24aaf9f0); python is CPython 3.15.2. The known-red rows of both sweeps are the state; by class: -- **Order (N1):** a function reading a later module variable is SPY0200 (python `3`); `@static a: int = b + 1` above `b` is SPY0200 bare and `5` as `H.b`. -- **Kind (N2, N4):** under a module binding of the name a later `@static` yields (`64`), a later literal `const` outranks (`3`, python `10`), a later computed `const` is SPY0618. -- **Untyped, bodies (#2398):** a forward read in a `bool` slot is CS0029 behind SPY0908, not SPY0220; a nested type's initializer reading the enclosing type's field is SPY0909; `x()` on a parameter under a module `def x` prints `12` (python `1`). -- **Constants (#2432), R-QI, D10:** `RED = x` is CS0133, a default through `math.pi` CS1736, `= 1 < 2 < 3` SPY0401 (python `True`); module `x: T` reads `0`; an unused `type K0 = nosuch` runs. +`sharpyc run` @ 19ffa7ad1 (code e24aaf9f0); python 3.15.2. The known-red rows are the state; by class: +- **Order, kind:** a function reading a later module variable is SPY0200 (python `3`); under a module binding a later `@static` yields (`64`), a later literal `const` outranks (`3`, python `10`), a later computed `const` is SPY0618. +- **Untyped, bodies (#2398):** a forward read in a `bool` slot is CS0029 behind SPY0908; a nested type's initializer reading the enclosing type's field is SPY0909; `x()` on a parameter under a module `def x` prints `12` (python `1`). +- **Constants (#2432), R-QI, D10:** `RED = x` is CS0133; a default through `math.pi`, and a struct auto-property's through `H.x`, CS1736; bare imported `PIPE` SPY0401; module `x: T` reads `0`; an unused `type K0 = nosuch` runs. ## Scope - **Group:** P78 (chores: none). #2432 stays in (R-KV): its rows sit on `TypeBodyMembership` and the interface/union cell #2398 shares. - **Tier:** full (c: the seam is under `Semantic/`) — from charter §3.20l - **Alone:** no — verdicts, not layout; no snapshot moves (A12) -- **Gates:** 1 — `/ci-gate` on the pushed tip (exit 3: CLAUDE.md's local run), counts `@ sha (measured)`, a red with its control at the base +- **Gates:** 1 — `/ci-gate` on the pushed tip, counts `@ sha (measured)` - **Filing:** findings ledger; the lead files by class (contract §10) - **Override:** none @@ -31,18 +27,18 @@ Rules N1, N2, N4 and N7 of `docs/design/name-resolution.md` (charter §3.20l): # - **Violated contract:** what a module-level or class-level name means, the type a read of it has, and whether the read is legal are one answer for every binding kind, declaration order, spelling and reading position; where python's top-to-bottom reading means something else the read is refused under one code; a constant position refuses a non-constant itself. - **Meta-class:** silent wrong behavior; position/route missing a shared check; SPY0908 as a net → **standard cure:** one resolution seam per scope, a semantic-time refusal, the conformance sweep. - **Known member cells:** #2423, #2398, #2432; the folded #2415 (C08) and #2416 method-group cells; R-QI's cells (#2427, comment 6967863739). -- **Sibling cells this plan must also cover:** none listed; see Generator. +- **Sibling cells this plan must also cover:** none; see Generator. - **Lane / reach:** false-refusal + silent-wrong + ice · program; **fidelity-scope row:** "which programs run vs. are refused" and "value of an expression", both COMPARED. - **Standing harness that should have caught it:** `NameResolutionDifferentialTests`; `ClassBodyReadPositionMatrixTests` is the hand control (R-KF) for steer text and diagnostic count per position × host. -- **Generator:** stage 0 (§2.1) @ 0c5446974. `name-resolution-rules.txt` (S0a, #2487): every cell of both pools has exactly one row and every row a cell; for the 8951 pool it copies the `Expect*` arms, a drift guard. `NameResolutionDifferentialTests`: 8951 cases, 2368 known-red rows. `ScopeMeaningDifferentialTests` (S0b): 2225 cases, 639 known-red rows (463 / 26 / 150 cite #2423 / #2432 / #2417), verdicts read from the rows. Each S0b axis is an image, every value generated or excluded with a reason, and a probe where the reason is the compiler's (`Axes_EveryValueIsGeneratedOrExcluded`): constant position ← `AdmissionTable`; member kind ← discovery's `FieldSignature` facts; callee outer ← `BindingKind`; alias site ← `ScopeKind` × `TypeKind`; alias shape ← the alias's AST records; typed-read spelling and position ← `Spelling` and `ReadPosition` through the 8951 pool; R-QI host ← `TypeKind`, type ← `SemanticType`. Closed by decision: the chain pair (call 45), the five other `Scope*` enums, one call site per callee cell (D5's census). Excluded: the project route (A3), message text, a recursive alias (unruled), an interface host (#2383). Green by D1, D2, D5, D10 (A1, A2, A4, A13), D3, D4, D6, D7 (A5–A7), D8 (A9). -- **Owner rulings:** R-KD, R-KF, R-KG, R-KJ, R-KV, R-LJ, R-LO, R-PM, R-QE, R-QI (charter §4); #2432's call-43 and call-45 cells (§3.20l); owner 2026-11-20 on #2423: comment 7030074628 (stage 0's test type, D8's nine cells, D10, #2432's close), comment 7039834146 (S0b's seven axes closed; #2487 stays open). +- **Generator:** stage 0 (§2.1) @ 3a422a6fe. `name-resolution-rules.txt` (S0a, #2487): every cell of both pools has exactly one row and every row a cell. `NameResolutionDifferentialTests`: 8951 cases, 2368 known-red rows. `ScopeMeaningDifferentialTests` (S0b): 3070 cases, 829 known-red rows (463 / 216 / 150 cite #2423 / #2432 / #2417), verdicts read from the rows. Each S0b axis is an image with its source in `ScopeMeaningDifferentialTests.Axes.cs`, every value generated or excluded with a reason and, where the reason is the compiler's, a probe (`Axes_EveryValueIsGeneratedOrExcluded`). Hand lists: a reader's hosts (a `const`'s aside), one expression per member kind, one value per declared type. Closed by decision: the chain pair (call 45), the five other `Scope*` enums, one call site per callee cell (D5's census). Excluded: the project route (A3), message text, a self-reaching alias an annotation names (#2769), an interface host (#2383). Green by D1, D2, D5, D10 (A1, A2, A4, A13), D3, D4, D6, D7 (A5–A7), D8 (A9). +- **Owner rulings:** R-KD, R-KF, R-KG, R-KJ, R-KV, R-LJ, R-LO, R-PM, R-QE, R-QI (charter §4); #2432's call-43 and call-45 cells (§3.20l); owner 2026-11-20, #2423 comments 7030074628 (rulings 1–4), 7039834146 (5–6), 7042723494 (7–9). ## Adversarial Review (pre-mortem) -- **Alternative root cause:** "bodies are checked in textual order" — refuted: the same function reads a later `const`, `def`, class and module property; only the variable's symbol is missing. Second cause: a symbol is untyped until its declaration is checked (D2). -- **Alternative layer:** scoping has no `.spy`, dunder or protocol spelling; D8's module arm is rung 3. +- **Alternative root cause:** "bodies are checked in textual order" — refuted: the same function reads a later `const`, `def` and class; only the variable's symbol is missing. Second cause: a symbol is untyped until its declaration is checked (D2). +- **Alternative layer:** scoping has no `.spy`, dunder or protocol spelling; D8's literal arm is rung 3. - **How the fix could be inert:** D1 without D2 prints `3` and leaves CS0029; F2's yield one branch above the N2 refusal keeps `64`; a callee site left on its own lookup keeps `12`. -- **Before/after by direction:** newly refused and `worked`, each ruled: N2's cells whatever the member's kind or position (`64`, `3`; R-KD, R-KJ); a nested type's bare read of its enclosing type's `const` (`7`; R-KG); a class member read bare in a comprehension element of a `@static` initializer (`2`; N1); a module initializer under a later same-named declaration (`2`, python `7`; R-LJ); a declaration with no initializer (R-QI; none in 4,565 `.spy` files, 22 in five spec files: A11); an unused alias to a missing type (`1`; D10). Newly running: every order-only refusal. A8 is the record. +- **Before/after by direction:** newly refused and `worked`, each ruled: N2's cells whatever the member's kind or position (`64`, `3`; R-KD, R-KJ); a nested type's bare read of its enclosing type's `const` (`7`; R-KG); a class member read bare in a comprehension element of a `@static` initializer (`2`; N1); a module initializer under a later same-named declaration (`2`, python `7`; R-LJ); a declaration with no initializer (R-QI; none in 4,565 `.spy` files, 22 in five spec files: A11); an unused alias to a missing type (`1`; D10). Newly running: every order-only refusal, and bare imported `PIPE` as a default. D8 refuses nothing that runs. A8 is the record. - **Blast radius:** the whole gate; Stdlib.Tests (the `.spy` stdlib's module variables), cold/warm and `FrontEndParityTests` first. - **Generated artifacts touched:** none may move (A12's regeneration after T1 and T4); the oracle ledger follows T11. @@ -51,40 +47,36 @@ Rules N1, N2, N4 and N7 of `docs/design/name-resolution.md` (charter §3.20l): # No rule below reads a builtin or type name; a rung applies only in D8. - **D1 (module variables are declared first; Semantic).** `NameResolver.ResolveDeclaration` declares every module-level `VariableDeclaration`, annotated or `auto`, as it does a `const`; `TypeChecker.CheckVariableDeclaration` completes that symbol and creates none at module level. A module `let` (SPY0340) and a second declaration of the name (#2125) keep today's verdicts (P21b). Predicates: no module-level `VariableSymbol` is created by `TypeChecker`; a variable's export is its declared symbol, cold and warm, so the identity-bridge arm of `ImportedStaticFacts.ImportedStorage` and `SemanticBinding`'s module-value map are deleted (its first arm stays). - **D2 (a read is typed whatever the order; Semantic).** `CheckModule` resolves every declared type before it checks a body or an initializer: annotated module variables and module properties beside the consts, and each type's annotated members (fields, consts, properties, method signatures, union cases), nested types included. An unannotated module-level or type-level value is checked on its first read, in its own declaration's scope state, under an in-progress mark; a read that re-enters its own inference stays `Unknown` as today and adds no refusal (the cycle graph's SPY0278 is a ring's). Predicate: no read of a declared module-level or type-level name is `Unknown` because of where the declaration stands. -- **D3 (one class-body rule: N1, N2, N4, N7).** `TryResolveClassBodySiblingRead` decides a bare read of a member its type body declares by four facts only: the member's level (type or instance), its order against the reader, whether a binding outside the body holds the name, and the position. Earlier: the member. At-or-after with an outer binding: SPY0619 in every position and for every member kind, instance included, judged before the kind refusal and SPY0401. At-or-after with none: the member, a forward read (N3); a self read is the cycle graph's. Outside N2 an instance member keeps its kind refusal and never yields, a parameter default keeps SPY0401 for a non-constant, an inherited member R1 (b). Deleted: F1's refusal, F2's yield, the `const` exemption in `IsDeclaredLater`, `ReportAmbiguousLaterConstReads`, SPY0618. Predicate: the verdict never reads `IsConstant`, the compile-time fact or the spelling. -- **D4 (bodies do not see class variables: N1, R-KG).** `Scope.ResolveName` crosses a type body from a nested type's body as from a function-like scope: no field, `const` or property of an enclosing type binds there bare. The crossing is variable-only, as today: a type, alias, type parameter or function still binds (`p: A | None` beside a nested `class A` prints `True`). `ClassifyClassBodyReadPosition` names three more positions — a nested type's body, a lambda in an initializer, a comprehension's body (all but its first iterable) — each with its phrase in the one SPY0200 steer. With an outer binding the read is that binding (R-Y), recorded through `SetModuleAccessCrossesClassMember` for an imported name as for a module variable. Predicate: every scope kind between a read and a type body is classified, with no default arm. +- **D3 (one class-body rule: N1, N2, N4, N7).** `TryResolveClassBodySiblingRead` decides a bare read of a member its type body declares by four facts: the member's level (type or instance), its order against the reader, whether a binding outside the body holds the name, and the position. Earlier: the member. At-or-after with an outer binding: SPY0619 in every position and for every member kind, instance included, judged before the kind refusal and SPY0401. At-or-after with none: the member, a forward read (N3); a self read is the cycle graph's. Outside N2 an instance member keeps its kind refusal and never yields, a parameter default keeps SPY0401 for a non-constant, an inherited member R1 (b). Deleted: F1's refusal, F2's yield, the `const` exemption in `IsDeclaredLater`, `ReportAmbiguousLaterConstReads`, SPY0618. Predicate: the verdict never reads `IsConstant`, the compile-time fact or the spelling. +- **D4 (bodies do not see class variables: N1, R-KG).** `Scope.ResolveName` crosses a type body from a nested type's body as from a function-like scope: no field, `const` or property of an enclosing type binds there bare. The crossing is variable-only, as today: a type, alias, type parameter or function still binds. `ClassifyClassBodyReadPosition` names three more positions — a nested type's body, a lambda in an initializer, a comprehension's body (all but its first iterable) — each with its phrase in the one SPY0200 steer. With an outer binding the read is that binding (R-Y), recorded through `SetModuleAccessCrossesClassMember` for an imported name as for a module variable. Predicate: every scope kind between a read and a type body is classified, with no default arm. - **D5 (one callee resolver).** A bare callee resolves by the scope walk a bare read uses and dispatches on the symbol it bound, whatever an outer binding of the name is. The 33 direct `LookupFunctionOverloads` / `BuiltinRegistry.GetFunction` / `GetFunctionOverloads` sites in `TypeChecker*.cs` go behind it; a census test pins the remainder at the helper's own. A constructor's overload set is the whole body's. - **D6 (N2 at module level; R-LJ).** A read evaluated at load — a module-level or class-level initializer or default, never a function body — of a builtin name its module declares at or after the reader is SPY0619. An import its module redeclares stays SPY0204 at the declaration. - **D7 (R-QI).** A module variable, a `@static` field, and a module or `@static` auto-property with no initializer is SPY0620 at its declaration, whatever its type and host; the steer names `x: T = ` and `x: T | None = None`. Untouched: an instance field, a local `x: T`, a property with accessor bodies. -- **D8 (#2432; Validation, CodeGen).** `ConstantPositionValidator` judges an enum member's value (a new `AdmissionTable` row) and pushes interface and union hosts on `_enclosingTypes`. `IsMemberConstAdmissible` answers for every member access the checker bound: true for a `const` whose fact is true through any receiver, an enum member and its `.value`, and — rung 3: a referenced assembly's constant has no Sharpy symbol — a literal of a referenced module (discovery's `IsConst`); false for every other bound member (a `@static` field, property or method, own or inherited; a module variable; a CLR static that is no literal). The shape rule keeps only what the checker did not bind. Every table reads the answer: a `const` handed a non-constant member is a computed constant, never C#'s `const`; an attribute argument refuses under SPY0425, and `GenerateAttributeArgumentExpression` prints a bound member by the ordinary read route. A `ComparisonChain` is admitted when each link is. Predicate: no expression reaches C# as a non-constant in a constant position, and no constant admitted today is refused. +- **D8 (#2432; Semantic, Validation, CodeGen).** One answer per name the checker bound, for the identifier and member hooks, under every spelling (N7). True: a `const` whose fact is true; an int enum's member and its `.value`; and — rung 3: a referenced assembly's constant has no Sharpy symbol — a literal field of a referenced type or module (a module's by discovery's `IsConst`; a type's or enum's by `FieldInfo.IsLiteral`, through `ClrTypeHelper`). False: every other bound name (a `@static` member, own or inherited; a module variable, property or function; a string enum's member, any `.name`; a CLR static that is no literal). The shape rule keeps only what the checker did not bind. Every `IsAdmitted` call passes the answer: a `const` handed a non-constant is a computed constant, never C#'s `const`; a struct auto-property is a constructor parameter only for a constant (`MarkStructConstructorProperty`) and otherwise keeps its initializer and runs; the validator judges an enum member's value (a new `AdmissionTable` row), pushes interface and union hosts on `_enclosingTypes`, and refuses an attribute argument under SPY0425, each argument first checked by the checker as an expression (its names bound and refused by kind) and printed by `GenerateAttributeArgumentExpression`'s ordinary read route. A `ComparisonChain` is admitted when each link is. Predicate: no expression reaches C# as a non-constant in a constant position, and no constant admitted today is refused. - **D9 (codes).** SPY0619 (N2; the text carries both readings and the qualified spelling) and SPY0620 (R-QI), each with its `DiagnosticExplanations` entry; SPY0618 retires. T8 edits, in one commit, the table's rows, the `Expect*` arms that mirror them and `AdmittedRefusals`: D3's N2 cells leave `kind:instance-at-initializer` and `SPY0401`, N2 admits SPY0619 alone, N2-module SPY0619 and SPY0204, `kind:enum-member-constant` SPY0401, `N1-arity` names its code; S0b's R-QI cells, which admit none today, admit SPY0620. -- **D10 (an alias names a type that exists; owner).** An alias whose target names a missing type — as the name itself, inside a wrapper, type argument or callable, dotted, or in a generic alias's body — is SPY0202 at the alias, at every site (module, type body, function, block), named or not: both binders resolve the target where the alias is declared. Predicate: no declared alias's target names a missing type. -- **Out of contract:** a read above a same-scope local (P80); a store without `global` (P79); a walrus over `let` (P21b); `ALSO = RED` (#2069); a receiver read untyped at either order (an `auto` field, a `@static property`: #2417, S0b's 150 rows); a recursive alias (unruled); the #2397 rows; `T !E` above its `E` (#2249); `from m import x` as a live alias (N6). +- **D10 (an alias names a type that exists; owner).** An alias whose target names a missing type — as the name itself, inside a wrapper, type argument or callable, dotted, or in a generic alias's body — is SPY0202 at the alias, at every site (module, type body, function, block), named or not: both binders resolve the target where the alias is declared, expanding none that reaches its own alias (#2769, unruled: unused, it still runs). Predicate: no declared alias's target names a missing type. +- **Out of contract:** a read above a same-scope local (P80); a store without `global` (P79); a walrus over `let` (P21b); `ALSO = RED` (#2069); a receiver read untyped at either order (#2417, S0b's 150 rows); a self-reaching alias named by an annotation (#2769); the #2397 rows; `T !E` above its `E` (#2249); `from m import x` as a live alias (N6). ## Implementation ### Phase 1: Names are order-free and typed (N1) -**Goal:** one symbol and one type per name. - **Acceptance:** - **A1.** #2423's module-level rows under N1, N1-nesting and N3 drain: a module variable's by D1, the untyped reads of a later type's member, module property, alias or union by D2 — **M1:** declare only annotated variables → the `auto` cells red -- **A2.** S0b's typed-read rows citing #2423 drain: SPY0220 at both orders, under every spelling and reader position — **M2:** skip a type's members in the pre-pass → the annotated-member cells CS1503; drop the first-read check → the inferred ones +- **A2.** S0b's typed-read rows citing #2423 drain: SPY0220 at both orders, under every spelling and reader position — **M2:** skip a type's members in the pre-pass → the annotated-member cells CS1503; drop the first-read check → the inferred ones; remove the in-progress mark → a ring of two `auto` lambdas (`1`) never ends - **A3.** `StaticStorageFactsRoundTripTests` and `ColdWarmBuildDifferentialTests` hold a variable's export equal to its declared symbol, cold and warm, per importer form — **M3:** create the symbol in `CheckVariableDeclaration` again → the cold cell red - **A4.** The N1-innermost rows and the module-level N1-type-error and N1-arity rows drain; S0b's callee cells print `1` under every outer binding and its later-`__init__` cell runs — **M4:** send one site back to `LookupFunctionOverloads` → red, and the census pin red -- **A13.** S0b's missing-target alias cells are SPY0202 at every site and shape, named or not; their controls run — **M13:** resolve at first use → the unused cells print `1`; skip the function-scoped binder → its cells do +- **A13.** S0b's missing-target alias cells are SPY0202 at every site and shape, named or not; their controls run — **M13:** resolve at first use → the unused cells print `1`; skip the function-scoped binder → its cells do; expand a self-reaching target → a stack overflow #### Tasks - **T1. Module variables (D1)** — `NameResolver.Declarations.cs`, `NameResolver.Members.cs`, `TypeChecker.Statements.cs`, `ProjectCompiler.Phases.cs`, `StaticStorageFacts.cs`; regenerate (A12). (A1, A3) - **T2. Types before reads (D2)** — `TypeChecker.cs`, `TypeChecker.Statements.cs`, `TypeChecker.Definitions.cs`. (A1, A2) -- **T3. One callee resolver (D5)** — `TypeChecker.Expressions.Access.Calls.cs`, `TypeChecker.Expressions.Access.Calls.Overloads.cs`, the census in `DispatchSiteInventoryTests`. (A4) +- **T3. One callee resolver (D5)** — the `TypeChecker*.cs` files holding the 33 sites; the census in `DispatchSiteInventoryTests`. (A4) - **T12. Alias targets (D10)** — `ResolveTypeAliasDeclaration` (`NameResolver.Members.cs`), `RegisterScopedTypeAlias` (`TypeChecker.Utilities.cs`), `TypeResolver.cs`. (A13) ### Phase 2: Ambiguity and bodies (N2, N4, N7) -**Goal:** one verdict and code per read. - **Acceptance:** - **A5.** #2423's type-level and N2-module rows drain, C08's pin in `StaticInitializerOrderMatrixTests` moves to SPY0619, and no cell under N2 answers with another code — **M5:** restore F2's yield → `64`; restore the `const` exemption → `3`; report under SPY0200 → red; let a function body count for D6 → its controls red - **A6.** The #2398 rows and #2423's R-Y, N1-methods and R-KG rows drain; the hand control, scope {own body, nested type at two depths, lambda in an initializer, comprehension body} × host {class, struct, interface, union}, holds one diagnostic with its position's phrase — **M6:** drop D4's crossing → SPY0909; give the lambda the method-body text → red @@ -102,20 +94,18 @@ No rule below reads a builtin or type name; a rung applies only in D8. ### Phase 3: Constant positions (#2432) -**Goal:** a constant position's verdict is the checker's. - **Acceptance:** -- **A9.** The #2432 rows of both allowlists drain: a non-constant member (`math.pi`, `sys.maxsize`) is SPY0401 at a default, a field and an enum member (python runs them: #2768), SPY0425 at an attribute argument, a computed constant at a `const`; a chain is admitted exactly when its links are; `subprocess.PIPE` prints `-1` at every host — **M9:** answer null for a bound non-constant member → CS1736; skip the enum row → CS0133; admit every chain → `0 < 2 in [1, 2]` reaches C#; keep the attribute printer's member arm → CS0103 +- **A9.** The #2432 rows of both allowlists drain, each S0b constant-kind cell as its row says (a non-constant refused, computed or kept by its position; a referenced literal run everywhere) — **M9:** answer null for a bound non-constant → CS1736; answer false for a type's literal → `int.max_value` SPY0401; skip the enum row → CS0133; classify the struct property with no resolver → CS1736; admit every chain → `0 < 2 in [1, 2]` reaches C#; skip the attribute argument's check → CS0120; keep the attribute printer's member arm → CS0103 - **A10.** An interface or union parameter default draws one diagnostic — **M10:** drop either push → two #### Tasks -- **T10. The validator (D8)** — `ConstantPositionValidator.cs`, `ConstantDefaultClassifier.cs`, `ConstEligibility.cs`, `RoslynEmitter.TypeDeclarations.cs`. (A9, A10) +- **T10. Constants (D8)** — `ConstantPositionValidator.cs`, `ConstantDefaultClassifier.cs`, `ConstEligibility.cs`, `CodeGenInfoComputer.cs`, `TypeChecker.Definitions.cs`, `ClrTypeHelper.cs`, `RoslynEmitter.TypeDeclarations.cs`. (A9, A10) ### Phase 4: Spec and record **Acceptance:** -- **A11.** `docs/language_specification/variable_scoping.md` is rewritten around N1–N7: each rule's example executed and printing something else with its rule off; an `error` block per refusal; the F1, F2, R-JJ and SPY0618 texts gone; touched files drained (R-BG). `variable_declaration.md` § Bare Declarations beside it states D7, and the 22 such declarations in `function_types.md`, `collection_types.md`, `type_annotation_shorthand.md`, `parameter_modifiers.md` and `properties.md` get a value or move into a body. `docs/deviations.yaml`: `class-body-bare-name-read` is N1 and N2's text. `docs/design/name-resolution.md`: the *Today* notes of N1, N2 and N4 go, and it and `docs/design/gap-discovery-contracts.md` name the table. #2426's other open items are fixed or marked pending with their issue. `check_spec_blocks.sh` green +- **A11.** `docs/language_specification/variable_scoping.md` is rewritten around N1–N7: each rule's example executed and printing something else with its rule off; an `error` block per refusal; the F1, F2, R-JJ and SPY0618 texts gone; touched files drained (R-BG). `variable_declaration.md` § Bare Declarations beside it states D7, and the 22 such declarations in five other spec files get a value or move into a body. `docs/deviations.yaml`: `class-body-bare-name-read` is N1 and N2's text. `docs/design/name-resolution.md`: the *Today* notes of N1, N2 and N4 go, and it and `docs/design/gap-discovery-contracts.md` name the table. #2426's other open items are fixed or marked pending with their issue. `check_spec_blocks.sh` green - **A12.** `regen: no diff` after T1 and T4, for spy-stdlib C#, spy-test C# and `.expected.cs`; `FrontEndParityTests` green - Allowlists drain, each row in the commit that turns it green: every #2423, #2398 and #2432 row of both; both scorecard baselines lowered with `--lower` @@ -127,7 +117,7 @@ No rule below reads a builtin or type name; a rung applies only in D8. - Fixtures: one `.spy` + `.expected` per rule and one `.error` per refusal code and D4 phrase, each with its running control. - Beyond the generator: host {interface, union}; the project route (A3). -- Outputs discriminate: member and outer values differ in every cell. Spec: A11, of equal weight. Regeneration: A12, early. +- Outputs discriminate: member and outer values differ in every cell. ## Issues to Close @@ -140,102 +130,10 @@ No rule below reads a builtin or type name; a rung applies only in D8. - #2427 (the principle), #2457 (the harness's residue) - #2486 — the rule tables; #2487 stays open (owner): rows written from the rules, the generator reading its verdict from the table, every rule id in `name-resolution.md`, no negated constraint, the spec's tables generated from it -- #2397, #2417, #2069, #2249, #2383, #2768 — neighbours named above +- #2397, #2417, #2069, #2249, #2383, #2768, #2769 — neighbours ## Revision log -- @ 8bd4b49fc — revised before the first pass: stage 0 landed; D8's nine cells must-run; D10 (A13); #2432's close; 32 rows to #2397. -- @ a7fbd945d — revised after the 1st pass (NEEDS REVISION, Dimension 6): stage 0 closes S0b's seven axes; D2 resolves declared types first, with no SPY0240 arm (refusing a ring of unannotated lambdas that runs is unruled); D4 is variable-only; D1 deletes the bridge arm; D8 answers for every bound member and table; D10 names both binders; the `auto`-field read is #2417's; A8 records every code; #2487 stays open. - -## Verification Summary - -**Result:** NEEDS REVISION (Dimension 6, with one Dimension 4 design row: D8; pass 2 of 2, so the open findings go to the owner, R-LW) -**Adequacy:** CELL -**Verified on:** 2026-11-20 @ 656991807 (product code == e24aaf9f0; stage 0 @ 0c5446974; Debug `sharpyc` built at this tree; python = CPython 3.15.2, `.venv/bin/python3`) -**Plan file:** `docs/process/plans/plan-777361.md` (committed in §4 at every result, NEEDS REVISION included) - -### Paraphrase -- **Changes:** a module-level or class-level name gets one meaning, one type and one legality verdict wherever it is read. Name resolution declares every module variable as it does a `const`, and the checker completes that symbol and creates none (D1). `CheckModule` resolves every declared type before any body or initializer; an unannotated value is checked on its first read under an in-progress mark, and a read that re-enters its own inference stays untyped with no new refusal (D2). One class-body rule decides a bare sibling read from the member's level, its order against the reader, whether a binding outside the body holds the name, and the position: earlier is the member; at-or-after under an outer binding is the new SPY0619 for every kind and position; at-or-after with none is a forward read (D3). A nested type's body, a lambda in an initializer and a comprehension's body stop seeing an enclosing type's variables bare, each with its phrase in SPY0200; types, aliases and functions still bind (D4). A bare callee resolves by the walk a bare read uses, with the 33 direct lookup sites behind one resolver (D5). A load-time read of a builtin name its module declares at or after the reader is SPY0619 (D6). A module variable, a `@static` field, and a module or `@static` auto-property with no initializer is the new SPY0620 (D7). The constant-position validator judges an enum member's value, pushes interface and union hosts, and answers a bound member access by what the member is; a chain is admitted link by link; the attribute printer takes the ordinary read route (D8). SPY0618 retires and T8 re-labels the table, the generator's arms and the admitted codes in one commit (D9). An alias whose target names a missing type is SPY0202 at the alias, at every site and shape, used or not (D10). The spec is rewritten around N1–N7; rows drain in the commit that turns them green; #2487 stays open. · **Today:** order decides (a function reading a later module variable is SPY0200); kind decides (a later `@static` yields to a module binding, a later literal `const` outranks it, a later computed `const` is SPY0618); a forward read is untyped (CS0029 behind SPY0908); a nested type's initializer ICEs; `x()` on a parameter under a module `def x` calls the module's; constant positions leak CS0133 / CS1736; a declaration with no initializer reads `0`; an unused alias to a missing type runs. Instruments: an 8951-case pool with 2368 known-red rows and a 2225-case generated type with 639. · **Could not paraphrase:** none. One sentence reads two ways and is raised below (D8's list against its predicate). - -### Corrections Made -- None. The body is 20,470 of 20,480 bytes; every correction below grows it or is the author's or the owner's. - -### Stage 0 checks (contract §11) -- **Path check:** `git merge-base origin/dev 0c5446974` = e24aaf9f0; `git diff --name-only e24aaf9f0..0c5446974 -- ':!docs/process/plans/'` lists `build_tools/scorecard-baseline.json` and 13 files under `src/Sharpy.Compiler.Tests/Conformance/`. Not seeded. PASS. -- **Green @ 656991807 (measured):** `ScopeMeaningDifferentialTests` + the two `RuleTable_` facts 6/0/0 (1.6 min): pool 2225 (683 must-run, 1542 must-refuse), python agreed 30/30, red 639, allowlist 639 (463 / 26 / 150 cite #2423 / #2432 / #2417). Both generated types, `ClassBodyReadPositionMatrixTests`, `StaticInitializerOrderMatrixTests`, `ConstantPositionValidator*`: 304/0/0 (11.3 min) after the last restore; the 8951 pool ran 8951, python agreed 8951/8951, allowlist 2368, no red outside it. Table: 198 rows, 49 rules. `scorecard_metrics.py --check`: OK (seed 2368, outside 1211; the base holds 572). `check_spec_blocks.sh`: sweep clean, failing 0. CI on #2767 at this tip: every gate green; `review-line` red (no review line yet). -- **The enumeration and the totality assertions, as read.** A cell's tag and rule come from its one row of `name-resolution-rules.txt` (`RuleTable_EveryCaseHasOneRow_AndTakesItsVerdictFromIt`); the twelve rows of this type carry no negated constraint. `Axes_EveryValueIsGeneratedOrExcluded` partitions, with no default arm: `BindingKind` (three times), `TypeKind` (twice), `SemanticType`'s concrete subclasses, `Spelling`, `ReadPosition`, `Order` per set, `LocalTarget`, `AdmissionTable`, `ScopeKind`, the declared properties of the alias's three AST records, and the Stdlib census of `FieldSignature` (`IsConst` × `IsGuarded`); it pins the alias binders to the pool's binder census. `Exclusions_RestingOnTheCompiler_GoRedWhenItChanges` runs six probes. -- **Mutations re-run, each ALONE, from a `cp` copy, restored and confirmed by `cmp`:** - - totality: the `N1-alias-target` row deleted → both `RuleTable_` facts red, "matches no row" (2 failed); - - a passing case listed known-red (`read/alias-target/Declared/Unused/Later/struct/optional`) → `ScopeMeaning_Sweep` red, STALE, allowlist 640 (1 failed, 4 passed); - - one per axis family, one run each, `Axes_…` red each time (1 failed): the lambda table's hosts removed ("constant-kind × host: LambdaParameterDefault is neither generated nor excluded"); `sys.maxsize` listed as a CLR literal ("discovery records it (False, False)"); the `(false, false)` census shape removed; `ModuleEnum` removed from the callee outers; the struct alias host removed; `TypeAnnotation.ErrorType` removed; `BaseList`'s exclusion removed; the R-QI struct host removed; the alias set's `Self` exclusion removed. The stage-0 body records these applied together; each alone is this pass's record; - - a falsifier probe handed a compiling program (`x: int = 5` for the module `let`) → `Exclusions_…` red (1 failed); - - **a control that stays green:** the `local-const` host removed from `ConstantHosts[ConstInitializer]` → `Axes_…` 1 passed. The hosts under a table are a hand list (finding 2); - - all restored → the 304/0/0 above; `git status --short` empty. - -### Adequacy -- **Contract:** named — one answer per name for every binding kind, order, spelling and reading position; a refusal under one code where python's reading differs; a constant position refuses a non-constant itself. -- **Axes:** open: constant-kind × member kind ← the kinds of member a constant position's resolver answers for (D8: every member access the checker bound — a type's own members, which are `BindingKind`'s; a referenced TYPE's literal, non-literal static and enum member; a referenced module's values, the one part the census covers); constant-kind × host ← the readers of each `AdmissionTable` value (a call-site census of `ConstantDefaultClassifier.IsAdmitted`: 6 @ e24aaf9f0, three in the validator, two in `ConstEligibility`, one in `CodeGenInfoComputer`). The other axes pass 1 named are roster-closed, each with its assertion and that assertion's mutation. The 8951 pool's rosters are P77a's and were not re-graded. -- **Cure:** seam + sweep — silent wrong behaviour, a position missing a shared check, SPY0908 as a net. -- **Harness:** named + allowlist delta (of the 2368 seed rows, 1076 / 6 / 27 cite #2423 / #2398 / #2432; 639 rows of the new type). -- **Layer:** D8's rung-3 arm names a fact that exists for a module's fields only (finding 1); no rule reads a builtin or type name. - -### Scope & convergence -- **Group:** one (P78; chores none; #2432 in by R-KV) · **Alone:** no — required? no · **Gates:** 1 -- **Generator:** existing `NameResolutionDifferentialTests` + stage 0 @ 0c5446974, mutations re-run. Hand controls named: the project route (A3); steer text and count per position × host. -- **Trackers named:** #2427, #2457, #2486, #2397, #2417, #2069, #2249, #2383, #2768 · **Fidelity rows:** named. -- **Convergence (contract §12):** the previous pass was NEEDS REVISION on Dimension 6, so the rule was applied. Findings 1 and 2 are not deferrable: finding 1 changes what D8's resolver answers and has no catcher; finding 2 is a value missing from a hand-listed refinement. NEEDS REVISION stands. Findings 3 to 6 are deferrable and are also written in the deferred-row form. - -### Findings -Each carries its second-pass label against 55846bb3f. Programs are `sharpyc run` @ 656991807, each with a running control. - -1. **D8's list refuses a constant that works today, and no cell would see it** (Dimension 4 design row + Dimension 6; **re-opened**: the log says stage 0 closes the seven axes, and pass 1 named this one "the member kinds `IsMemberConstAdmissible` answers for"). D8 answers true for a `const`, an enum member and its `.value`, and "a literal of a referenced module (discovery's `IsConst`)", and false for "every other bound member". A literal field of a referenced TYPE is bound by the checker (`b: bool = int.max_value` is SPY0220) and is none of the three. `def f(x: int = int.max_value)` prints `2147483647` today, and `x: float = Math.PI` prints `3.141592653589793`; `Int32.max_value` runs as a parameter default (through `from system import` and through `system.`), a dataclass field, an enum member's value, an attribute argument and a struct property default. `IsConst` is set in one place, `OverloadIndexBuilder.cs:636`, for a module's fields; a type's field has no such fact. Read as written, D8 makes these SPY0401: `worked` → refused, unruled, against D8's own predicate ("no constant admitted today is refused"). No case of either pool hands a constant position a referenced type's member, and a grep of the `.spy` fixtures for `int.`, `Int32.` and `Math.` in a default found none, so nothing goes red. The same axis has two more parts with no case: a referenced type's non-literal static (`String.empty`, `Environment.processor_count` as a default: CS1736 behind SPY0908), and a type's OWN members at the four hosts the 8951 pool has no position for (lambda default, attribute argument, module and local `const`). `@[system.component_model.default_value(H.x)]` with `x` a `@static` field, an `auto` field, a `@static property`, an inherited field or a computed `const` is CS0182 behind SPY0908, and `E.RED.value` there is SPY0909 (`Unsupported decorator argument expression: MemberAccess`); the lambda-default twins are SPY0401 already. -2. **The hosts that reach a table are a hand list, and one reader sits outside the validator** (Dimension 6; **new**). `CodeGenInfoComputer.MarkStructConstructorProperty` classifies a struct's defaulted auto-property against `AdmissionTable.ParameterDefault` with no resolver, so the shape rule answers alone. `struct S: property p: int = H.x` (a `@static` field), `= math.pi` and `= sys.maxsize` are CS1736 behind SPY0908; `= five()`, a bare module variable, a `const`, and the same property in a class or in a struct with its own `__init__` all run `5`. It is #2432's class by its title ("a default through H.x is CS1736"). D8 names the validator; T10 does not list `CodeGenInfoComputer.cs`; the 8951 pool's `InstancePropertyDefault` host is a class; this type's `ParameterDefault` host is a `def`. The green control above shows the assertion cannot see a missing host. -3. **D8's "bound" does not hold at an attribute argument** (Dimension 4; **new**; deferrable). The checker visits no bracket-attribute argument: its one reader of a decorator is `DetectGeneratorAttributes`, and the `DecoratorArgument` cells carry SPY0452 (unused import) on the import their argument names. "The shape rule keeps only what the checker did not bind" therefore keeps every attribute argument, and "prints a bound member by the ordinary read route" has no binding to print. A9's attribute bullets need the checker to check each attribute argument first, in a `TypeChecker` file T10 does not list. -4. **Nothing pins an unused self-reaching alias** (Dimension 7; **new**; deferrable). `type K0 = K0`, `type K0 = list[K0]`, a two-alias ring and a function-scoped one, all unused, run `1` today. D10 resolves a target at the declaration; the alias set excludes orders `Self` and `Cycle` whole; #2769's body carries the warning and the plan does not. Resolved eagerly they recurse in `ExpandTypeAlias`, and a stack overflow is no diagnostic. -5. **D10's module-level binder runs before imports and before later types exist** (Dimension 3; **new**; deferrable). `ResolveTypeAliasDeclaration` is name resolution's; a dotted target and a target declared later cannot be judged there. The `dotted` and `Later` must-run cells are the catcher. -6. **A reason that is false as written** (Dimension 1; **new**; deferrable). `TypeKind.Delegate` is excluded twice as "no Sharpy declaration"; `delegate` is a keyword with `DelegateDef`. The exclusion stands for another reason: a delegate declaration has no body to host a member or an alias. - -**settled** (an owner ruling decides it; not raised): #2487 stays open (comment 7039834146 item 6); the nine must-run cells, D10's refusal and #2432's close on SPY0401 (7030074628). **declined:** none in the log. **churn:** none; no cure above undoes an answer the revision gave. - -The orchestrator's decisions and defaults, graded as claims: -- D9 stays at T8 (7039834146): sound; stage 0 cannot hold it without seed rows item 1 did not approve. -- The `auto` field typed read cites #2417 (7039834146): sound, and held by a rule (`ProposedCite`, with its fact): 150 rows, each red at the earlier order or the later twin of one. -- D4's crossing stays variable-only (7039834146): matches `Scope.ResolveName` (`hit is VariableSymbol`). -- A recursive alias is out of P78 (7041455175 item 1): sound as scope, and it needs no owner's word while it changes no behaviour; finding 4 is what makes that hold. -- No SPY0240 for a ring of unannotated lambdas (7041455175 item 2): sound; the ring runs `1` today and D2 adds no refusal. It needs no owner's word. - -Decisions that are the owner's (this pass asked nothing): -1. **Finding 1.** (a) One more revision and a stage-0 commit: D8 answers true for a literal field of any referenced type or module, by a CLR-keyed fact (rung 3) where discovery has none, and the member-kind axis is closed against the bound-member kinds named under Axes; `allowlist_rows_outside_seed` rises by the measured red count; a third pass, limited to D8 and the constant-kind set, needs the line `Extra verify pass 3: owner …`. (b) D8 answers only for the members it lists and leaves every other bound member to the shape rule, and the referenced-type and own-member cells go to #2432, which then does not close in P78. (c) Implement as written. Recommended: (a). Under (c) a refusal of `int.max_value` as a default lands with nothing to catch it. -2. **Finding 2.** (a) The same stage-0 commit pins the hosts to the reader census and adds the struct auto-property host (must-run: the default keeps its initializer, as `five()` does today); T10 gains `CodeGenInfoComputer.cs`. (b) The host goes to #2432 as a cell and #2432 stays open. Recommended: (a). - -### Falsifiability -- A1 / M1, A2 / M2 (two), A3 / M3, A4 / M4 (and the census pin), A5 / M5 (four), A6 / M6 (two), A7 / M7 (with its control), A9 / M9 (four), A10 / M10, A13 / M13 (two): mutation named; exemption not subject; positive control yes; by-direction specified. -- D2's in-progress mark: mutation MISSING — expected: remove the mark → `@static a: auto = lambda: H.b` beside `@static b: auto = lambda: H.a` (runs `1` today) no longer terminates; restored → `1`. -- A8 (the direction record): every code now. It cannot see finding 1's programs: none is in a fixture, a spec block or the `.spy` stdlib. -- A11: each example discriminates. A12: an absence assertion whose positive control is the staleness gates. -- Stage 0's facts and sweeps: mutations re-run above, each alone. - -### Deferred findings -- (not CONVERGED; findings 3 to 6 in the form a CONVERGED stamp would list them) -- D8's "bound" at an attribute argument ← the checker's visits of `Decorator.Arguments` (none) — fix: the checker checks each bracket-attribute argument as an expression — proved by `ScopeMeaning_Sweep` (the `DecoratorArgument` rows stay red until it does) and M9's fourth mutation. -- alias-target × order `Self`, `Cycle` ← `Order` — fix: generate the unused cells as must-run and keep the used ones excluded citing #2769 (`ExcludedOrders["alias-target"]`) — proved by `Axes_EveryValueIsGeneratedOrExcluded` and the sweep. -- D10's module-level judgement ← the pipeline order — fix: judge the target once every type and import is declared — proved by the `dotted` and `Later` must-run cells. -- `ExcludedDeclarationHosts[Delegate]`, `ExcludedAliasTypeHosts[Delegate]` ← `DelegateDef` — fix: the reason's text — proved by `Parser.cs` (`TokenType.Delegate => ParseDelegateDef()`). - -### Warnings -- T3 lists two `TypeChecker` files; the 33 sites are in ten (count re-measured: 33). The census pin is the catcher. -- A1's, A4's, A5's and A6's "which decision drains which rule" is the author's reading, not run. -- The Generator line does not name "one value per declared type" or "the hosts under a table" among its hand lists. -- `case subprocess.PIPE:` and `case m.K:` (SPY0202 "Undefined type … in pattern"; python `1`) are outside this plan's contract: the pass report's ledger. - -### Missing Steps Added -- None added to the body (the cap). For the revision: D8's list and its rung; `CodeGenInfoComputer.cs` in T10; the `TypeChecker` file that checks attribute arguments; the mutation for D2's mark; the unused self-reaching alias control. - -### Unchecked Claims -- D2's pre-pass and first-read check drain the 280 typed-read rows that cite #2423: a design with no prototype. That D2 also types the #2417 cells: not run; the ratchet's STALE arm reports it. -- D5's "one resolver carries all 33 sites": the count is measured, the rest untraced. -- D1's cold and warm export identity and the bridge arm's deletion: the code's own note says the same; not run. -- "No snapshot moves" (A12): the regeneration after T1 and T4 proves or refutes it. -- A11's 22 declarations in five spec files, and that each becomes SPY0620: pass 1's count, not re-taken. -- `TypeResolver.cs` as where a generic alias's body resolves: `ExpandTypeAlias` is there and is reached at a use; the type-parameter substitution was not traced. -- Not run: a control at the base sha (product code at this tip is the base's), the whole `build_tools/tests` suite, the hand controls' own mutations, a local whole-solution gate (CI at this tip is green). +- @ 8bd4b49fc — revised before the first pass: stage 0, D10, #2432's close. +- @ a7fbd945d — revised after the 1st pass (NEEDS REVISION, Dimension 6): S0b's seven axes closed; D2 with no SPY0240 arm. +- @ 656991807 — revised after the 2nd pass (NEEDS REVISION, Dimension 6): stage 0 closes the member-kind axis and pins hosts to the reader census; D8 per bound name: a type's literal, the struct auto-property, checked attribute arguments (findings 1–3); 4, 6 and D2's mark folded. Unruled: D8 refuses a string enum's member by call 43. Deferred (owner): D10's module-level judgement ← the pipeline order — fix: judge the target once every type and import is declared — proved by the `dotted` and `Later` must-run cells. From 620dfff808c1eec9827f3072a5ff8336b3b58208 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 17:32:19 +0000 Subject: [PATCH 14/22] =?UTF-8?q?process(plan):=20plan-777361=20=E2=80=94?= =?UTF-8?q?=20verified=20NEEDS=20REVISION=20@=2056dbb009f?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /verify-plan pass 3 of plan-777361 (P78), the extra pass the owner asked for (#2423 comment 7045333238). Result NEEDS REVISION, Adequacy CELL (Dimension 6, with one Dimension 4 design row on D8). The one file of record. Body edits, each listed before/after in the Verification Summary: - Scope gains the pass cap's record: Extra verify pass 3: owner, 2026-11-20 "run a third verify pass" (R-LW); - Owner rulings cite comment 7045166298 (ruling 10); - the Revision log's "Unruled: D8 refuses a string enum's member by call 43." is deleted: ruling 10 decides it; - the Generator row no longer claims a probe for every exclusion that rests on the compiler (two have none). Body 20,473 -> 20,473 of 20,480 bytes; check_plan_refs.py: RESULT OK, 3 verify passes with the extra pass ruled. Measured @ 56dbb009f (product code == e24aaf9f0; CPython 3.15.2): ScopeMeaningDifferentialTests 3070 cases, 829 known-red rows; both generated types and the hand controls 305/0/0 after the last restore; ten stage-0 mutations re-run, each alone, each red; one control stays green (a constant read's spelling is a hand list: finding 1). Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01LGMKZVcFYGqQRfHgd16DLa --- docs/process/plans/plan-777361.md | 119 +++++++++++++++++++++++++++++- 1 file changed, 115 insertions(+), 4 deletions(-) diff --git a/docs/process/plans/plan-777361.md b/docs/process/plans/plan-777361.md index 0771f9c93..623166f2d 100644 --- a/docs/process/plans/plan-777361.md +++ b/docs/process/plans/plan-777361.md @@ -1,4 +1,7 @@ - + + + + # P78 — N1/N2/N4/N7: scope decides meaning @@ -21,6 +24,7 @@ Rules N1, N2, N4 and N7 of `docs/design/name-resolution.md` (charter §3.20l): # - **Gates:** 1 — `/ci-gate` on the pushed tip, counts `@ sha (measured)` - **Filing:** findings ledger; the lead files by class (contract §10) - **Override:** none +- Extra verify pass 3: owner, 2026-11-20 "run a third verify pass" ## Defect Class @@ -30,8 +34,8 @@ Rules N1, N2, N4 and N7 of `docs/design/name-resolution.md` (charter §3.20l): # - **Sibling cells this plan must also cover:** none; see Generator. - **Lane / reach:** false-refusal + silent-wrong + ice · program; **fidelity-scope row:** "which programs run vs. are refused" and "value of an expression", both COMPARED. - **Standing harness that should have caught it:** `NameResolutionDifferentialTests`; `ClassBodyReadPositionMatrixTests` is the hand control (R-KF) for steer text and diagnostic count per position × host. -- **Generator:** stage 0 (§2.1) @ 3a422a6fe. `name-resolution-rules.txt` (S0a, #2487): every cell of both pools has exactly one row and every row a cell. `NameResolutionDifferentialTests`: 8951 cases, 2368 known-red rows. `ScopeMeaningDifferentialTests` (S0b): 3070 cases, 829 known-red rows (463 / 216 / 150 cite #2423 / #2432 / #2417), verdicts read from the rows. Each S0b axis is an image with its source in `ScopeMeaningDifferentialTests.Axes.cs`, every value generated or excluded with a reason and, where the reason is the compiler's, a probe (`Axes_EveryValueIsGeneratedOrExcluded`). Hand lists: a reader's hosts (a `const`'s aside), one expression per member kind, one value per declared type. Closed by decision: the chain pair (call 45), the five other `Scope*` enums, one call site per callee cell (D5's census). Excluded: the project route (A3), message text, a self-reaching alias an annotation names (#2769), an interface host (#2383). Green by D1, D2, D5, D10 (A1, A2, A4, A13), D3, D4, D6, D7 (A5–A7), D8 (A9). -- **Owner rulings:** R-KD, R-KF, R-KG, R-KJ, R-KV, R-LJ, R-LO, R-PM, R-QE, R-QI (charter §4); #2432's call-43 and call-45 cells (§3.20l); owner 2026-11-20, #2423 comments 7030074628 (rulings 1–4), 7039834146 (5–6), 7042723494 (7–9). +- **Generator:** stage 0 (§2.1) @ 3a422a6fe. `name-resolution-rules.txt` (S0a, #2487): every cell of both pools has exactly one row and every row a cell. `NameResolutionDifferentialTests`: 8951 cases, 2368 known-red rows. `ScopeMeaningDifferentialTests` (S0b): 3070 cases, 829 known-red rows (463 / 216 / 150 cite #2423 / #2432 / #2417), verdicts read from the rows. Each S0b axis is an image with its source in `ScopeMeaningDifferentialTests.Axes.cs`, every value generated or excluded with a reason, 15 of them probed (`Axes_EveryValueIsGeneratedOrExcluded`). Hand lists: a reader's hosts (a `const`'s aside), one expression per member kind, one value per declared type. Closed by decision: the chain pair (call 45), the five other `Scope*` enums, one call site per callee cell (D5's census). Excluded: the project route (A3), message text, a self-reaching alias an annotation names (#2769), an interface host (#2383). Green by D1, D2, D5, D10 (A1, A2, A4, A13), D3, D4, D6, D7 (A5–A7), D8 (A9). +- **Owner rulings:** R-KD, R-KF, R-KG, R-KJ, R-KV, R-LJ, R-LO, R-PM, R-QE, R-QI (charter §4); #2432's call-43 and call-45 cells (§3.20l); owner 2026-11-20, #2423 comments 7030074628 (rulings 1–4), 7039834146 (5–6), 7042723494 (7–9), 7045166298 (10). ## Adversarial Review (pre-mortem) @@ -136,4 +140,111 @@ No rule below reads a builtin or type name; a rung applies only in D8. - @ 8bd4b49fc — revised before the first pass: stage 0, D10, #2432's close. - @ a7fbd945d — revised after the 1st pass (NEEDS REVISION, Dimension 6): S0b's seven axes closed; D2 with no SPY0240 arm. -- @ 656991807 — revised after the 2nd pass (NEEDS REVISION, Dimension 6): stage 0 closes the member-kind axis and pins hosts to the reader census; D8 per bound name: a type's literal, the struct auto-property, checked attribute arguments (findings 1–3); 4, 6 and D2's mark folded. Unruled: D8 refuses a string enum's member by call 43. Deferred (owner): D10's module-level judgement ← the pipeline order — fix: judge the target once every type and import is declared — proved by the `dotted` and `Later` must-run cells. +- @ 656991807 — revised after the 2nd pass (NEEDS REVISION, Dimension 6): stage 0 closes the member-kind axis and pins hosts to the reader census; D8 per bound name: a type's literal, the struct auto-property, checked attribute arguments (findings 1–3); 4, 6 and D2's mark folded. Deferred (owner): D10's module-level judgement ← the pipeline order — fix: judge the target once every type and import is declared — proved by the `dotted` and `Later` must-run cells. + +## Verification Summary + +**Result:** NEEDS REVISION (Dimension 6, with one Dimension 4 design row: D8). This is the third pass, the extra one the owner asked for (#2423 comment 7045333238), so the open findings go to the owner (R-LW). +**Adequacy:** CELL +**Verified on:** 2026-11-20 @ 56dbb009f (product code == e24aaf9f0; stage 0 @ 3a422a6fe; Debug `sharpyc` and the test binaries rebuilt at this tree; python = CPython 3.15.2, `.venv/bin/python3`) +**Plan file:** `docs/process/plans/plan-777361.md` (committed in §4 at every result, NEEDS REVISION included) + +### Paraphrase +- **Changes:** a module-level or class-level name gets one meaning, one type and one legality verdict whatever its binding kind, order, spelling and reading position. Name resolution declares every module variable up front as it does a `const`; the checker completes that symbol and creates none at module level, and a variable's export is that symbol cold and warm, so two bridging maps go (D1). `CheckModule` resolves every declared type (module variables and properties, each type's annotated members, nested types) before any body or initializer; an unannotated value is checked at its first read under an in-progress mark, and a read that re-enters its own inference stays untyped with no new refusal (D2). One class-body rule decides a bare sibling read by the member's level, its order against the reader, an outer binding of the name, and the position: earlier is the member; at-or-after under an outer binding is the new SPY0619 for every kind and position; at-or-after with none is a forward read; F1's refusal, F2's yield, the `const` exemption and SPY0618 go (D3). A nested type's body, a lambda in an initializer and a comprehension's body stop seeing an enclosing type's variables bare, each with its phrase in SPY0200; types, aliases and functions still bind (D4). A bare callee resolves by the walk a bare read uses, the 33 direct lookup sites behind one resolver with a census pin (D5). A load-time read of a builtin name its module declares at or after the reader is SPY0619 (D6). A module variable, a `@static` field and a module or `@static` auto-property with no initializer is the new SPY0620 (D7). A constant position gets one answer per name the checker bound: true for a `const` whose fact is true, an int enum's member and its `.value`, and a literal field of a referenced type or module (a CLR-keyed fact, rung 3); false for every other bound name. Every classifier call passes that answer: a `const` handed a non-constant is computed, a struct auto-property keeps a non-constant initializer and runs, the validator judges an enum member's value, pushes interface and union hosts, and refuses an attribute argument under SPY0425 after the checker has checked it as an expression; the attribute printer takes the ordinary read route; a chain is admitted link by link (D8). SPY0618 retires and T8 re-labels the table, the generator's arms and the admitted codes in one commit (D9). An alias whose target names a missing type is SPY0202 at the alias, at every site and shape, used or not; a target that reaches its own alias is not expanded and keeps running unused (D10). The spec is rewritten around N1–N7; rows drain in the commit that turns them green; #2487 stays open. · **Today:** order decides (a function reading a later module variable is SPY0200); kind decides (a later `@static` yields, `64`; a later literal `const` outranks, `3`; a later computed `const` is SPY0618); a forward read in a `bool` slot is CS0029 behind SPY0908; a nested type's initializer reading the enclosing type's field is SPY0909; `x()` on a parameter under a module `def x` prints `12`; `RED = x` is CS0133; a default through `math.pi`, and a struct auto-property's through `H.x`, CS1736; bare imported `PIPE` SPY0401; module `x: T` reads `0`; an unused `type K0 = nosuch` runs. Instruments: an 8951-case pool with 2368 known-red rows and a 3070-case generated type with 829. · **Could not paraphrase:** none. One sentence leaves a reading open and is raised below: D8 has the checker check an attribute argument "as an expression" and does not say in which scope its bare names bind. + +### Corrections Made +- The DRAFT marker is replaced by this pass's stamp. +- **Scope**, added: `- Extra verify pass 3: owner, 2026-11-20 "run a third verify pass"` (+67 bytes). It is the pass cap's record (R-LW; #2423 comment 7045333238), written by the verifier because the revision came before the owner asked. +- **Defect Class › Owner rulings**, the comment that rules D8's string-enum answer: before `7042723494 (7–9).`, after `7042723494 (7–9), 7045166298 (10).` (+17 bytes). +- **Revision log**, the 2nd-pass line: the sentence `Unruled: D8 refuses a string enum's member by call 43.` is deleted (−56 bytes). The owner ruled it after the revision (ruling 10, comment 7045166298: "Refuse with SPY0401 (Recommended)"; the residue is #2772), and that comment says the word is superseded. +- **Defect Class › Generator**, a claim that two exclusions refute (finding 3): before `with a reason and, where the reason is the compiler's, a probe (`, after `with a reason, 15 of them probed (` (−29 bytes). `BehaviourProbes` holds 15 reasons; `ExcludedClrTypeMemberShapes[InconclusiveResult]` and `ExcludedAliasUses[(Itself, Used)]` rest on what the compiler does and have no probe. +- Nothing else was changed. Body: 20,473 → 20,473 of 20,480 bytes (the four edits net −1; the blank line that now separates this summary is +1). The last two edits are corrections in their own right and are also the room the first one needed; every other finding grows the body or is the author's or the owner's. + +### Stage 0 checks (contract §11) +- **Path check:** `git merge-base origin/dev 3a422a6fe` = e24aaf9f0; `git diff --name-only e24aaf9f0..3a422a6fe -- ':!docs/process/plans/'` lists `build_tools/scorecard-baseline.json` and 14 files under `src/Sharpy.Compiler.Tests/Conformance/`. Not seeded. PASS. +- **Green @ 56dbb009f (measured):** `ScopeMeaningDifferentialTests` + the two `RuleTable_` facts 7/0/0 (3.1 min): pool 3070 (1224 must-run, 1846 must-refuse), python agreed 30/30, red 829, allowlist 829 (463 / 216 / 150 cite #2423 / #2432 / #2417); constant-kind 770 cells, 216 red; the 126 unused self-reaching alias cells are must-run and all match; the struct auto-property host has 57 cells, 22 red. After the last restore and a rebuild of the solution: both generated types, `ClassBodyReadPositionMatrixTests`, `StaticInitializerOrderMatrixTests`, `ConstantPositionValidator*`: 305/0/0 (13.4 min); the 8951 pool ran 8951, python agreed 8951/8951, allowlist 2368, no red outside it. Table: 207 rows, 52 rules. Scorecard: `allowlist_rows_outside_seed` 572 → 605 → 1211 → 1401 across the stage-0 commits, the last +190 all constant-kind rows citing #2432, none removed; `scorecard_metrics.py --check`: OK (seed 2368, outside 1401). CI on #2767 at this tip: 35 checks green, `review-line` red (no independent review yet). +- **The enumeration and the totality assertions, as read.** A cell's tag and rule come from its one row of `name-resolution-rules.txt`. `Axes_EveryValueIsGeneratedOrExcluded` partitions, with no default arm: `BindingKind` (four times), `TypeKind` (three times), `ScopeKind` (twice), `SemanticType`'s concrete subclasses, `Spelling` and `ReadPosition` for typed reads, `Order` per set, `LocalTarget`, `AdmissionTable`, the call-site census of `ConstantDefaultClassifier.IsAdmitted` (a syntax scan of `src/Sharpy.Compiler`, a table passed as a parameter followed to its callers: six sites, nine readers, eight generated, `IsExportedConstCompileTime` excluded), the Stdlib census of `FieldSignature` (`IsConst` × `IsGuarded`), the subclasses of `ClrMemberResolution` with a field refined by `FieldInfo.IsLiteral` and an enum owner, `EnumMemberAccessKind`, the pool's `Form`, the declared properties of the alias's three AST records, and target × use for an alias; each listed expression is checked against what discovery or `ClrMemberTypeResolver` answers for it. `Exclusions_RestingOnTheCompiler_GoRedWhenItChanges` runs 15 probes. The census has its own control (`ConstantReaders_TheCensusSeesACallSite_AndFollowsATableParameter`). +- **Mutations re-run, each ALONE, from a `cp` copy, restored by copy with a new modification time and confirmed by `cmp`** (the six facts that run no cell each time; the sweep alone for the known-red row): + - totality: the `kind:SPY0336` row deleted → both `RuleTable_` facts red, "matches no row" for 12 cells (2 failed, 4 passed); + - a passing case listed known-red (`read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeLiteralField/Math.PI Ice # #2432 ice`) → `ScopeMeaning_Sweep` red, "listed as Ice, now Match: STALE, delete the row" (1 failed); + - a reader removed (the struct auto-property entry) → `Axes_` red, "constant-kind × reader: CodeGenInfoComputer.cs:MarkStructConstructorProperty is neither generated nor excluded", and both `RuleTable_` facts (3 failed); + - PRODUCT side, never committed: a tenth `IsAdmitted` call in a new method of `CodeGenInfoComputer.cs` → `Axes_` red, "…:P78VerifyThreeMutation is neither generated nor excluded" (1 failed); + - the three the revising agent ran after its commit: the block `const` site emptied → "Block is listed with no host" (1 failed); the struct-const host given the class-const label → "class-const is the label of 2 hosts" (2 failed); own reads generated without the subclass receiver → "no cell carries Base" (1 failed); + - two expressions listed under each other's kind → `Axes_` red, "the checker's resolver answers Field/static for BitConverter.is_little_endian" and "… Property for Array.max_length" (1 failed); + - a probe handed a program that compiles (`int.max_value` for `int.nosuch`) → `Exclusions_` red, "rests on SPY0203, and the probe now gives [] stdout '1'" (1 failed); + - the (Itself, Used) exclusion removed → `Axes_` red, "alias-target × target × use: (Itself, Used) is neither generated nor excluded" (1 failed); + - **a control that stays green:** the `from math import pi` spelling of one module value removed → 6 passed. No fact holds the spellings a constant position is read under (finding 1); + - all restored → the full run above; `git status --short` empty. +- **A slip of this pass, undone:** a mistyped `touch` created an empty, untracked `CodeGenInfoComputer.cs` (0 bytes) in the compiler's `CodeGen` directory, where no such file belongs. It was moved out of the repository to the scratchpad before any commit. The first 7/0/0 run was built with that empty file in the compiler's source set; every mutation run and the full run above were built without it, and the solution was rebuilt before the full run. + +### Adequacy +- **Contract:** named — one answer per name for every binding kind, order, spelling and reading position; a refusal under one code where python's reading differs; a constant position refuses a non-constant itself. +- **Axes:** open: constant-kind × spelling and placement of the read ← `Spelling` and the reader's placement against the member's type (`DeclaringRelation`), as the typed-read set derives both from the 8951 pool; constant-kind × a referenced module's member ← the member collections of discovery's `ModuleOverloads` (`Functions`, `Types`, `Fields`; the census reads `Fields` alone). Closed, each with its assertion and that assertion's mutation: constant-kind × host (the reader census), a referenced type's member, the program's own enum, the program's own names, and the axes of the other five sets. The 8951 pool's rosters are P77a's and were not re-graded. +- **Cure:** seam + sweep — silent wrong behaviour, a position missing a shared check, SPY0908 as a net. +- **Harness:** named + allowlist delta (2368 seed rows; 829 rows of the new type). +- **Layer:** every decision rung-justified. D8's one rung-3 arm (a literal field of a referenced type, by `FieldInfo.IsLiteral` through `ClrTypeHelper`) has no lower rung: a referenced assembly's constant has no Sharpy source, dunder or protocol spelling. No rule reads a builtin or type name. + +### Scope & convergence +- **Group:** one (P78; chores none; #2432 in by R-KV) · **Alone:** no — required? no · **Gates:** 1 +- **Generator:** existing `NameResolutionDifferentialTests` + stage 0 @ 3a422a6fe, mutations re-run. Hand controls named: the project route (A3), which holds D1 and not D8 (finding 4); steer text and count per position × host. +- **Trackers named:** #2427, #2457, #2486, #2397, #2417, #2069, #2249, #2383, #2768, #2769 · **Fidelity rows:** named. +- **Convergence (contract §12):** the previous pass was NEEDS REVISION on Dimension 6 (the log's 2nd-pass line), so the rule was applied. Finding 1 is not deferrable: the spelling of a constant position's read is carried by hand (two receivers written into `BuildOwnReads`), a value missing from a hand-listed axis has no catcher, and its design row asks D8 for a sentence. NEEDS REVISION stands. Findings 2 and 3 are deferrable and are also written in the deferred-row form; finding 4 is a warning. + +### Findings +Each carries its label against the previous pass (19ffa7ad1). Programs are `sharpyc run` @ 56dbb009f (product code e24aaf9f0), each beside a control that runs. + +1. **A constant position's read has one spelling per name, written by hand, and an attribute argument has red ones** (Dimension 6, with a Dimension 4 design row on D8; **new**; not deferrable). D8 answers "under every spelling (N7)". The constant-kind set reads each of the program's names once: bare at module level, through its type's name, or through a subclass's, always from outside the type (`BuildOwnReads`: `"G."`, `"D."`). None of its 770 cells declares a type alias, renames an import or reads a sibling bare inside the member's own type. The 8951 pool does carry `Spelling`, and has no position for a lambda default, an attribute argument, a `const` outside a class or a struct auto-property. Removing one spelling from the set leaves every fact green (the control above). Red today at both attribute readers, where the same member through its type's name runs: + - bare, inside the member's own type: `class H:` / `const x: int = 5` / `@[system.component_model.default_value(x)]` on a method, and `@[Mark(w=x)]`: SPY0425 "'x' is not a compile-time constant". `H.x` there runs, and `def f(self, p: int = x)` in the same class runs `5`. The validator finds no symbol for an argument the checker never visited and falls back to module scope (`ResolveConstSymbol`); + - through a type alias: `type A = G` / `@[…default_value(A.x)]`, `@[Mark(w=A.x)]`, and `A.RED` of an int enum: CS0103 "The name 'A' does not exist" behind SPY0908. `G.x` and `E0.RED` there run, and through the alias a `def` default, a lambda default, a module `const`, an enum member's value and a struct auto-property all run `5`; + - and a silent one: `const x: int = 12` at module level, then `class H:` with `default_value(x)` on a method above `const x: int = 5`. It runs. The validator admits the module's constant, and the emitted `[System.ComponentModel.DefaultValue(X)]` sits inside `class H`, where C# binds `H.X` (read from `emit csharp`; the attribute's value was not observed at run time). Under D3 this is an at-or-after member with an outer binding: SPY0619 in every position. + + The design row: D8 has the checker check each attribute argument "as an expression (its names bound and refused by kind)" and does not say in which scope. A member's attribute stands in the class body, so D3 would decide its bare names (earlier: the member, and the first program runs; the third is SPY0619). A checker that binds them at module scope keeps SPY0425 or reads the module's. `ReadPosition` has no attribute argument, so no cell of either pool would tell the two implementations apart. +2. **The member-kind axis stops at a module's fields** (Dimension 6; **re-opened**: the log's 2nd-pass line says stage 0 closes the member-kind axis; deferrable). A referenced type's member is the image of `ClrMemberResolution`'s subclasses, a method and a method group included. A referenced module's member is the image of `FieldSignature`'s two facts, and discovery's `ModuleOverloads` holds `Functions` and `Types` beside `Fields`. `import math` / `def f(g: (float) -> float = math.sqrt)` is CS1736 behind SPY0908 (python `5.0`), as it is at a dataclass field, a struct field and a struct auto-property; at both attribute arguments it is CS0182. `const K: (float) -> float = math.sqrt` runs `5.0`, and `b: bool = math.sqrt` is SPY0220, so the checker binds it. D8 already answers false for it; no cell holds that answer. The type-member twin `Math.sqrt` has its 12 cells. +3. **Two exclusions rest on the compiler with no probe, and one states what the code does not do** (Dimension 7 and Dimension 1; **new**; deferrable). (a) `ExcludedClrTypeMemberShapes[InconclusiveResult]` says "the checker binds nothing". `TypeChecker.Expressions.Access.cs` types such a member `UnmappedClrType` in value position: `from system import DateTime` / `b: bool = DateTime.year` is SPY0220 "Cannot assign type 'object'", and `x: object = DateTime.year` is CS0120 behind SPY0908 in a function body, a parameter default, a module `const` and an attribute argument alike. The exclusion stands for another reason: the crash is the same at every position, so it is a missing kind refusal and no constant position's defect (the pass report's ledger; candidate tracker #1975). (b) `ExcludedAliasUses[(Itself, Used)]` cites #2769 and has no probe because the overflow kills the process (re-measured: `type K0 = list[K0]` named by a parameter exits 134). When #2769 is fixed, nothing goes red to say the used cells are owed. +4. **The project route has no control for D8** (Dimension 7; **new**; a warning). The plan says "Beyond the generator: … the project route (A3)", and the census excludes its ninth reader (`IsExportedConstCompileTime`) on the same words. A3 holds a variable's export identity, which is D1's. Nothing holds an imported `const` in a constant position: with `consts.spy` beside `main.spy`, `from consts import K` / `def f(p: int = K)`, `def g(p: int = consts.C)` and an imported class's `G.y` print `5 5 9` today, and the two cross-module fixtures (`const_ref_cross_module`, `const_chained_cross_module`) read the constant in a local and in a `const` initializer only. D8 re-answers every bound name, and an imported constant's fact has its own producer. Expected: a multi-file control per importer form at a parameter default, with the mutation "answer false for an imported constant → SPY0401". + +Against the previous pass's six findings: 1 (a referenced type's literal) is answered in D8 and held by the `ClrTypeLiteralField` cells at every host, with the axis re-opened for a module's functions (finding 2 here). 2 (the struct auto-property host and the reader census) is answered, with its mutations above. 3 (attribute arguments are unchecked) is answered in D8 and T10, with the scope left open (finding 1's design row). 4 (the unused self-reaching alias) is answered by 126 must-run cells, all green. 5 (D10's module-level judgement) stays the owner's deferred row, carried below. 6 (the delegate exclusion's reason) is answered, with its probe. + +**settled** (an owner ruling decides it; not raised): a string enum's member, its `.value` and any `.name` are SPY0401 in a constant position (ruling 10, comment 7045166298; residue #2772); the struct auto-property host must run (ruling 8); a literal field of a referenced type is admitted (ruling 7); a used self-reaching alias is out of P78 and D10's module-level judgement is deferred (ruling 9); `math.pi` as a default is SPY0401 and #2432 closes on that (ruling 4); #2487 stays open (ruling 6). **declined:** none in the log. **churn:** none; no cure above undoes an answer a revision gave. + +Decisions that are the owner's (this pass asked nothing and offers no further pass): +1. **Finding 1**, with finding 2 riding the same commit. (a) One more stage-0 commit and a revision: the constant-kind set takes the read's spelling and placement as an axis (the image of `Spelling` and of the reader's placement, at each host the 8951 pool has no position for), the module-member roster reads every member collection of `ModuleOverloads`, and D8 gains the sentence that says where an attribute argument's names bind (suggested: in the scope its declaration stands in, so D3 decides a member's attribute). `allowlist_rows_outside_seed` rises by the measured red count, which needs the owner's word. (b) The owner rules the axis closed at the two receivers generated: the plan lists it under "Closed by decision", the three attribute programs above become a named hand control in A9, and D8 still gains its sentence; no stage-0 commit. (c) Attribute arguments keep today's verdicts for the spellings not generated, the cells go to #2432 as a comment, and #2432 does not close on A9 alone. Recommended: (a). D8's cure as written probably reaches all three programs; what is missing is the pin and one sentence, and the typed-read set already shows the derivation. +2. **What follows the revision.** The cap is spent and so is the extra pass. A fourth pass runs only on the owner's own words; without one, `/implement-plan` needs the owner's `override:`. The three passes found seven open axes, then two, then one axis and one roster source, and no decision from D1 to D10 was refuted in this pass. + +### Falsifiability +- A1 / M1, A2 / M2 (three, the in-progress mark now among them), A3 / M3, A4 / M4 (and the census pin), A5 / M5 (four), A6 / M6 (two), A7 / M7 (with its control), A9 / M9 (seven), A10 / M10, A13 / M13 (three): mutation named; exemption not subject; positive control yes; by-direction specified (A8). +- M9's anchors re-measured today: a default through `math.pi` and a struct auto-property's through `H.x` are CS1736; `RED = x` is CS0133; `int.max_value` as a default runs `2147483647`; an instance field at an attribute argument is CS0120; `subprocess.PIPE` there is CS0103; `0 < 2 in [1, 2]` as a default is SPY0401. M13's third: exit 134. M2's third: the ring of two `auto` lambdas runs `1`. +- D8 on the project route: mutation MISSING — expected: answer false for an imported `const` → `from consts import K` / `def f(p: int = K)` SPY0401; restored → `5` (finding 4). +- M13's third mutation ends the test host with a stack overflow: its red is a dead process, not a failed assertion. +- A8 (the direction record): every code. Checking attribute arguments is a new refusal channel for any program whose attribute argument C# accepts and the checker does not; A8's "under any code" and the gate hold it. +- A11: each example discriminates. A12: an absence assertion whose positive control is the staleness gates. +- Stage 0's facts and sweeps: mutations re-run above, each alone. + +### Deferred findings +- (not CONVERGED; findings 2 and 3 in the form a CONVERGED stamp would list them, and the owner's deferred row carried from the log) +- constant-kind × a referenced module's member ← the member collections of `ModuleOverloads` — fix: the universe of `Partition("constant-kind × module value", …)` gains `Functions` (a kind with its expression, `math.sqrt` read uncalled) and `Types` (excluded: names a type) — proved by `Axes_EveryValueIsGeneratedOrExcluded` (red until the kind has an expression) and `ScopeMeaning_Sweep` (the cells are red until T10: rows under the owner's word for the baseline, or cells that land with T10's commit). +- `ExcludedClrTypeMemberShapes[InconclusiveResult]` ← `TypeChecker.Expressions.Access.cs` (the `InconclusiveResult` arm types the member `UnmappedClrType`) — fix: the reason's text, and a probe (`x: object = DateTime.year` in a function body is SPY0908 CS0120) — proved by `Exclusions_RestingOnTheCompiler_GoRedWhenItChanges` and the orphan check in `Axes_…`. +- `ExcludedAliasUses[(Itself, Used)]` ← #2769 — fix: a probe that runs the compiler in a child process and expects exit 134, or the pair generated in the commit that fixes #2769 — proved by that probe going red when the overflow stops. +- D10's module-level judgement ← the pipeline order — fix: judge the target once every type and import is declared — proved by the `dotted` and `Later` must-run cells (owner, ruling 9). + +### Warnings +- Finding 4: the project route's control for D8. +- T3 names "the `TypeChecker*.cs` files holding the 33 sites": 33 re-measured, in nine files. The census pin is the catcher. +- The plan no longer names the gate's local fallback or the control run at the base for a red (CLAUDE.md carries both), and states no verify cost or prober budget (Dimension 9's filing budget). +- A1's, A4's, A5's and A6's "which decision drains which rule" is the author's reading, not run. +- `x: object = DateTime.year` (CS0120 behind SPY0908 at every position) is outside this plan's contract: the pass report's ledger. + +### Missing Steps Added +- None added to the body (the cap). For the revision: D8's sentence on where an attribute argument's names bind; the constant-kind spelling axis and the module-member roster in a stage-0 commit; the project-route control for D8 in A9 or the Testing Strategy; the two probes. + +### Unchecked Claims +- D2's pre-pass and first-read check drain the typed-read rows that cite #2423: a design with no prototype. That D2 also types the #2417 cells: not run; the ratchet's STALE arm reports it. +- D5's "one resolver carries all 33 sites": the count is measured, the rest untraced. +- D1's cold and warm export identity and the bridge arm's deletion: not run. +- D8 as rewritten drains the 216 #2432 rows: read against the rule table (each kind's row matches D8's true and false lists), not prototyped. That `TypeChecker.Definitions.cs` is where the attribute-argument check lands and `ClrTypeHelper` the home of the literal fact: the author's inference. +- A missing member at an attribute argument is CS0117 behind SPY0908 today (`default_value(H.nosuch)`, measured); that the checker's SPY0203 replaces it rests on D8's check. +- "No snapshot moves" (A12): the regeneration after T1 and T4 proves or refutes it. +- A11's 22 declarations in five spec files, and that each becomes SPY0620: pass 1's count, not re-taken. The 4,565 `.spy` files: re-counted, 4,565. +- Which interpreter the sweep's python arm picked: not read from the run; the cells agreed 30/30, and `.venv/bin/python3` is 3.15.2. +- "A module initializer under a later same-named declaration (`2`, python `7`)": the pair follows the pool's convention (the module's later declaration against the builtin). One program of that shape was run (`x: int = len([1, 2])` above `def len`: Sharpy reads the module's, python the builtin's), not the pool's own cell. +- Not run: a control at the base sha (product code at this tip is the base's); `check_spec_blocks.sh` (no spec or product path moved since the pass that ran it; CI at this tip is green); the whole `build_tools/tests` suite (two tests of `test_check_review_line.py` fail in this shallow clone, as before); the hand controls' own mutations; a local whole-solution gate (CI at this tip is green). From 0fe74e4c1fe379b3e924722e5419f67159fad931 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 19:13:49 +0000 Subject: [PATCH 15/22] test(conformance): P78 stage 0: spellings, module roster, probes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stage 0 of plan-777361 (P78; contract §11) after /verify-plan pass 3 (NEEDS REVISION @ 56dbb009f). Test code and its data only; product code is e24aaf9f0's. The owner's word (#2423 comment 7046304965, 2026-11-20): - item 12, "Add the spelling axis (Recommended)". Decides: spelling and placement are an axis of ScopeMeaningDifferentialTests' constant-kind set, derived as the typed-read set derives them; D8 names the scope in which an attribute argument is checked; allowlist_rows_outside_seed may be raised by that commit's measured red count. - item 13, "Fold all three (Recommended)". Decides: all three ride the revision; finding 2's red cells are part of the baseline raise of item 12's commit. What the constant-kind set gains - Spelling and placement of the program's own names (finding 1): OwnSpellings(kind) is the projection (Spelling, inside-or-outside the member's type) of TypedReaders, which is itself read from the 8951 pool. Every host names the same slot in the member's own type (Inside) or says why it has none. A bare sibling is generated at both orders, with and without a module binding of the name (D3's axes); `self.` where the slot sits in a method. Per kind, spelling, placement and host: a cell, or a reason, never both. - Spelling of a referenced member: ImportSpellings is asserted total over ImportBindingForm, ImportKind and ImportBinding.IsStar; a type is also read through an alias and by its builtin name; the program's enum through its name and an alias. Every member under every spelling at every host: a cell, or the host's reason. - A referenced module's roster (finding 2): the shapes are keyed by the collection of discovery's ModuleOverloads that holds the member (Fields refined by IsConst x IsGuarded, Functions by overload count, Types excluded with a probe), total over the type's properties. Two kinds: ModuleFunction (math.sqrt), ModuleFunctionGroup (math.log). - The resolver's two answers that describe no member, refined by what reflection finds under the name (finding 3a). The stated reason was false, and so was the exclusion for one producer: a static method the resolver declines for its signature (Char.is_ascii_digit) runs in a function body and a `const` and is CS1736 at a default, CS0182 at an attribute. It is generated (ClrTypeDeclinedMethod, 78 cells). The instance half (DateTime.year) and a generic method (Array.resize, which the resolver answers Absent for) keep an exclusion, each with its probe and a tie from the probe's member to the shape; a static value of an unmappable type is held at 0 by a census of `System`, which has its own control. - A probe for an exclusion that rests on the compiler DYING (finding 3b): the compiler runs in a child process (a driver compiled by Roslyn, `dotnet exec`), with a control program the same child compiles. (Itself, Used) of #2769 rests on it. - Exclusions found while generating, each probed: an interface's `@static` field, property and method inside the interface (#2383, #2111); an int enum's `.value` / `.name` through an alias of the enum (CS1061 in a function body); a dotted type in a lambda parameter's annotation (SPY0103 with no default). - Cites by class (ProposedCite): a constant position's cell is #2432's, except N2's refusal and a bare sibling red BELOW its member alone (#2423), and a member through `self` that dies of CS0176 (#2147). Counts (measured on this tree; python = CPython 3.15.2) - pool 3070 -> 4682 cells (2139 must-run, 2543 must-refuse); python agreed 30/30; constant-kind 770 -> 2382 cells. - known-red rows 829 -> 1383: #2423 463 -> 555, #2432 216 -> 661, #2417 150, #2147 0 -> 17. All 829 earlier rows are carried: every earlier cell's program is still generated with the same tag, rule and verdict, and its row keeps its class and cite (compared by source). - rule table 207 -> 222 rows, 52 rules; probes 15 -> 26, and 1 in a child process. - allowlist_rows_outside_seed 1401 -> 1955 (+554, the measured red count; the owner's item 12 and 13 above), by `scorecard_metrics.py --set-baseline allowlist_rows_outside_seed`; `--check`: OK (seed 2368 unchanged). - ScopeMeaningDifferentialTests, NameResolutionDifferentialTests (8951, its budget unchanged), ClassBodyReadPositionMatrixTests, StaticInitializerOrderMatrixTests, ConstantPositionValidator*, CiFilterCoverageConformanceTests: 346/0/0, 11.8 min. Mutations, each ALONE: the file copied aside, mutated, built, the seven facts that run no cell (and the pool's RuleTable fact) run, the file restored by copy, confirmed by cmp, touched. Green before and after (8/8). Red as named: 1 own reads not generated under Alias -> Axes_: "own spelling: Alias is neither generated nor excluded" and 164 per-host lines 2 one member loses one spelling (math.pi, from-import; pass 3's control that stayed green) -> Axes_: "no cell reads StdlibModuleVariable math.pi under from-import" 3 the import-as spelling deleted -> "import form: ModuleAlias is neither generated nor excluded" 4 from-import-as deleted -> "import kind: FromImportWithAlias ..." 5 star-import deleted -> "star import: True ..." 6 the Functions/one shape deleted -> "module member: Functions/one is neither generated nor excluded" (7 lines) 7 a ModuleOverloads property's exclusion deleted -> "module member collection: LoadEntry is neither generated nor excluded" 8 a host's in-type slot removed -> "dataclass has no slot in the member's own type and no reason" 9 siblings generated at the earlier order only -> Axes_ ("order: Later ...", "sibling: ... no cell at Later"), both RuleTable_ facts (row L248 has no cell) and Ratchet_ (4 failed) 10 siblings generated without a module binding -> the same four, "no cell at Earlier under a module binding of the name" 11 a placement's exclusion deleted -> "own placement: Sibling ..." 12 a spelling's exclusion deleted -> "own spelling: Call ..." 13 the enum's alias spelling deleted -> "enum spelling: Alias ..." 14 the 11 new in-process probes each handed a program that compiles -> Exclusions_RestingOnTheCompiler_: 11 lines, one per reason 15 the crash probe handed a program that compiles -> Exclusions_RestingOnACompilerCrash_: "rests on a stack overflow ... now gives exit 0" 16 its control handed a program that does not compile -> the same fact: "the child process does not compile the control" 17 the (Itself, Used) exclusion deleted -> Axes_: "(Itself, Used) is neither generated nor excluded", and its probe is an orphan 18 a rule-table row deleted (N2 at a constant position) -> RuleTable_EveryCaseHasOneRow_: "matches no row" for its cells (and Ratchet_, whose N2 fixture is gone) 19 a passing cell listed known-red (.../def/OwnMember/ ClassLiteralConst/Annotated/Alias Ice # #2432 ice) -> ScopeMeaning_Sweep: "listed as Ice, now Match: STALE" (1 failure) 20 the N2 cite rule removed -> first GREEN (the sibling rule gave the same cite); the fact now holds N2 with its twin above red too -> Ratchet_ red 21 the CS0176 cite rule removed -> Ratchet_ red 22 the sibling-below cite rule removed -> Ratchet_ red 23 the instance-half probe's member swapped (DateTime.max_value) -> Axes_: "the checker's resolver answers Field/static for it" 24 the census pointed at a namespace with no type -> Axes_: "sees no static value of shape Field/literal ..." (4 lines) 25 interface statics generated inside the interface -> Axes_: "is generated and excluded" (9 lines) 26 an int enum's .value / .name generated through the alias -> Axes_: "IntEnumValue under Alias is generated and excluded" (2 lines) 27 the declined-method shape left unmapped -> Axes_: "InconclusiveResult/static-method is neither generated nor excluded" 28 one host loses one spelling (struct, import-as) -> Axes_: "... under import-as at struct is neither generated nor excluded" (14) 29 the lambda's dotted-type skip removed -> Axes_: its probe guards a reason no exclusion gives 30 the child's verdict made "compiled" always -> CompileInChildProcess_ and the crash fact red 31 the generic-method probe's member swapped (Array.max_length) -> Axes_: "the checker's resolver answers Property for it" 20 to 22 were re-run on the fact as committed. One reason string (the tracker of an interface's static METHOD, #2111) was corrected after the batch; the full run above is on the committed text. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01LGMKZVcFYGqQRfHgd16DLa --- build_tools/scorecard-baseline.json | 2 +- .../ScopeMeaningDifferentialTests.Axes.cs | 746 ++++++++++--- .../ScopeMeaningDifferentialTests.Readers.cs | 104 ++ .../ScopeMeaningDifferentialTests.cs | 133 ++- .../Conformance/name-resolution-rules.txt | 39 +- .../scope-meaning-differential-allowlist.txt | 980 ++++++++++++++---- 6 files changed, 1638 insertions(+), 366 deletions(-) diff --git a/build_tools/scorecard-baseline.json b/build_tools/scorecard-baseline.json index f6d197a48..81b6b9c93 100644 --- a/build_tools/scorecard-baseline.json +++ b/build_tools/scorecard-baseline.json @@ -1,6 +1,6 @@ { "procedure_bytes": 145560, "claude_md_bytes": 9304, - "allowlist_rows_outside_seed": 1401, + "allowlist_rows_outside_seed": 1955, "allowlist_rows_seed": 2368 } diff --git a/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Axes.cs b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Axes.cs index d2db958b2..77ef71a79 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Axes.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Axes.cs @@ -3,6 +3,7 @@ using Sharpy.Compiler.Discovery.Caching; using Sharpy.Compiler.Semantic; using Sharpy.Compiler.Semantic.Validation; +using Sharpy.Compiler.Shared; using Xunit; using AstFunctionType = Sharpy.Compiler.Parser.Ast.FunctionType; using AstTypeAlias = Sharpy.Compiler.Parser.Ast.TypeAlias; @@ -76,6 +77,28 @@ private static bool Refused(Harness.SharpyRun run, string code, string? cs = nul [NoSuchMember] = new("def f(p: int = int.nosuch) -> int:\n return p\n" + TailMain, "SPY0203", r => Refused(r, "SPY0203")), [ACallByShape] = new("def five() -> int:\n return 5\ndef f(p: int = five()) -> int:\n return p\n" + TailMain, "SPY0401", r => Refused(r, "SPY0401")), [ALocalInAConstantPosition] = new("def main() -> None:\n y: int = 5\n f = lambda p: int = y: p\n print(f())\n", "SPY0401", r => Refused(r, "SPY0401")), + [NamesAModuleType] = new("import pathlib\ndef f(p: int = pathlib.Path) -> int:\n return p\n" + TailMain, "SPY0220", r => Refused(r, "SPY0220"), Stdlib: true), + [AnInstanceMemberThroughItsType] = new("from system import DateTime\ndef main() -> None:\n x: object = DateTime.year\n print(1)\n", "SPY0908 CS0120", r => Refused(r, "SPY0908", "CS0120")), + [ASiblingCaseIsNoName] = new("enum H:\n RED = 5\n BLUE = RED\ndef main() -> None:\n print(H.BLUE.value)\n", "SPY0200", r => Refused(r, "SPY0200")), + [NoSelfAtATypeBody] = new("class H:\n const x: int = 5\n const K: int = self.x\ndef main() -> None:\n print(H.K)\n", "SPY0200", r => Refused(r, "SPY0200")), + [AGenericMethodThroughItsType] = new("from system import Array\ndef main() -> None:\n x: object = Array.resize\n print(1)\n", "SPY0908 CS8917", r => Refused(r, "SPY0908", "CS8917")), + [LambdaTakesOneNameForAType] = new("import system\ndef main() -> None:\n f = lambda p: system.DayOfWeek: p\n print(1)\n", "SPY0103", r => Refused(r, "SPY0103")), + [AliasedIntEnumRead(EnumMemberAccessKind.IntValue)] = new(IntEnum + "\ntype A = E0\ndef main() -> None:\n print(A.RED.value)\n", "SPY0908 CS1061", r => Refused(r, "SPY0908", "CS1061")), + [AliasedIntEnumRead(EnumMemberAccessKind.IntName)] = new(IntEnum + "\ntype A = E0\ndef main() -> None:\n print(A.RED.name)\n", "SPY0908 CS1061", r => Refused(r, "SPY0908", "CS1061")), + [InterfaceStaticIsRefused("field")] = new("interface H:\n @static\n x: int = 5\n def m(self) -> int: ...\ndef main() -> None:\n print(H.x)\n", "SPY0908 CS0120", r => Refused(r, "SPY0908", "CS0120")), + [InterfaceStaticIsRefused("property")] = new("interface H:\n @static\n property x: int = 5\n def m(self) -> int: ...\ndef main() -> None:\n print(H.x)\n", "SPY0908 CS0120", r => Refused(r, "SPY0908", "CS0120")), + [InterfaceStaticIsRefused("method, read uncalled", "#2111")] = new("interface H:\n @static\n def x() -> int:\n return 5\n def m(self) -> int: ...\ndef main() -> None:\n f: () -> int = H.x\n print(f())\n", "SPY0908 CS0120", r => Refused(r, "SPY0908", "CS0120")), + }; + + /// What the compiler does with a program when it runs in a process of its own: the behaviour is a crash, which a + /// probe in this process would not survive. is a program the same child compiles, so a child + /// that dies for a reason of its own (a missing assembly ends a process with the same exit code) is not read as the crash. + internal sealed record CrashProbe(string Source, string Control, string Expected, Func Holds); + + internal static readonly IReadOnlyDictionary CrashProbes = new Dictionary(StringComparer.Ordinal) + { + [OverflowsTheCompiler] = new("type K0 = list[K0]\ndef f(k: K0) -> int:\n return 1\n" + TailMain, "type K0 = list[K0]\n" + TailMain, + "a stack overflow that ends the process", c => c.Overflowed), }; // ------------------------------------------------------------------------------------------- // @@ -324,7 +347,7 @@ internal sealed record TypedReader(BindingKind Kind, Harness.Spelling Spelling, private const string AReadOfItself = "a declaration that reads itself, directly or through a ring, is N3-cycle's: refused or thrown whatever its slot's type (the 8951 pool's Self and Cycle cells)"; private const string ARecursion = "a constructor that calls itself is a recursion, not an order of two declarations"; - private const string OverflowsTheCompiler = "#2769: named by an annotation, an alias whose target reaches the alias overflows the compiler's stack (`TypeResolver.ExpandTypeAlias`), and a process that dies leaves no verdict a cell can read (so no probe either: it would take the test host with it). The class is unruled and out of P78 (owner, #2423 comment 7042723494 item 9), so only the UNUSED alias has cells, and they keep running"; + private const string OverflowsTheCompiler = "#2769: named by an annotation, an alias whose target reaches the alias overflows the compiler's stack (`TypeResolver.ExpandTypeAlias`), and a process that dies leaves no verdict a cell can read (its probe compiles in a child process). The class is unruled and out of P78 (owner, #2423 comment 7042723494 item 9), so only the UNUSED alias has cells, and they keep running"; /// The orders with no cell, per cell set that has the axis: total over Order with the two every set generates. internal static readonly IReadOnlyDictionary> ExcludedOrders = new Dictionary>(StringComparer.Ordinal) @@ -332,6 +355,7 @@ internal sealed record TypedReader(BindingKind Kind, Harness.Spelling Spelling, ["typed-read"] = new Dictionary { [Harness.Order.Self] = AReadOfItself, [Harness.Order.Cycle] = AReadOfItself }, ["init-overload"] = new Dictionary { [Harness.Order.Self] = ARecursion, [Harness.Order.Cycle] = ARecursion }, ["alias-target"] = new Dictionary(), + ["constant-kind"] = new Dictionary { [Harness.Order.Self] = AReadOfItself, [Harness.Order.Cycle] = AReadOfItself }, }; /// The target × use pairs with no cell, total over the two enums with the pairs a cell carries. @@ -431,15 +455,25 @@ internal sealed record OuterBinding(string Name, string Text, OuterScope Scope, /// A host of a constant position: its label, the program around {e} typed {T} (with {s} where /// main shows the slot's value, read into the local v), the code its refusal carries, the 8951 pool's position /// where it has one, the imports the program itself needs, whether the program prints 1 and not the value, whether - /// it takes an int only, whether its slot can be given a function type, and whether python has the same position. + /// it takes an int only, whether its slot can be given a function type, and whether python has the same position. + /// is the same slot in the read member's OWN type H: the member's declaration stands at + /// {above} or {below}, and {after} holds what follows the type. : that slot sits + /// in a method's body, where self is bound and a class member is not visible bare (N1). A host with no such slot + /// says why in . : the member's own type is an interface there + /// (). internal sealed record ConstantHost(string Label, string Program, string Refusal, ReadPosition? Position = null, string? Imports = null, bool PrintsOne = false, - bool IntOnly = false, bool NoCallableSlot = false, bool Twin = false); + bool IntOnly = false, bool NoCallableSlot = false, bool Twin = false, string? Inside = null, bool InMethod = false, string? NoInside = null, bool Interface = false); /// main for a host whose slot is read by , after . private static string ShowIn(string read, string before = "") => $"{Main}{before} v: {{T}} = {read}\n print({{s}})"; private const string AttributeTarget = " def f(self) -> int:\n return 1\n" + Main + " print(H().f())"; + /// The attribute hosts' program with the member's own slots: {above} and {below} around the attributed method. + private const string AttributeTargetInside = " def f(self) -> int:\n return 1\n{below}{after}" + Main + " print(H().f())"; + + private const string AModuleConstIsOutsideEveryType = "a `const` at module level stands outside every type by definition: in the member's own type the same declaration is the class-const, struct-const or interface-const host"; + private const string DelegateHasNoBody = "a `delegate` declaration is a signature on one line (`delegate D(x: int) -> int`, `DelegateDef`): it has no body to hold a member, a `const` or an alias (SPY0100)"; private const string EnumBodyHoldsNoConst = "an enum body holds `NAME = value` cases and nothing else: a `const` there is SPY0101"; private const string UnionBodyHoldsNoConst = "a union body holds cases and methods and nothing else: a `const` there is SPY0104"; @@ -451,10 +485,18 @@ internal sealed record ConstantHost(string Label, string Program, string Refusal /// declaration can stand in. A type body is refined by . internal static readonly IReadOnlyDictionary ConstSites = new Dictionary { - [ScopeKind.Module] = new[] { new ConstantHost("module-const", "const K: {T} = {e}\n" + ShowIn("K"), "SPY0401") }, + [ScopeKind.Module] = new[] { new ConstantHost("module-const", "const K: {T} = {e}\n" + ShowIn("K"), "SPY0401", NoInside: AModuleConstIsOutsideEveryType) }, [ScopeKind.TypeBody] = Array.Empty(), - [ScopeKind.FunctionLike] = new[] { new ConstantHost("local-const", ShowIn("K", " const K: {T} = {e}\n"), "SPY0401") }, - [ScopeKind.Block] = new[] { new ConstantHost("block-const", $"{Main} if True:\n const K: {{T}} = {{e}}\n v: {{T}} = K\n print({{s}})", "SPY0401") }, + [ScopeKind.FunctionLike] = new[] + { + new ConstantHost("local-const", ShowIn("K", " const K: {T} = {e}\n"), "SPY0401", + Inside: "class H:\n{above} def r(self) -> {T}:\n const K: {T} = {e}\n return K\n{below}{after}" + ShowIn("H().r()"), InMethod: true), + }, + [ScopeKind.Block] = new[] + { + new ConstantHost("block-const", $"{Main} if True:\n const K: {{T}} = {{e}}\n v: {{T}} = K\n print({{s}})", "SPY0401", + Inside: "class H:\n{above} def r(self) -> None:\n if True:\n const K: {T} = {e}\n v: {T} = K\n print({s})\n{below}{after}" + Main + " H().r()", InMethod: true), + }, }; internal static readonly IReadOnlyDictionary ExcludedConstScopes = new Dictionary @@ -466,9 +508,21 @@ internal sealed record ConstantHost(string Label, string Program, string Refusal /// The type bodies a const is declared in, total over TypeKind with . internal static readonly IReadOnlyDictionary ConstTypeHosts = new Dictionary { - [TypeKind.Class] = new[] { new ConstantHost("class-const", "class H:\n const K: {T} = {e}\n" + ShowIn("H.K"), "SPY0401", ReadPosition.ConstInitializer) }, - [TypeKind.Struct] = new[] { new ConstantHost("struct-const", "struct H:\n const K: {T} = {e}\n w: int = 1\n" + ShowIn("H.K"), "SPY0401") }, - [TypeKind.Interface] = new[] { new ConstantHost("interface-const", "interface H:\n const K: {T} = {e}\n def m(self) -> int: ...\n" + ShowIn("H.K"), "SPY0401") }, + [TypeKind.Class] = new[] + { + new ConstantHost("class-const", "class H:\n const K: {T} = {e}\n" + ShowIn("H.K"), "SPY0401", ReadPosition.ConstInitializer, + Inside: "class H:\n{above} const K: {T} = {e}\n{below}{after}" + ShowIn("H.K")), + }, + [TypeKind.Struct] = new[] + { + new ConstantHost("struct-const", "struct H:\n const K: {T} = {e}\n w: int = 1\n" + ShowIn("H.K"), "SPY0401", + Inside: "struct H:\n{above} const K: {T} = {e}\n w: int = 1\n{below}{after}" + ShowIn("H.K")), + }, + [TypeKind.Interface] = new[] + { + new ConstantHost("interface-const", "interface H:\n const K: {T} = {e}\n def m(self) -> int: ...\n" + ShowIn("H.K"), "SPY0401", + Inside: "interface H:\n{above} const K: {T} = {e}\n def m(self) -> int: ...\n{below}{after}" + ShowIn("H.K"), Interface: true), + }, }; internal static readonly IReadOnlyDictionary ExcludedConstTypeHosts = new Dictionary @@ -495,36 +549,43 @@ internal static IEnumerable AllConstSites() { ["ConstantPositionValidator.cs:ValidateFunctionDefaults"] = new[] { - new ConstantHost("def", "def f(p: {T} = {e}) -> {T}:\n return p\n" + ShowIn("f()"), "SPY0401", ReadPosition.ParameterDefault, Twin: true), + new ConstantHost("def", "def f(p: {T} = {e}) -> {T}:\n return p\n" + ShowIn("f()"), "SPY0401", ReadPosition.ParameterDefault, Twin: true, + Inside: "class H:\n{above} def f(self, p: {T} = {e}) -> {T}:\n return p\n{below}{after}" + ShowIn("H().f()")), }, ["ConstantPositionValidator.cs:ValidateLambdaDefaults"] = new[] { - new ConstantHost("lambda", ShowIn("f()", " f = lambda p: {T} = {e}: p\n"), "SPY0401", NoCallableSlot: true), + new ConstantHost("lambda", ShowIn("f()", " f = lambda p: {T} = {e}: p\n"), "SPY0401", NoCallableSlot: true, + Inside: "class H:\n{above} def r(self) -> {T}:\n f = lambda p: {T} = {e}: p\n return f()\n{below}{after}" + ShowIn("H().r()"), InMethod: true), }, // The two loops of one method: an attribute's positional arguments, then its named ones. ["ConstantPositionValidator.cs:ValidateDecoratorConstantArguments"] = new[] { - new ConstantHost("attribute", "class H:\n @[system.component_model.default_value({e})]\n" + AttributeTarget, "SPY0425", PrintsOne: true), + new ConstantHost("attribute", "class H:\n @[system.component_model.default_value({e})]\n" + AttributeTarget, "SPY0425", PrintsOne: true, + Inside: "class H:\n{above} @[system.component_model.default_value({e})]\n" + AttributeTargetInside), }, ["ConstantPositionValidator.cs:ValidateDecoratorConstantArguments#2"] = new[] { new ConstantHost("attribute-keyword", "class Mark(Attribute):\n w: object = 0\nclass H:\n @[Mark(w={e})]\n" + AttributeTarget, "SPY0425", - Imports: "from system import Attribute", PrintsOne: true), + Imports: "from system import Attribute", PrintsOne: true, + Inside: "class Mark(Attribute):\n w: object = 0\nclass H:\n{above} @[Mark(w={e})]\n" + AttributeTargetInside), }, ["ConstantPositionValidator.cs:ValidateDataclassFieldDefaults"] = new[] { - new ConstantHost("dataclass", "@dataclass\nclass H:\n p: {T} = {e}\n" + ShowIn("H().p"), "SPY0401", ReadPosition.DataclassFieldInitializer, Twin: true), + new ConstantHost("dataclass", "@dataclass\nclass H:\n p: {T} = {e}\n" + ShowIn("H().p"), "SPY0401", ReadPosition.DataclassFieldInitializer, Twin: true, + Inside: "@dataclass\nclass H:\n{above} p: {T} = {e}\n{below}{after}" + ShowIn("H().p")), }, ["ConstantPositionValidator.cs:ValidateStructFieldDefaults"] = new[] { - new ConstantHost("struct", "struct H:\n p: {T} = {e}\n" + ShowIn("H().p"), "SPY0401", ReadPosition.StructFieldInitializer, Twin: true), + new ConstantHost("struct", "struct H:\n p: {T} = {e}\n" + ShowIn("H().p"), "SPY0401", ReadPosition.StructFieldInitializer, Twin: true, + Inside: "struct H:\n{above} p: {T} = {e}\n{below}{after}" + ShowIn("H().p")), }, ["ConstEligibility.cs:Compute"] = AllConstSites().ToArray(), // A struct's defaulted auto-property (#1938): a constant default becomes the synthesized constructor's parameter default, // and any other default keeps its initializer, so every expression must run here (ruling 8). ["CodeGenInfoComputer.cs:MarkStructConstructorProperty"] = new[] { - new ConstantHost("struct-auto-property", "struct H:\n property p: {T} = {e}\n" + ShowIn("H().p"), "SPY0401"), + new ConstantHost("struct-auto-property", "struct H:\n property p: {T} = {e}\n" + ShowIn("H().p"), "SPY0401", + Inside: "struct H:\n{above} property p: {T} = {e}\n{below}{after}" + ShowIn("H().p")), }, }; @@ -537,7 +598,8 @@ internal static IEnumerable AllConstSites() /// The one constant position no classifier call judges: an enum member's value. A table value added for it has no /// reader here, which is red until this host moves under it. - internal static readonly ConstantHost EnumMemberHost = new("enum-member", $"enum H:\n RED = {{e}}\n{Main} print(H.RED.value)", "SPY0401", ReadPosition.EnumMemberValue, IntOnly: true); + internal static readonly ConstantHost EnumMemberHost = new("enum-member", $"enum H:\n RED = {{e}}\n{Main} print(H.RED.value)", "SPY0401", ReadPosition.EnumMemberValue, IntOnly: true, + NoInside: EnumBodyHoldsCases); /// Every host with the table its reader passes; the enum member's value last, with none. internal static IEnumerable<(AdmissionTable? Table, ConstantHost Host)> AllConstantHosts() @@ -550,99 +612,262 @@ internal static IEnumerable AllConstSites() } private const string LambdaTakesNoCallableSlot = "a lambda parameter's annotation cannot be a function type and take a default: `lambda p: () -> int = five: p` is SPY0103"; + private const string LambdaTakesOneNameForAType = "a lambda parameter's annotation is one name: a type spelled through its module (`lambda p: system.DayOfWeek: p`) is SPY0103 with no default at all, so the slot cannot be declared there and the parse error is no constant position's verdict; the same type under a from-import is generated"; private const string AnIntEnum = "the host is an int enum, whose member's value is an int: a `str` value declares a string enum, another host, and any other type is SPY0253"; /// Why a host has no cell for a slot of , or null when it has one. internal static string? HostSkips(ConstantHost host, string type) => host.IntOnly && type != "int" ? AnIntEnum : host.NoCallableSlot && type.Contains("->", StringComparison.Ordinal) ? LambdaTakesNoCallableSlot + : host.NoCallableSlot && type.Contains('.', StringComparison.Ordinal) ? LambdaTakesOneNameForAType : null; /// The expression: its label, text, type and what it prints; the import line and the declarations it needs; how /// main shows a value of its type ({0} the read); the codes its own kind's refusal carries beside the host's; - /// the binding kind a bare name of it has; the value of a referenced module it names (module.name, what - /// is keyed by) or the member of a referenced type; and its read form where it has one. + /// the binding kind a bare name of it has; the member of a referenced module it names (module.name, what + /// is keyed by) or the member of a referenced type; its read form where it has one; and + /// the spelling it is read under (, , , + /// ), which is a part of its cell's id. internal sealed record ConstantExpression(string Label, string Text, string Type, string Prints, string? Import = null, string? Prelude = null, string Show = "{0}", - string[]? Refusals = null, BindingKind Target = BindingKind.None, string? ModuleValue = null, Type? Owner = null, string? Member = null, Harness.Form? Form = null) + string[]? Refusals = null, BindingKind Target = BindingKind.None, string? ModuleValue = null, Type? Owner = null, string? Member = null, Harness.Form? Form = null, + string? Spelling = null) { public bool Stdlib => ModuleValue != null; } - private static ConstantExpression ModuleValue(string module, string name, string type, string prints) - => new($"{module}.{name}", $"{module}.{name}", type, prints, Import: $"import {module}", ModuleValue: $"{module}.{name}"); + /// + /// How a program names what it imports: the image of the two enumerations the compiler keeps for it. + /// ImportBindingForm is the statement that bound the name (import m, import m as N, a from-import, whose + /// record also says whether it was a star: ImportBinding.IsStar), and ImportKind how the imported symbol is + /// then read (through its module, by its own name, by an alias). {m} is the module, {n} the name; + /// is the spelling of {n} a read uses. A spelling changes no verdict (N7), and a missing one has no cell + /// (). + /// + internal sealed record ImportSpelling(string Label, ImportBindingForm Form, ImportKind Kind, bool Star, string Import, string Read); - /// The same value named bare through from module import name: a spelling, which changes no verdict (N7). - private static ConstantExpression ImportedValue(string module, string name, string type, string prints) - => new($"from-{module}-import-{name}", name, type, prints, Import: $"from {module} import {name}", Target: BindingKind.ImportedName, ModuleValue: $"{module}.{name}"); + internal static readonly IReadOnlyList ImportSpellings = new[] + { + new ImportSpelling("import", ImportBindingForm.ModuleRoot, ImportKind.ModuleImport, false, "import {m}", "{m}.{n}"), + new ImportSpelling("import-as", ImportBindingForm.ModuleAlias, ImportKind.ModuleImport, false, "import {m} as m0", "m0.{n}"), + new ImportSpelling("from-import", ImportBindingForm.FromImport, ImportKind.FromImport, false, "from {m} import {n}", "{n}"), + new ImportSpelling("from-import-as", ImportBindingForm.FromImport, ImportKind.FromImportWithAlias, false, "from {m} import {n} as n0", "n0"), + new ImportSpelling("star-import", ImportBindingForm.FromImport, ImportKind.FromImport, true, "from {m} import *", "{n}"), + }; - private static ConstantExpression TypeMember(string text, string type, string prints, Type owner, string member, string? import = null, string show = "{0}", string[]? refusals = null, Harness.Form? form = null) - => new(text, text, type, prints, Import: import, Show: show, Refusals: refusals, Owner: owner, Member: member, Form: form); + internal static readonly IReadOnlyDictionary ExcludedImportKinds = new Dictionary + { + [ImportKind.None] = "not imported: the program's own names, which have their own spellings (OwnSpellings)", + }; - private const string IntEnum = "enum E0:\n RED = 5"; - private const string StringEnum = "enum E0:\n RED = \"r\""; + /// A referenced type named through an alias the program declares (type A = Math): the 8951 pool's + /// Spelling.Alias, for a type no program declares. + internal const string TypeAliasSpelling = "type-alias"; + + /// A referenced type named by the builtin name it has (int for System.Int32). + internal const string BuiltinNameSpelling = "builtin-name"; + + private static string Spell(string template, string module, string name) + => template.Replace("{m}", module, StringComparison.Ordinal).Replace("{n}", name, StringComparison.Ordinal); - internal static readonly IReadOnlyDictionary ConstantExpressions = new Dictionary + /// A member of a referenced module, before a spelling: a value or a function, read uncalled. + internal sealed record ModuleMember(string Module, string Name, string Type, string Prints, string Show = "{0}", Harness.Form? Form = null); + + /// The members of referenced modules a constant position is handed, one or two per kind (a hand choice: each is + /// checked against what discovery records for it, ); every one is read under every + /// entry. + internal static readonly IReadOnlyDictionary ModuleMembers = new Dictionary + { + [ScopeConstantKind.ClrLiteralField] = new[] { new ModuleMember("subprocess", "PIPE", "int", "-1") }, + [ScopeConstantKind.StdlibModuleVariable] = new[] { new ModuleMember("socket", "AF_INET", "int", "2"), new ModuleMember("math", "pi", "float", "3.141592653589793") }, + [ScopeConstantKind.ClrStaticMember] = new[] { new ModuleMember("sys", "maxsize", "int", "2147483647") }, + [ScopeConstantKind.ModuleFunction] = new[] { new ModuleMember("math", "sqrt", "(float) -> float", "5.0", "{0}(25.0)", Harness.Form.Value) }, + [ScopeConstantKind.ModuleFunctionGroup] = new[] { new ModuleMember("math", "log", "(float) -> float", "0.0", "{0}(1.0)", Harness.Form.Value) }, + }; + + /// A member of a referenced type, before a spelling: the module that exports the type, the type's name there, its + /// builtin name where it has one, and the member. {R} in is the type as the spelling names it. + internal sealed record TypeMemberBase(string Module, string TypeName, Type Owner, string Member, string Type, string Prints, string Show = "{0}", + string[]? Refusals = null, Harness.Form? Form = null, string? BuiltinName = null); + + /// The members of referenced types a constant position is handed, one or two per kind (a hand choice: each is + /// checked against what the checker's resolver answers for it); every one is read under every + /// entry of its type, through an alias of the type, and by the type's builtin name where it has one. + internal static readonly IReadOnlyDictionary TypeMembers = new Dictionary { - [ScopeConstantKind.ClrLiteralField] = new[] { ModuleValue("subprocess", "PIPE", "int", "-1"), ImportedValue("subprocess", "PIPE", "int", "-1") }, - [ScopeConstantKind.StdlibModuleVariable] = new[] - { - ModuleValue("socket", "AF_INET", "int", "2"), - ModuleValue("math", "pi", "float", "3.141592653589793"), - ImportedValue("math", "pi", "float", "3.141592653589793"), - }, - [ScopeConstantKind.ClrStaticMember] = new[] { ModuleValue("sys", "maxsize", "int", "2147483647"), ImportedValue("sys", "maxsize", "int", "2147483647") }, - // A literal field through each receiver a type has: a builtin's own name, an imported name, a module-qualified name. [ScopeConstantKind.ClrTypeLiteralField] = new[] { - TypeMember("int.max_value", "int", "2147483647", typeof(int), "max_value"), - TypeMember("Int32.max_value", "int", "2147483647", typeof(int), "max_value", "from system import Int32"), - TypeMember("system.Int32.max_value", "int", "2147483647", typeof(int), "max_value", "import system"), - TypeMember("Math.PI", "float", "3.141592653589793", typeof(Math), "PI", "from system import Math"), + new TypeMemberBase("system", "Int32", typeof(int), "max_value", "int", "2147483647", BuiltinName: "int"), + new TypeMemberBase("system", "Math", typeof(Math), "PI", "float", "3.141592653589793"), }, - [ScopeConstantKind.ClrTypeEnumMember] = new[] { TypeMember("DayOfWeek.Monday", "DayOfWeek", "DayOfWeek.Monday", typeof(DayOfWeek), "Monday", "from system import DayOfWeek") }, - [ScopeConstantKind.ClrTypeStaticField] = new[] { TypeMember("BitConverter.is_little_endian", "bool", "True", typeof(BitConverter), "is_little_endian", "from system import BitConverter") }, - [ScopeConstantKind.ClrTypeStaticProperty] = new[] { TypeMember("Array.max_length", "int", "2147483591", typeof(Array), "max_length", "from system import Array") }, - [ScopeConstantKind.ClrTypeMethod] = new[] { TypeMember("Math.sqrt", "(float) -> float", "5.0", typeof(Math), "sqrt", "from system import Math", "{0}(25.0)", form: Harness.Form.Value) }, + [ScopeConstantKind.ClrTypeEnumMember] = new[] { new TypeMemberBase("system", "DayOfWeek", typeof(DayOfWeek), "Monday", "{R}", "DayOfWeek.Monday") }, + [ScopeConstantKind.ClrTypeStaticField] = new[] { new TypeMemberBase("system", "BitConverter", typeof(BitConverter), "is_little_endian", "bool", "True") }, + [ScopeConstantKind.ClrTypeStaticProperty] = new[] { new TypeMemberBase("system", "Array", typeof(Array), "max_length", "int", "2147483591") }, + [ScopeConstantKind.ClrTypeMethod] = new[] { new TypeMemberBase("system", "Math", typeof(Math), "sqrt", "(float) -> float", "5.0", "{0}(25.0)", Form: Harness.Form.Value) }, + [ScopeConstantKind.ClrTypeDeclinedMethod] = new[] { new TypeMemberBase("system", "Char", typeof(char), "is_ascii_digit", "object", "True", "{0} is not None", Form: Harness.Form.Value) }, [ScopeConstantKind.ClrTypeMethodGroup] = new[] { - TypeMember("Math.abs", "(int) -> int", "5", typeof(Math), "abs", "from system import Math", "{0}(-5)", new[] { "SPY0336" }, Harness.Form.Value), + new TypeMemberBase("system", "Math", typeof(Math), "abs", "(int) -> int", "5", "{0}(-5)", new[] { "SPY0336" }, Harness.Form.Value), }, - [ScopeConstantKind.IntEnumMember] = new[] { new ConstantExpression("member", "E0.RED", "E0", "5", Prelude: IntEnum, Show: "{0}.value", Target: BindingKind.ModuleEnum) }, - [ScopeConstantKind.IntEnumValue] = new[] { new ConstantExpression("value", "E0.RED.value", "int", "5", Prelude: IntEnum, Target: BindingKind.ModuleEnum, Form: Harness.Form.EnumValue) }, - [ScopeConstantKind.IntEnumName] = new[] { new ConstantExpression("name", "E0.RED.name", "str", "RED", Prelude: IntEnum, Target: BindingKind.ModuleEnum) }, - [ScopeConstantKind.StringEnumMember] = new[] { new ConstantExpression("member", "E0.RED", "E0", "r", Prelude: StringEnum, Show: "{0}.value", Target: BindingKind.ModuleEnum) }, - [ScopeConstantKind.StringEnumValue] = new[] { new ConstantExpression("value", "E0.RED.value", "str", "r", Prelude: StringEnum, Target: BindingKind.ModuleEnum, Form: Harness.Form.EnumValue) }, - [ScopeConstantKind.StringEnumName] = new[] { new ConstantExpression("name", "E0.RED.name", "str", "RED", Prelude: StringEnum, Target: BindingKind.ModuleEnum) }, - [ScopeConstantKind.ComparisonChain] = new[] { new ConstantExpression("ordered", "1 < 2 < 3", "bool", "True") }, - [ScopeConstantKind.ChainWithNonConstantLink] = new[] { new ConstantExpression("membership", "0 < 2 in [1, 2]", "bool", "True") }, }; - /// What discovery records for a value of a referenced module, and the kind that is its image: the two facts of - /// FieldSignature a constant position's answer can read. - internal static readonly IReadOnlyDictionary<(bool IsConst, bool IsGuarded), ScopeConstantKind> ModuleValueShapes = new Dictionary<(bool, bool), ScopeConstantKind> + /// The enum reads, total over EnumMemberAccessKind (which half of which enum shape a .name / .value + /// read takes) and the member itself per shape, which has no access kind. + internal static readonly IReadOnlyDictionary EnumReadKinds = new Dictionary + { + [ScopeConstantKind.IntEnumMember] = (true, null), + [ScopeConstantKind.IntEnumValue] = (true, EnumMemberAccessKind.IntValue), + [ScopeConstantKind.IntEnumName] = (true, EnumMemberAccessKind.IntName), + [ScopeConstantKind.StringEnumMember] = (false, null), + [ScopeConstantKind.StringEnumValue] = (false, EnumMemberAccessKind.StringValue), + [ScopeConstantKind.StringEnumName] = (false, EnumMemberAccessKind.StringName), + }; + + private const string IntEnum = "enum E0:\n RED = 5"; + private const string StringEnum = "enum E0:\n RED = \"r\""; + + /// The reads of the program's own enum, before a spelling: {E} is the enum as the spelling names it. + private static readonly IReadOnlyDictionary EnumReads = new Dictionary + { + [ScopeConstantKind.IntEnumMember] = new("member", "{E}.RED", "E0", "5", Prelude: IntEnum, Show: "{0}.value", Target: BindingKind.ModuleEnum), + [ScopeConstantKind.IntEnumValue] = new("value", "{E}.RED.value", "int", "5", Prelude: IntEnum, Target: BindingKind.ModuleEnum, Form: Harness.Form.EnumValue), + [ScopeConstantKind.IntEnumName] = new("name", "{E}.RED.name", "str", "RED", Prelude: IntEnum, Target: BindingKind.ModuleEnum), + [ScopeConstantKind.StringEnumMember] = new("member", "{E}.RED", "E0", "r", Prelude: StringEnum, Show: "{0}.value", Target: BindingKind.ModuleEnum), + [ScopeConstantKind.StringEnumValue] = new("value", "{E}.RED.value", "str", "r", Prelude: StringEnum, Target: BindingKind.ModuleEnum, Form: Harness.Form.EnumValue), + [ScopeConstantKind.StringEnumName] = new("name", "{E}.RED.name", "str", "RED", Prelude: StringEnum, Target: BindingKind.ModuleEnum), + }; + + /// How the program's own enum is named, total over the 8951 pool's Spelling with + /// : its label in a cell's id, the receiver, and the declaration the spelling needs. + internal static readonly IReadOnlyDictionary EnumSpellings = new Dictionary + { + [Harness.Spelling.Qualified] = ("type-name", "E0", null), + [Harness.Spelling.Alias] = (TypeAliasSpelling, "A", "type A = E0"), + }; + + private const string ASiblingCaseIsNoName = "bare, a case is in scope nowhere: outside its enum it is read through the enum, and inside (`BLUE = RED`) it is SPY0200 today, which is #2069's cell and outside plan-777361"; + + internal static readonly IReadOnlyDictionary ExcludedEnumSpellings = new Dictionary { - [(true, false)] = ScopeConstantKind.ClrLiteralField, - [(false, true)] = ScopeConstantKind.StdlibModuleVariable, - [(false, false)] = ScopeConstantKind.ClrStaticMember, + [Harness.Spelling.Bare] = ASiblingCaseIsNoName, + [Harness.Spelling.Call] = ACallByShape, + [Harness.Spelling.SelfDot] = EnumBodyHoldsCases, }; - /// The shapes no value of the Stdlib has: the census holds each at 0. - internal static readonly IReadOnlyDictionary<(bool IsConst, bool IsGuarded), string> UnproducedModuleValueShapes = new Dictionary<(bool, bool), string> + private static string AliasedIntEnumRead(EnumMemberAccessKind access) + => $"through an alias of its enum (`type A = E0`), an int enum member's {access} read is SPY0908 CS1061 in a function's body, with no constant position in sight (the member is taken for an instance's field, SPY0459): a cell would hold that defect and no constant position's verdict. The member itself (`A.RED`) and a string enum's reads run there and are generated"; + + /// Why a read of the program's enum has no cell under a spelling the enum has, or null when it has one. + internal static string? EnumReadSkips(Harness.Spelling spelling, ScopeConstantKind kind) + => spelling == Harness.Spelling.Alias && EnumReadKinds[kind] is (true, { } access) ? AliasedIntEnumRead(access) : null; + + /// + /// What a constant position is handed, per kind: every member of and + /// under every spelling it has, every enum read under every spelling of the enum, and the two chains. GENERATED from those + /// lists, so a spelling is on every member or on none. + /// + internal static readonly IReadOnlyDictionary ConstantExpressions = BuildConstantExpressions(); + + private static IReadOnlyDictionary BuildConstantExpressions() + { + var all = new Dictionary(); + foreach (var (kind, members) in ModuleMembers) + { + all[kind] = members.SelectMany(m => ImportSpellings.Select(s => new ConstantExpression($"{m.Module}.{m.Name}", Spell(s.Read, m.Module, m.Name), m.Type, m.Prints, + Import: Spell(s.Import, m.Module, m.Name), Show: m.Show, Target: s.Form == ImportBindingForm.FromImport ? BindingKind.ImportedName : BindingKind.None, + ModuleValue: $"{m.Module}.{m.Name}", Form: m.Form, Spelling: s.Label))).ToArray(); + } + foreach (var (kind, members) in TypeMembers) + { + var expressions = new List(); + foreach (var m in members) + { + ConstantExpression Named(string spelling, string receiver, string? import, string? prelude = null) + => new($"{m.TypeName}.{m.Member}", $"{receiver}.{m.Member}", m.Type.Replace("{R}", receiver, StringComparison.Ordinal), m.Prints, Import: import, Prelude: prelude, + Show: m.Show, Refusals: m.Refusals, Owner: m.Owner, Member: m.Member, Form: m.Form, Spelling: spelling); + expressions.AddRange(ImportSpellings.Select(s => Named(s.Label, Spell(s.Read, m.Module, m.TypeName), Spell(s.Import, m.Module, m.TypeName)))); + expressions.Add(Named(TypeAliasSpelling, "A", $"from {m.Module} import {m.TypeName}", $"type A = {m.TypeName}")); + if (m.BuiltinName != null) + expressions.Add(Named(BuiltinNameSpelling, m.BuiltinName, null)); + } + all[kind] = expressions.ToArray(); + } + foreach (var (kind, read) in EnumReads) + { + all[kind] = EnumSpellings.OrderBy(s => s.Key).Where(s => EnumReadSkips(s.Key, kind) == null).Select(s => read with + { + Text = read.Text.Replace("{E}", s.Value.Receiver, StringComparison.Ordinal), + Prelude = s.Value.Declares == null ? read.Prelude : read.Prelude + "\n" + s.Value.Declares, + Spelling = s.Value.Label, + }).ToArray(); + } + all[ScopeConstantKind.ComparisonChain] = new[] { new ConstantExpression("ordered", "1 < 2 < 3", "bool", "True") }; + all[ScopeConstantKind.ChainWithNonConstantLink] = new[] { new ConstantExpression("membership", "0 < 2 in [1, 2]", "bool", "True") }; + return all; + } + + private const string LiteralValueShape = nameof(ModuleOverloads.Fields) + "/literal"; + private const string GuardedValueShape = nameof(ModuleOverloads.Fields) + "/guarded"; + private const string StaticValueShape = nameof(ModuleOverloads.Fields) + "/static"; + private const string GuardedLiteralShape = nameof(ModuleOverloads.Fields) + "/literal+guarded"; + private const string OneFunctionShape = nameof(ModuleOverloads.Functions) + "/one"; + private const string FunctionGroupShape = nameof(ModuleOverloads.Functions) + "/group"; + private const string ModuleTypeShape = nameof(ModuleOverloads.Types); + + /// + /// What discovery records for a member of a referenced module, and the kind that is its image (the owner's ruling 13 of + /// 2026-11-20, #2423 comment 7046304965): the collection of ModuleOverloads that holds the member, refined by the + /// facts a constant position's answer can read: a field's FieldSignature.IsConst × IsGuarded, and whether a + /// function's name has one overload or several. Total over the shapes a census of the Stdlib finds + /// () with ; the collections themselves are total + /// over the properties of ModuleOverloads with . + /// + internal static readonly IReadOnlyDictionary ModuleMemberShapes = new Dictionary(StringComparer.Ordinal) + { + [LiteralValueShape] = ScopeConstantKind.ClrLiteralField, + [GuardedValueShape] = ScopeConstantKind.StdlibModuleVariable, + [StaticValueShape] = ScopeConstantKind.ClrStaticMember, + [OneFunctionShape] = ScopeConstantKind.ModuleFunction, + [FunctionGroupShape] = ScopeConstantKind.ModuleFunctionGroup, + }; + + private const string NamesAModuleType = "names a type the module exports: handed to a slot of another type it is the checker's own mismatch (SPY0220), and a member read through it is a referenced type's member, which has its own kinds (ClrTypeMemberShapes)"; + + /// The shapes with no cell. are those the census must hold at 0. + internal static readonly IReadOnlyDictionary ExcludedModuleMemberShapes = new Dictionary(StringComparer.Ordinal) + { + [GuardedLiteralShape] = "a literal has no storage to guard", + [ModuleTypeShape] = NamesAModuleType, + }; + + internal static readonly IReadOnlySet UnproducedModuleMemberShapes = new HashSet(StringComparer.Ordinal) { GuardedLiteralShape }; + + private const string DescribesTheModule = "describes the module itself (its name, its documentation, where its C# lives, how it loads): it holds no member a program reads"; + + /// The properties of ModuleOverloads that hold no member kind, total with the three collections the shapes are keyed by. + internal static readonly IReadOnlyDictionary ExcludedModuleCollections = new Dictionary(StringComparer.Ordinal) { - [(true, true)] = "a literal has no storage to guard", + [nameof(ModuleOverloads.ModuleName)] = DescribesTheModule, + [nameof(ModuleOverloads.Documentation)] = DescribesTheModule, + [nameof(ModuleOverloads.CSharpNamespace)] = DescribesTheModule, + [nameof(ModuleOverloads.CSharpClassName)] = DescribesTheModule, + [nameof(ModuleOverloads.LoadEntry)] = DescribesTheModule, }; - /// Every value of every module of the Stdlib, as discovery records it. - private static readonly Lazy> StdlibModuleValues = new(() => + /// Every member of every module of the Stdlib, as discovery records it: module.name and its shape. + private static readonly Lazy> StdlibModuleMembers = new(() => { var index = new OverloadIndexBuilder().BuildFromAssembly(SharpyStdlibReference.Assembly); - var values = new Dictionary(StringComparer.Ordinal); + var members = new Dictionary(StringComparer.Ordinal); foreach (var (module, overloads) in index.Modules) { foreach (var (name, field) in overloads.Fields) - values[$"{module}.{name}"] = (field.IsConst, field.IsGuarded); + members[$"{module}.{name}"] = field.IsConst ? field.IsGuarded ? GuardedLiteralShape : LiteralValueShape : field.IsGuarded ? GuardedValueShape : StaticValueShape; + foreach (var (name, signatures) in overloads.Functions) + members.TryAdd($"{module}.{name}", signatures.Count == 1 ? OneFunctionShape : FunctionGroupShape); + foreach (var type in overloads.Types) + members.TryAdd($"{module}.{type.Name}", ModuleTypeShape); } - return values; + return members; }); private const string LiteralFieldShape = "Field/literal"; @@ -663,49 +888,81 @@ private static ConstantExpression TypeMember(string text, string type, string pr [nameof(ClrMemberResolution.Property)] = ScopeConstantKind.ClrTypeStaticProperty, [nameof(ClrMemberResolution.Method)] = ScopeConstantKind.ClrTypeMethod, [nameof(ClrMemberResolution.MethodGroup)] = ScopeConstantKind.ClrTypeMethodGroup, + [DeclinedMethodShape] = ScopeConstantKind.ClrTypeDeclinedMethod, + }; + + // The two answers that say nothing of the member, refined by what reflection finds under the name: the resolver's own + // reasons for giving them (`ClrMemberTypeResolver.ResolveCore`). + private const string DeclinedMethodShape = nameof(ClrMemberResolution.InconclusiveResult) + "/static-method"; + private const string DeclinedValueShape = nameof(ClrMemberResolution.InconclusiveResult) + "/static-value"; + private const string OppositeHalfShape = nameof(ClrMemberResolution.InconclusiveResult) + "/instance-half"; + private const string GenericMethodShape = nameof(ClrMemberResolution.AbsentResult) + "/generic-method"; + private const string NoMemberShape = nameof(ClrMemberResolution.AbsentResult) + "/none"; + + /// The refinements of the two answers, which partitions the resolver's subclasses with. + internal static readonly IReadOnlyDictionary RefinedClrTypeMemberShapes = new Dictionary(StringComparer.Ordinal) + { + [nameof(ClrMemberResolution.Field)] = new[] { LiteralFieldShape, EnumFieldShape, StaticFieldShape }, + [nameof(ClrMemberResolution.InconclusiveResult)] = new[] { DeclinedMethodShape, DeclinedValueShape, OppositeHalfShape }, + [nameof(ClrMemberResolution.AbsentResult)] = new[] { GenericMethodShape, NoMemberShape }, }; private const string UncheckedAtAnAttribute = "; at an attribute argument, which the checker does not visit today, it is one more cell of the class the instance-member and method-group cells there hold red, with the same cure"; private const string NamesAType = "names a type: handed to a slot of another type it is the checker's own mismatch (SPY0220) at every position the checker checks" + UncheckedAtAnAttribute; private const string NoSuchMember = "no member of the name: the checker refuses the read itself (SPY0203) and binds nothing" + UncheckedAtAnAttribute; - private const string TheCheckerDeclines = "the resolver declines to describe the member, so the checker binds nothing: a member nothing bound is outside the bound-member kinds by definition, and plan-777361's D8 leaves it to the shape rule"; + private const string AnInstanceMemberThroughItsType = "the name is on the type's INSTANCE half (`DateTime.year`): the resolver declines to answer, the checker types the read `object` and refuses it under no kind, and the read is SPY0908 CS0120 in a function's body as in a parameter default, a `const` and an attribute argument, so it is a missing kind refusal (#1975's class) and no constant position's verdict. A type that fails to load gets the same answer for every name, and no program names one"; + private const string NoDeclinedValue = "a static field or property whose TYPE has no Sharpy spelling: the census of the `System` namespace finds none (AxisProblems), so no program reads one; when it finds one the shape is owed its kind"; + private const string AGenericMethodThroughItsType = "a generic method, which the resolver does not look at (`Array.resize`): read uncalled its delegate type cannot be inferred, SPY0908 CS8917 in a function's body as in a `const` (#2277's class), so no constant position's verdict"; internal static readonly IReadOnlyDictionary ExcludedClrTypeMemberShapes = new Dictionary(StringComparer.Ordinal) { [nameof(ClrMemberResolution.NestedType)] = NamesAType, - [nameof(ClrMemberResolution.AbsentResult)] = NoSuchMember, - [nameof(ClrMemberResolution.InconclusiveResult)] = TheCheckerDeclines, + [NoMemberShape] = NoSuchMember, + [GenericMethodShape] = AGenericMethodThroughItsType, + [OppositeHalfShape] = AnInstanceMemberThroughItsType, + [DeclinedValueShape] = NoDeclinedValue, + }; + + /// The member each probe of an excluded shape reads, which ties to the shape. + internal static readonly IReadOnlyDictionary ExcludedShapeMembers = new Dictionary(StringComparer.Ordinal) + { + [OppositeHalfShape] = (typeof(DateTime), "year"), + [GenericMethodShape] = (typeof(Array), "resize"), + [NoMemberShape] = (typeof(int), "nosuch"), }; /// The shape of read through , as the checker's resolver answers it. internal static string ClrTypeMemberShape(Type owner, string member) { var resolution = new ClrMemberTypeResolver(new ClrTypeBridge()).Resolve(owner, member, ClrReceiverKind.StaticType); + const BindingFlags Statics = BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy; + bool Named(MemberInfo m, ReverseNameContext context) => m.Name == member || NameMangler.ToSharpyName(m.Name, context) == member; + if (resolution is ClrMemberResolution.InconclusiveResult) + { + return owner.GetMethods(Statics).Any(m => !m.IsSpecialName && Named(m, ReverseNameContext.Method)) ? DeclinedMethodShape + : owner.GetProperties(Statics).Cast().Concat(owner.GetFields(Statics)).Any(m => Named(m, ReverseNameContext.Property)) ? DeclinedValueShape + : OppositeHalfShape; + } + if (resolution is ClrMemberResolution.AbsentResult) + return owner.GetMethods(Statics).Any(m => m.IsGenericMethodDefinition && Named(m, ReverseNameContext.Method)) ? GenericMethodShape : NoMemberShape; if (resolution is not ClrMemberResolution.Field field) return resolution.GetType().Name; var info = owner.GetField(field.ClrName, BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy); return info is not { IsLiteral: true } ? StaticFieldShape : owner.IsEnum ? EnumFieldShape : LiteralFieldShape; } - /// The enum reads, total over EnumMemberAccessKind (which half of which enum shape a .name / .value - /// read takes) and the member itself per shape, which has no access kind. - internal static readonly IReadOnlyDictionary EnumReadKinds = new Dictionary - { - [ScopeConstantKind.IntEnumMember] = (true, null), - [ScopeConstantKind.IntEnumValue] = (true, EnumMemberAccessKind.IntValue), - [ScopeConstantKind.IntEnumName] = (true, EnumMemberAccessKind.IntName), - [ScopeConstantKind.StringEnumMember] = (false, null), - [ScopeConstantKind.StringEnumValue] = (false, EnumMemberAccessKind.StringValue), - [ScopeConstantKind.StringEnumName] = (false, EnumMemberAccessKind.StringName), - }; - /// The kinds that are no member: closed by call 45 (a chain is admitted when each link is). internal static readonly IReadOnlySet ChainKinds = new HashSet { ScopeConstantKind.ComparisonChain, ScopeConstantKind.ChainWithNonConstantLink }; - /// A read of a name the program declares: the kind, the spelling of its declaration's type, through which type the - /// member is named (Base: a subclass), its read form where it is a callable, the declarations, the read, the slot's - /// type, how main shows the value, and the codes the kind's own refusal carries. - internal sealed record OwnRead(BindingKind Kind, ScopeAnnotation? Annotation, DeclaringRelation? Relation, Harness.Form? Form, string? Prelude, string Text, string Type, string Show, string[]? Refusals); + /// A read of a name the program declares: the kind, the spelling of its declaration's type, the spelling of the + /// read, where the reader stands against the member's type (null: outside it; Base: outside, naming the member + /// through a subclass; Self: in the member's own type), the member's order against a bare sibling reader and the + /// outer binding of its name there, its read form where it is a callable, the declarations outside the host, the member's + /// declaration inside it, what follows the host's type, the read, the slot's type, how main shows the value, what the + /// cell prints if it runs, the codes the kind's own refusal carries beside the host's, and the codes of a refusal that is + /// not the host's at all. + internal sealed record OwnRead(BindingKind Kind, ScopeAnnotation? Annotation, Harness.Spelling Spelling, DeclaringRelation? Relation, Harness.Order? Order, BindingKind Outer, + Harness.Form? Form, string? Prelude, string? Member, string? After, string Text, string Type, string Show, string Prints, string[]? Refusals, string[]? Only); private const string ACallByShape = "read as a call it is `EmittableConstantKind.Call`, which every table refuses by the expression's shape before a name is resolved (SPY0401 at a default), so no member's kind is asked; at an enum member's value, which no table judges, a call is the 8951 pool's kind:enum-member-constant cell"; private const string ALocalInAConstantPosition = "a local: only a lambda's default and a local `const` can name one, as a bare name the identifier resolver answers (a local that is no const is SPY0401 at a lambda's default)"; @@ -743,41 +1000,153 @@ internal sealed record OwnRead(BindingKind Kind, ScopeAnnotation? Annotation, De [Harness.Form.Ctor] = ACallByShape, }; + /// The spellings with no cell for a name of the program's own, total over the 8951 pool's Spelling with + /// the spellings derives. + internal static readonly IReadOnlyDictionary ExcludedOwnSpellings = new Dictionary + { + [Harness.Spelling.Call] = ACallByShape, + }; + + private const string NotKeyedByIt = "the reader in a type that is not the member's: every host that is a type's member is one in its outside cells (the attributed class H reads G's member), under each spelling, and no cell is keyed by it"; + private const string ThePoolsRelationCells = "a constant position in a type NESTED in the member's type, or beside it in one enclosing type: bare, the read is refused by D4 (R-KG) whatever the position, and qualified it binds what the outside cell binds. The 8951 pool holds both at an initializer and a method body (its `enclosing` and `sibling` cells); no constant-position host is generated there, by decision (plan-777361's Generator row)"; + + /// The placements of a reader against the member's type with no cell keyed by them, total over + /// DeclaringRelation with Self (the member's own type) and Base (the member named through a subclass). + internal static readonly IReadOnlyDictionary ExcludedOwnPlacements = new Dictionary + { + [DeclaringRelation.Other] = NotKeyedByIt, + [DeclaringRelation.Enclosing] = ThePoolsRelationCells, + [DeclaringRelation.Sibling] = ThePoolsRelationCells, + }; + + private const string NoSelfAtATypeBody = "`self` is bound in a method's body alone: at a type body's own level it names nothing (SPY0200), so a read through it has a host only where the slot sits in a method (a lambda's default, a local or block `const`)"; + /// - /// The program's own names as a constant position is handed them: every kind of the typed-read set (: - /// each kind with an int-valued declaration of x), under each spelling of its declaration's type, named bare at module - /// level and through its type's name or a subclass's otherwise, a callable read UNCALLED (called, it is - /// ); and a builtin function, which is declared by no program. An instance member named through a - /// type is the kind refusal SPY0290 whatever the position. + /// Under which spellings, and from where against its type, a name of a kind is read in a constant position (the owner's + /// ruling 12 of 2026-11-20, #2423 comment 7046304965): READ from the typed-read set's readers, which are themselves read + /// from the 8951 pool (), with the reader's position dropped, since a constant position's hosts + /// are this set's own. So the axis is the image of Spelling and of the reader's placement (in the member's own + /// type, or outside it) under that pool's rosters, and a spelling the pool gains for a kind is owed here at every host + /// (). An instance member's read through its type's name stays the kind refusal it is in the + /// pool (H.x, SPY0290): a constructed instance is a call by shape. /// - internal static readonly IReadOnlyList OwnReads = BuildOwnReads().ToList(); + internal static IReadOnlyList<(Harness.Spelling Spelling, bool Inside)> OwnSpellings(BindingKind kind) + => TypedReaders.Where(r => r.Kind == kind).Select(r => (r.Spelling, r.Inside)).Distinct().OrderBy(r => r.Spelling).ThenBy(r => r.Inside).ToList(); + + private static string InterfaceStaticIsRefused(string what, string tracker = "#2383") + => $"an interface's `@static` {what} is SPY0908 CS0120 read from a function's body, with no constant position in sight ({tracker}'s class): in the interface's own constant positions a cell would hold that defect and no constant position's verdict. An interface's `const` is generated there"; - private static IEnumerable BuildOwnReads() + /// The kinds with no cell where the member's own type is an interface (), each + /// with its own probe. + internal static readonly IReadOnlyDictionary InterfaceStatics = new Dictionary + { + [BindingKind.StaticField] = InterfaceStaticIsRefused("field"), + [BindingKind.StaticProperty] = InterfaceStaticIsRefused("property"), + [BindingKind.StaticMethod] = InterfaceStaticIsRefused("method, read uncalled", "#2111"), + }; + + /// Why a host has no cell for a kind in the member's own type, or null when it has one. + internal static string? OwnKindSkips(ConstantHost host, BindingKind kind, bool inside) + => inside && host.Interface ? InterfaceStatics.GetValueOrDefault(kind) : null; + + /// Why a host has no cell for a spelling and placement, or null when it has one. + internal static string? OwnSpellingSkips(ConstantHost host, Harness.Spelling spelling, bool inside) + => !inside ? null + : host.Inside == null ? host.NoInside ?? "the host names no slot in the member's own type, and does not say why" + : spelling == Harness.Spelling.SelfDot && !host.InMethod ? NoSelfAtATypeBody + : null; + + /// The module binding a bare sibling read is set against, by the member's form: a constant where the member is a + /// value, so a read that binds the wrong one is ADMITTED and prints the wrong value, and a function where it is a callable. + internal static BindingKind SiblingOuter(bool callable) => callable ? BindingKind.ModuleDef : BindingKind.ModuleLiteralConst; + + internal const string BareSibling = "bare-sibling"; + internal const string InMethod = "in-method"; + + /// + /// The program's own names as a host's constant position is handed them: every kind of the typed-read set + /// (: each kind with an int-valued declaration of x), under each spelling of its declaration's + /// type, under every spelling and placement derives for the kind, a callable read UNCALLED + /// (called, it is ); the same member named through a subclass; and a builtin function, which is + /// declared by no program. A bare read of a sibling in the member's own type is the class-body rule's (D3), so it is + /// generated at both orders, with and without a module binding of the name: earlier, or with no such binding, it is the + /// member; at-or-after with one it is N2's refusal (SPY0619, which lands with plan-777361's T8); in a method's body the + /// member is not visible bare (N1) and the read is the module's binding, or SPY0200. + /// + internal static IEnumerable OwnReadsOf(ConstantHost host) { foreach (var (kind, t) in TypedReads.OrderBy(e => e.Key)) { bool callable = t.Member.EndsWith("()", StringComparison.Ordinal); string name = callable ? t.Member[..^2] : t.Member; + string type = callable ? "() -> int" : "int"; + string show = callable ? "{0}()" : "{0}"; + Harness.Form? form = callable ? Harness.Form.Value : null; foreach (var annotation in Enum.GetValues()) { var declaration = annotation == ScopeAnnotation.Annotated ? t.Annotated : t.Inferred; if (declaration == null) continue; - foreach (var relation in t.Level == MemberLevel.Module ? new DeclaringRelation?[] { null } : new DeclaringRelation?[] { null, DeclaringRelation.Base }) + var helpers = t.NeedsFive ? new[] { Five } : Array.Empty(); + string Outside(params string[] lines) => string.Join("\n", helpers.Concat(lines)); + foreach (var (spelling, inside) in OwnSpellings(kind)) + { + if ((OwnSpellingSkips(host, spelling, inside) ?? OwnKindSkips(host, kind, inside)) != null) + continue; + // Through a type's name an instance member is the kind refusal; through `self` it is a value like any other. + var kindRefusal = t.Level == MemberLevel.Instance && spelling != Harness.Spelling.SelfDot ? new[] { "SPY0290" } : null; + if (!inside) + { + string receiver = spelling switch + { + Harness.Spelling.Bare when t.Level == MemberLevel.Module => "", + Harness.Spelling.Qualified when t.Level != MemberLevel.Module => "G.", + Harness.Spelling.Alias when t.Level != MemberLevel.Module => "A.", + _ => throw new ArgumentOutOfRangeException(nameof(host), $"{kind} read {spelling} from outside its type has no receiver here"), + }; + string prelude = t.Level == MemberLevel.Module ? Outside(declaration) + : spelling == Harness.Spelling.Alias ? Outside("class G:\n" + Indent(declaration), "type A = G") + : Outside("class G:\n" + Indent(declaration)); + yield return new OwnRead(kind, annotation, spelling, null, null, BindingKind.None, form, prelude, null, null, receiver + name, type, show, "5", kindRefusal, null); + continue; + } + string member = Indent(declaration) + "\n"; + if (spelling != Harness.Spelling.Bare) + { + string receiver = spelling switch + { + Harness.Spelling.Qualified => "H.", + Harness.Spelling.Alias => "A.", + Harness.Spelling.SelfDot => "self.", + _ => throw new ArgumentOutOfRangeException(nameof(host), $"{kind} read {spelling} in its own type has no receiver here"), + }; + yield return new OwnRead(kind, annotation, spelling, DeclaringRelation.Self, null, BindingKind.None, form, helpers.Length == 0 ? null : Outside(), member, + spelling == Harness.Spelling.Alias ? "type A = H\n" : null, receiver + name, type, show, "5", kindRefusal, null); + continue; + } + foreach (var order in new[] { Harness.Order.Earlier, Harness.Order.Later }) + { + foreach (var outer in new[] { BindingKind.None, SiblingOuter(callable) }) + { + string? prelude = outer == BindingKind.None ? (helpers.Length == 0 ? null : Outside()) + : Outside(callable ? "def x() -> int:\n return 12" : "const x: int = 12"); + // In a method's body the member is not visible bare; at the type body's level it is, unless N2 refuses. + string[]? only = host.InMethod ? outer == BindingKind.None ? new[] { "SPY0200" } : null + : order == Harness.Order.Later && outer != BindingKind.None ? new[] { "SPY0619" } : null; + yield return new OwnRead(kind, annotation, spelling, DeclaringRelation.Self, order, outer, form, prelude, member, null, name, type, show, + host.InMethod && outer != BindingKind.None ? "12" : "5", null, only); + } + } + } + if (t.Level != MemberLevel.Module) { - var prelude = new List(); - if (t.NeedsFive) - prelude.Add(Five); - prelude.Add(t.Level == MemberLevel.Module ? declaration : "class G:\n" + Indent(declaration)); - if (relation == DeclaringRelation.Base) - prelude.Add("class D(G):\n pass"); - string receiver = t.Level == MemberLevel.Module ? "" : relation == DeclaringRelation.Base ? "D." : "G."; - yield return new OwnRead(kind, annotation, relation, callable ? Harness.Form.Value : null, string.Join("\n", prelude), receiver + name, - callable ? "() -> int" : "int", callable ? "{0}()" : "{0}", t.Level == MemberLevel.Instance ? new[] { "SPY0290" } : null); + yield return new OwnRead(kind, annotation, Harness.Spelling.Qualified, DeclaringRelation.Base, null, BindingKind.None, form, + Outside("class G:\n" + Indent(declaration), "class D(G):\n pass"), null, null, "D." + name, type, show, "5", + t.Level == MemberLevel.Instance ? new[] { "SPY0290" } : null, null); } } } - yield return new OwnRead(BindingKind.Builtin, null, null, Harness.Form.Value, null, "abs", "(int) -> int", "{0}(-5)", null); + yield return new OwnRead(BindingKind.Builtin, null, Harness.Spelling.Bare, null, null, BindingKind.None, Harness.Form.Value, null, null, null, "abs", "(int) -> int", "{0}(-5)", "5", null, null); } // ------------------------------------------------------------------------------------------- // @@ -966,25 +1335,133 @@ void Carried(string route, IEnumerable owed, Func> re Carried("constant-kind", Enum.GetValues(), Part); // constant-kind: the member kinds, each against what the compiler records for the member - var census = StdlibModuleValues.Value; - Partition("constant-kind × module value", census.Values.Distinct().Concat(UnproducedModuleValueShapes.Keys), ModuleValueShapes.Keys, UnproducedModuleValueShapes.Keys); - foreach (var shape in UnproducedModuleValueShapes.Keys.Where(s => census.Values.Contains(s))) - problems.Add($"constant-kind × module value: {census.First(v => v.Value == shape).Key} is {shape}, which is listed as a shape no value has"); + var census = StdlibModuleMembers.Value; + Partition("constant-kind × module member collection", typeof(ModuleOverloads).GetProperties(BindingFlags.Public | BindingFlags.Instance).Select(p => p.Name), + ModuleMemberShapes.Keys.Concat(ExcludedModuleMemberShapes.Keys).Select(k => k.Split('/')[0]).Distinct(), ExcludedModuleCollections.Keys); + Partition("constant-kind × module member", census.Values.Distinct().Concat(UnproducedModuleMemberShapes), ModuleMemberShapes.Keys, ExcludedModuleMemberShapes.Keys); + foreach (var shape in UnproducedModuleMemberShapes.Where(s => census.Values.Contains(s))) + problems.Add($"constant-kind × module member: {census.First(v => v.Value == shape).Key} is {shape}, which is listed as a shape no member has"); + foreach (var kind in ModuleMemberShapes.Values.Where(k => !ModuleMembers.ContainsKey(k))) + problems.Add($"constant-kind × module member: {kind} has no member to read"); + foreach (var kind in ClrTypeMemberShapes.Values.Where(k => !TypeMembers.ContainsKey(k))) + problems.Add($"constant-kind × type member: {kind} has no member to read"); Partition("constant-kind × type member", typeof(ClrMemberResolution).GetNestedTypes(BindingFlags.Public | BindingFlags.NonPublic).Where(t => t.IsSubclassOf(typeof(ClrMemberResolution))) - .SelectMany(t => t.Name == nameof(ClrMemberResolution.Field) ? new[] { LiteralFieldShape, EnumFieldShape, StaticFieldShape } : new[] { t.Name }), + .SelectMany(t => RefinedClrTypeMemberShapes.GetValueOrDefault(t.Name, new[] { t.Name })), ClrTypeMemberShapes.Keys, ExcludedClrTypeMemberShapes.Keys); Partition("constant-kind × enum access", Enum.GetValues(), EnumReadKinds.Values.Where(v => v.Access != null).Select(v => v.Access!.Value), Array.Empty()); foreach (var intShape in new[] { true, false }.Where(isInt => !EnumReadKinds.Values.Contains((isInt, (EnumMemberAccessKind?)null)))) problems.Add($"constant-kind × enum access: the member of {(intShape ? "an int" : "a string")} enum has no kind"); Partition("constant-kind × kind", Enum.GetValues(), - ModuleValueShapes.Values.Concat(ClrTypeMemberShapes.Values).Concat(EnumReadKinds.Keys).Append(ScopeConstantKind.OwnMember), ChainKinds); - var ownKinds = OwnReads.Select(r => r.Kind).Append(BindingKind.ModuleEnum).Append(BindingKind.ImportedName).Distinct().ToList(); + ModuleMemberShapes.Values.Concat(ClrTypeMemberShapes.Values).Concat(EnumReadKinds.Keys).Append(ScopeConstantKind.OwnMember), ChainKinds); + var ownKinds = TypedReads.Keys.Append(BindingKind.Builtin).Append(BindingKind.ModuleEnum).Append(BindingKind.ImportedName).Distinct().ToList(); Partition("constant-kind × own name", Enum.GetValues(), ownKinds, ExcludedOwnReads.Keys); Carried("constant-kind", ownKinds, c => new[] { c.Cell.Target }); Carried("constant-kind", Enum.GetValues(), Part); - Carried("constant-kind", new[] { DeclaringRelation.Base }, Part); Partition("constant-kind × read form", Enum.GetValues(), Route("constant-kind").SelectMany(Part), ExcludedConstantForms.Keys); + + // constant-kind: the spelling of the read and the placement of its reader, per where the member lives + var constantCells = Route("constant-kind").ToList(); + IEnumerable Own() => constantCells.Where(c => c.Cell.Key!.Part() == ScopeConstantKind.OwnMember); + Partition("constant-kind × own spelling", Enum.GetValues(), Own().SelectMany(Part), ExcludedOwnSpellings.Keys); + Partition("constant-kind × own placement", Enum.GetValues(), Own().SelectMany(Part), ExcludedOwnPlacements.Keys); + foreach (var (_, host) in AllConstantHosts()) + { + if ((host.Inside == null) == (host.NoInside == null)) + problems.Add($"constant-kind × host: {host.Label} {(host.Inside == null ? "has no slot in the member's own type and no reason" : "has such a slot and a reason against it")}"); + if (host.InMethod && host.Inside == null) + problems.Add($"constant-kind × host: {host.Label} says its slot sits in a method and names none"); + // Every spelling and placement the typed-read set has a reader for, of every kind: a cell at this host, or the reason there is none. + foreach (var (kind, t) in TypedReads) + { + string slot = t.Member.EndsWith("()", StringComparison.Ordinal) ? "() -> int" : "int"; + foreach (var (spelling, inside) in OwnSpellings(kind)) + { + bool carried = Own().Any(c => c.Cell.Target == kind && Marks(c).Contains(host.Label) && c.Cell.Key!.Part() == spelling + && (c.Cell.Key.Part() == DeclaringRelation.Self) == inside); + bool skipped = (OwnSpellingSkips(host, spelling, inside) ?? OwnKindSkips(host, kind, inside) ?? HostSkips(host, slot)) != null; + if (carried == skipped) + problems.Add($"constant-kind × own spelling: {kind} read {spelling} {(inside ? "in its own type" : "from outside its type")} at {host.Label} is {(carried ? "generated and excluded" : "neither generated nor excluded")}"); + } + } + } + foreach (var kind in TypedReads.Keys.Where(k => OwnSpellings(k).Count == 0)) + problems.Add($"constant-kind × own spelling: the typed-read set has no reader of {kind}, so no spelling is owed for it"); + // A bare sibling read has the class-body rule's two axes: both orders, with and without a module binding of the name. + foreach (var sibling in Own().Where(c => Marks(c).Contains(BareSibling)).GroupBy(c => string.Join("/", c.Cell.Key!.Parts.Where(p => p is not Harness.Order && !(p is string text && text.StartsWith("outer=", StringComparison.Ordinal)))))) + { + var seen = sibling.Select(c => (c.Cell.Key!.Part(), c.Cell.Outer != BindingKind.None)).ToHashSet(); + foreach (var order in new Harness.Order?[] { Harness.Order.Earlier, Harness.Order.Later }) + { + foreach (var bound in new[] { false, true }.Where(b => !seen.Contains((order, b)))) + problems.Add($"constant-kind × sibling: {sibling.Key} has no cell at {order} {(bound ? "under" : "without")} a module binding of the name"); + } + } + Partition("constant-kind × import form", Enum.GetValues(), ImportSpellings.Select(i => i.Form), Array.Empty()); + Partition("constant-kind × import kind", Enum.GetValues(), ImportSpellings.Select(i => i.Kind), ExcludedImportKinds.Keys); + Partition("constant-kind × star import", new[] { false, true }, ImportSpellings.Where(i => i.Form == ImportBindingForm.FromImport).Select(i => i.Star), Array.Empty()); + Partition("constant-kind × enum spelling", Enum.GetValues(), EnumSpellings.Keys, ExcludedEnumSpellings.Keys); + // Every member is read under every spelling it has: a spelling with no cell for one member is a hand list again. + IEnumerable Owed(ScopeConstantKind kind) + => ModuleMembers.ContainsKey(kind) ? ImportSpellings.Select(i => i.Label) + : TypeMembers.ContainsKey(kind) ? ImportSpellings.Select(i => i.Label).Append(TypeAliasSpelling) + : EnumReadKinds.ContainsKey(kind) ? EnumSpellings.Where(v => EnumReadSkips(v.Key, kind) == null).Select(v => v.Value.Label) + : Array.Empty(); + foreach (var kind in EnumReadKinds.Keys) + { + foreach (var (spelling, named) in EnumSpellings.Where(s => EnumReadSkips(s.Key, kind) != null)) + { + if (constantCells.Any(c => c.Cell.Key!.Part() == kind && Marks(c).Contains(named.Label))) + problems.Add($"constant-kind × enum spelling: {kind} under {spelling} is generated and excluded"); + } + } + foreach (var (kind, expressions) in ConstantExpressions) + { + foreach (var member in expressions.GroupBy(e => e.Label, StringComparer.Ordinal)) + { + foreach (var spelling in Owed(kind).Where(o => !constantCells.Any(c => c.Cell.Key!.Part() == kind && Marks(c).Contains(member.Key) && Marks(c).Contains(o)))) + problems.Add($"constant-kind × spelling: no cell reads {kind} {member.Key} under {spelling}"); + } + } + // And at every host: a cell, or the reason the host's slot cannot take the expression's type. + var marked = constantCells.Select(c => (Kind: c.Cell.Key!.Part(), Marks: Marks(c).ToHashSet(StringComparer.Ordinal))).ToList(); + foreach (var (_, host) in AllConstantHosts()) + { + foreach (var (kind, expressions) in ConstantExpressions) + { + foreach (var e in expressions) + { + bool carried = marked.Any(m => m.Kind == kind && m.Marks.Contains(host.Label) && m.Marks.Contains(e.Label) && (e.Spelling == null || m.Marks.Contains(e.Spelling))); + if (carried == (HostSkips(host, e.Type) != null)) + problems.Add($"constant-kind × host: {kind} {e.Label}{(e.Spelling == null ? "" : " under " + e.Spelling)} at {host.Label} is {(carried ? "generated and excluded" : "neither generated nor excluded")}"); + } + } + } + if (!constantCells.Any(c => Marks(c).Contains(BuiltinNameSpelling))) + problems.Add($"constant-kind × spelling: no cell reads a referenced type by its builtin name"); + foreach (var (shape, (owner, member)) in ExcludedShapeMembers) + { + if (ClrTypeMemberShape(owner, member) is var answered && answered != shape) + problems.Add($"constant-kind × type member: `{owner.Name}.{member}` is what the exclusion of {shape} reads, and the checker's resolver answers {answered} for it"); + if (!ExcludedClrTypeMemberShapes.TryGetValue(shape, out var reason) || !BehaviourProbes.ContainsKey(reason)) + problems.Add($"constant-kind × type member: {shape} names a member and has no probed exclusion"); + } + // A shape excluded because no member has it: the census of the namespace every program reads its types from holds it at 0. + var censused = new HashSet(StringComparer.Ordinal); + foreach (var type in typeof(object).Assembly.GetExportedTypes().Where(t => t.Namespace == nameof(System) && !t.IsGenericTypeDefinition && !t.IsNested)) + { + foreach (var value in type.GetProperties(BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly).Select(m => NameMangler.ToSharpyName(m.Name, ReverseNameContext.Property)) + .Concat(type.GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly).Select(m => NameMangler.ToSharpyName(m.Name, ReverseNameContext.Property))).Distinct()) + { + string shape = ClrTypeMemberShape(type, value); + censused.Add(shape); + if (shape == DeclinedValueShape) + problems.Add($"constant-kind × type member: `{type.Name}.{value}` is {DeclinedValueShape}, which is excluded as a shape no member has"); + } + } + // The census's own control: it sees the static values the generated kinds are the image of, so its 0 is a count. + foreach (var unseen in new[] { LiteralFieldShape, EnumFieldShape, StaticFieldShape, nameof(ClrMemberResolution.Property) }.Where(v => !censused.Contains(v))) + problems.Add($"constant-kind × type member: the census of `System` sees no static value of shape {unseen}, so it says nothing of the shape it holds at 0"); foreach (var (kind, expressions) in ConstantExpressions) { foreach (var e in expressions) @@ -992,9 +1469,9 @@ void Carried(string route, IEnumerable owed, Func> re if (e.ModuleValue != null) { if (!census.TryGetValue(e.ModuleValue, out var recorded)) - problems.Add($"constant-kind: discovery records no value {e.ModuleValue}"); - else if (!ModuleValueShapes.TryGetValue(recorded, out var image) || image != kind) - problems.Add($"constant-kind: {e.Label} is listed under {kind}, and discovery records {e.ModuleValue} (IsConst, IsGuarded) = {recorded}"); + problems.Add($"constant-kind: discovery records no member {e.ModuleValue}"); + else if (!ModuleMemberShapes.TryGetValue(recorded, out var image) || image != kind) + problems.Add($"constant-kind: {e.Label} is listed under {kind}, and discovery records {e.ModuleValue} as {recorded}"); } else if (e.Owner != null) { @@ -1010,7 +1487,8 @@ void Carried(string route, IEnumerable owed, Func> re EnumMemberAccessKind.IntValue or EnumMemberAccessKind.StringValue => ".RED.value", _ => ".RED.name", }; - if (e.Prelude != (read.IntShape ? IntEnum : StringEnum) || !e.Text.EndsWith(suffix, StringComparison.Ordinal)) + // The enum's declaration opens the prelude; a spelling may declare an alias of it after. + if (e.Prelude?.Split("\ntype ", 2)[0] != (read.IntShape ? IntEnum : StringEnum) || !e.Text.EndsWith(suffix, StringComparison.Ordinal)) problems.Add($"constant-kind: {e.Text} is listed under {kind}, which is `{suffix}` of {(read.IntShape ? "an int" : "a string")} enum"); } else if (!ChainKinds.Contains(kind) || e.Import != null || e.Prelude != null) @@ -1045,14 +1523,20 @@ void Carried(string route, IEnumerable owed, Func> re // An exclusion that rests on the compiler names its probe, and a probe has its exclusion. var reasons = ExcludedDeclarations.Values.Concat(ExcludedDeclarationHosts.Values).Concat(ExcludedValueTypes.Values).Concat(ExcludedTypedReads.Values) .Concat(ExcludedTypedSpellings.Values).Concat(ExcludedTypedPositions.Values).Concat(ExcludedCalleeBinders.Values).Concat(ExcludedCalleeOuters.Values) - .Concat(ExcludedAdmissionTables.Values).Concat(UnproducedModuleValueShapes.Values).Concat(ExcludedAliasScopes.Values).Concat(ExcludedAliasTypeHosts.Values) + .Concat(ExcludedAdmissionTables.Values).Concat(ExcludedModuleMemberShapes.Values).Concat(ExcludedModuleCollections.Values).Concat(ExcludedAliasScopes.Values).Concat(ExcludedAliasTypeHosts.Values) + .Concat(ExcludedOwnSpellings.Values).Concat(ExcludedOwnPlacements.Values).Concat(ExcludedEnumSpellings.Values).Concat(ExcludedImportKinds.Values) + .Concat(AllConstantHosts().SelectMany(h => Enum.GetValues().Select(sp => OwnSpellingSkips(h.Host, sp, inside: true))).Where(r => r != null).Select(r => r!)) .Concat(ExcludedAliasShapeProperties.Values).Concat(ExcludedOrders.Values.SelectMany(o => o.Values)) .Concat(ExcludedConstScopes.Values).Concat(ExcludedConstTypeHosts.Values).Concat(ExcludedConstantReaders.Values).Concat(ExcludedClrTypeMemberShapes.Values) .Concat(ExcludedOwnReads.Values).Concat(ExcludedConstantForms.Values).Concat(ExcludedAliasUses.Values).Concat(ExcludedSelfReachingShapes.Values) - .Concat(AllConstantHosts().SelectMany(h => new[] { "int", "() -> int" }.Select(t => HostSkips(h.Host, t))).Where(r => r != null).Select(r => r!)) + .Concat(AllConstantHosts().SelectMany(h => new[] { "int", "() -> int", "m0.T" }.Select(t => HostSkips(h.Host, t))).Where(r => r != null).Select(r => r!)) + .Concat(AllConstantHosts().SelectMany(h => TypedReads.Keys.Select(k => OwnKindSkips(h.Host, k, inside: true))).Where(r => r != null).Select(r => r!)) + .Concat(EnumReadKinds.Keys.SelectMany(k => Enum.GetValues().Select(sp => EnumReadSkips(sp, k))).Where(r => r != null).Select(r => r!)) .ToHashSet(StringComparer.Ordinal); - foreach (var orphan in BehaviourProbes.Keys.Where(k => !reasons.Contains(k))) + foreach (var orphan in BehaviourProbes.Keys.Concat(CrashProbes.Keys).Where(k => !reasons.Contains(k))) problems.Add($"a probe guards the reason '{orphan}', and no exclusion gives it"); + foreach (var twice in BehaviourProbes.Keys.Where(CrashProbes.ContainsKey)) + problems.Add($"the reason '{twice}' has a probe in this process and one in a child process: it rests on one behaviour"); foreach (var blank in reasons.Where(string.IsNullOrWhiteSpace)) problems.Add($"an exclusion gives no reason: '{blank}'"); return problems; @@ -1075,6 +1559,24 @@ public void Axes_EveryValueIsGeneratedOrExcluded() Assert.True(problems.Count == 0, string.Join("\n", problems)); } + /// The falsifier of an exclusion that rests on the compiler DYING: the child process still dies of it, and still + /// compiles the control. When the crash stops, the value is owed its cells. + [Fact] + public void Exclusions_RestingOnACompilerCrash_GoRedWhenItStops() + { + var problems = new List(); + foreach (var (reason, probe) in CrashProbes.OrderBy(e => e.Key, StringComparer.Ordinal)) + { + var control = CompileInChildProcess(probe.Control); + if (!control.Compiled) + problems.Add($"'{reason}': the child process does not compile the control, so it says nothing about the crash: {control}"); + var run = CompileInChildProcess(probe.Source); + if (!probe.Holds(run)) + problems.Add($"'{reason}' rests on {probe.Expected}, and the child process now gives {run}: generate the value, or give the exclusion its new reason"); + } + Assert.True(problems.Count == 0, string.Join("\n", problems)); + } + /// The falsifier of every exclusion that rests on compiler behaviour: its probe still does what the reason says. [Fact] public void Exclusions_RestingOnTheCompiler_GoRedWhenItChanges() diff --git a/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Readers.cs b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Readers.cs index 6dfeca280..96e95410b 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Readers.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Readers.cs @@ -100,6 +100,110 @@ void Add(string file, SyntaxNode at, AdmissionTable table) .Select(f => (Path.GetFileName(f), File.ReadAllText(f)))); }); + // ------------------------------------------------------------------------------------------- // + // The compiler in a child process: for a behaviour that ends the process + // ------------------------------------------------------------------------------------------- // + + /// How a child process that compiled one source ended: its exit code, what it wrote, whether the compiler + /// answered (compiled or refused), and whether the process died of a stack overflow. + internal sealed record ChildCompile(int ExitCode, string Stdout, string Stderr) + { + public bool Compiled => ExitCode == 0 && Stdout.Contains(ChildCompiledMark, StringComparison.Ordinal); + public bool Answered => Compiled || Stdout.Contains(ChildRefusedMark, StringComparison.Ordinal); + public bool Overflowed => ExitCode != 0 && !Answered && Stderr.Contains("Stack overflow", StringComparison.OrdinalIgnoreCase); + + public override string ToString() + => $"exit {ExitCode}, stdout '{Stdout.Trim()}', stderr '{Stderr.TrimStart().Split('\n', 2)[0].Trim()}'"; + } + + private const string ChildCompiledMark = "CHILD-COMPILED"; + private const string ChildRefusedMark = "CHILD-REFUSED"; + + /// The child's whole program: compile the file it is handed with the compiler's public API and say how it went. + private const string ChildDriverSource = + "public static class ScopeMeaningChild\n" + + "{\n" + + " public static int Main(string[] args)\n" + + " {\n" + + " var api = new Sharpy.Compiler.CompilerApi(null, new[] { args[1] });\n" + + " var result = api.Compile(System.IO.File.ReadAllText(args[0]));\n" + + " System.Console.WriteLine(result.Success ? \"" + ChildCompiledMark + "\" : \"" + ChildRefusedMark + "\");\n" + + " return result.Success ? 0 : 1;\n" + + " }\n" + + "}\n"; + + /// + /// Compiles in a process of its own and reports how the process ended. The child is a driver + /// compiled here against the compiler this test loaded, written beside it (the test's output directory), so dotnet exec + /// resolves the compiler and everything it references from the driver's own directory; nothing depends on a built CLI. + /// + internal static ChildCompile CompileInChildProcess(string source) + { + var compilerAssembly = typeof(Sharpy.Compiler.CompilerApi).Assembly.Location; + var directory = Path.GetDirectoryName(compilerAssembly)!; + var name = $"scope-meaning-child-{Environment.ProcessId}-{Guid.NewGuid():N}"; + var driver = Path.Combine(directory, name + ".dll"); + var runtimeConfig = Path.Combine(directory, name + ".runtimeconfig.json"); + var sourceFile = Path.Combine(Path.GetTempPath(), name + ".spy"); + try + { + var runtime = Path.GetDirectoryName(typeof(object).Assembly.Location)!; + var references = new[] { typeof(object).Assembly.Location, Path.Combine(runtime, "System.Runtime.dll"), Path.Combine(runtime, "System.Console.dll"), compilerAssembly } + .Select(path => (MetadataReference)MetadataReference.CreateFromFile(path)); + var compilation = CSharpCompilation.Create(name, new[] { CSharpSyntaxTree.ParseText(ChildDriverSource) }, references, new CSharpCompilationOptions(OutputKind.ConsoleApplication)); + var emitted = compilation.Emit(driver); + Assert.True(emitted.Success, "the child's driver does not compile: " + string.Join("; ", emitted.Diagnostics.Where(d => d.Severity == DiagnosticSeverity.Error))); + File.WriteAllText(runtimeConfig, "{ \"runtimeOptions\": { \"tfm\": \"net" + Environment.Version.Major + ".0\", \"framework\": { \"name\": \"Microsoft.NETCore.App\", \"version\": \"" + Environment.Version.Major + ".0.0\" } } }"); + File.WriteAllText(sourceFile, source); + + var start = new System.Diagnostics.ProcessStartInfo("dotnet") + { + RedirectStandardOutput = true, + RedirectStandardError = true, + UseShellExecute = false, + WorkingDirectory = directory, + }; + start.ArgumentList.Add("exec"); + start.ArgumentList.Add(driver); + start.ArgumentList.Add(sourceFile); + start.ArgumentList.Add(Sharpy.TestInfrastructure.SharpyCoreReference.Location); + using var process = System.Diagnostics.Process.Start(start)!; + var stdout = process.StandardOutput.ReadToEndAsync(); + var stderr = process.StandardError.ReadToEndAsync(); + if (!process.WaitForExit(120_000)) + { + process.Kill(entireProcessTree: true); + return new ChildCompile(-1, stdout.Result, "timed out after 120 s"); + } + process.WaitForExit(); + return new ChildCompile(process.ExitCode, stdout.Result, stderr.Result); + } + finally + { + foreach (var file in new[] { driver, runtimeConfig, sourceFile }) + { + try + { + File.Delete(file); + } + catch (IOException) + { + } + } + } + } + + /// The child's own control: it compiles a program that compiles and refuses one that does not, so a death is the + /// compiler's and not the child's. + [Fact] + public void CompileInChildProcess_AnswersForAProgramThatCompiles_AndForOneThatDoesNot() + { + var compiled = CompileInChildProcess("def main() -> None:\n print(1)\n"); + Assert.True(compiled.Compiled && !compiled.Overflowed, compiled.ToString()); + var refused = CompileInChildProcess("def main() -> None:\n print(nosuch)\n"); + Assert.True(refused is { Compiled: false, Answered: true, Overflowed: false }, refused.ToString()); + } + /// The census's own control: it sees a call that names its table, follows a table that is a parameter to each /// caller, numbers a method's second site, and reports a call it cannot trace. An absence ("no reader without a host") is /// only as good as this. diff --git a/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs index d8cd876f8..3469284ba 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs @@ -32,8 +32,9 @@ internal enum ScopeAnnotation /// owner's ruling 7 of 2026-11-20, #2423 comment 7042723494): every kind of member a constant position's answer is /// asked about, and the two chains. Each member kind is the image of what the compiler records for the member: /// -/// a value of a referenced MODULE: discovery's FieldSignature.IsConst × IsGuarded -/// (); +/// a member of a referenced MODULE: the collection of discovery's ModuleOverloads that holds it, a field refined +/// by FieldSignature.IsConst × IsGuarded and a function by its overload count +/// (; ruling 13, comment 7046304965); /// a member of a referenced TYPE: the subclasses of ClrMemberResolution, a field refined by /// FieldInfo.IsLiteral and whether its type is an enum (); /// a member of an enum the program declares: EnumMemberAccessKind and the member itself, per enum shape @@ -41,7 +42,8 @@ internal enum ScopeAnnotation /// any other name the program declares: , refined by /// (). /// -/// The two chains are closed by call 45. +/// The two chains are closed by call 45. How each member is SPELLED and where its reader stands is a second axis, per where +/// the member lives (ruling 12; ScopeMeaningDifferentialTests.Axes.cs). internal enum ScopeConstantKind { /// A constant of a referenced assembly: a CLR literal field read through a Stdlib module. @@ -54,6 +56,13 @@ internal enum ScopeConstantKind /// static readonly field): no constant. ClrStaticMember, + /// A function of a referenced module with one overload, read uncalled (math.sqrt): a function value, no constant. + ModuleFunction, + + /// A function of a referenced module with several overloads, read uncalled (math.log): the slot's type picks + /// one, and the value is no constant. + ModuleFunctionGroup, + /// A literal field of a referenced type (int.max_value, Math.PI): a C# constant. ClrTypeLiteralField, @@ -69,6 +78,10 @@ internal enum ScopeConstantKind /// A static method of a referenced type with one overload, read uncalled: a function value, no constant. ClrTypeMethod, + /// A static method of a referenced type whose signature the checker's resolver declines to type (a char + /// parameter: Char.is_ascii_digit), read uncalled: the checker types it object, and the value is no constant. + ClrTypeDeclinedMethod, + /// A static method group of a referenced type, read uncalled: no value at all (SPY0336). ClrTypeMethodGroup, @@ -90,8 +103,8 @@ internal enum ScopeConstantKind /// A string enum member's .name: the singleton's property, no constant. StringEnumName, - /// A name the program declares, read where its kind says (bare at module level, through its type's - /// name or a subclass's): the cell's target is the kind. + /// A name the program declares, read under each spelling and from each placement the typed-read set has a + /// reader for (OwnSpellings): the cell's target is the kind. OwnMember, /// A comparison chain whose every link is a constant. @@ -129,7 +142,7 @@ internal enum ScopeOverloadCaller /// /// Stage 0 of plan-777361 (P78; verification contract §11), the owner's rulings of 2026-11-20 (#2423 comments -/// 7030074628 item 1, 7039834146 item 5 and 7042723494 items 7 to 9): the cells of rules N1, N2, N4 and N7 that the P77a pool +/// 7030074628 item 1, 7039834146 item 5, 7042723494 items 7 to 9 and 7046304965 items 12 and 13): the cells of rules N1, N2, N4 and N7 that the P77a pool /// () has no program for, as a generated test type of their own. A cell is /// a , and its tag and rule are READ from the rule table (name-resolution-rules.txt, #2487): /// the generator writes the program, what it prints when it runs and the codes a refusal may carry, and never a verdict. @@ -147,14 +160,16 @@ internal enum ScopeOverloadCaller /// callee: a binder's name called under an outer binding of the name, binder ( and /// the parameter) × outer (); /// constant-kind (#2432): host (the call sites of ConstantDefaultClassifier.IsAdmitted, each with its -/// AdmissionTable, and the enum member's value) × ; +/// AdmissionTable, and the enum member's value) × × the read's spelling and the +/// reader's placement (an import's forms, a type's alias, and for the program's own names Spelling × inside or outside +/// the member's type, as the typed-read set's readers have them); /// init-overload: × order; /// alias-target: declaration site (ScopeKind × TypeKind) × target shape (the properties of the /// alias's AST records) × × × order. An alias that reaches /// itself has its unused cells, which must run, and no used one (#2769). /// /// Known-red cells are rows of scope-meaning-differential-allowlist.txt (a missing file reads as empty), each citing -/// the issue whose fix turns it green. A must-refuse cell refused under a code its cell does not admit is listed as +/// the issue whose fix turns it green, by the cell's class (). A must-refuse cell refused under a code its cell does not admit is listed as /// with the lane wrong-code: the refusal is another rule's. /// [Trait("Category", "GapDiscovery")] @@ -181,7 +196,7 @@ private static CellKey Key(params object?[] parts) /// the codes a refusal of it may carry. private static Case Draft(CellKey key, Family family, string source, string? model, string[] refusal, bool twin, BindingKind target = BindingKind.None, BindingKind outer = BindingKind.None, ReadPosition? position = null, - LocalTarget? construct = null, bool stdlib = false) + LocalTarget? construct = null, bool stdlib = false, DeclaringRelation? relation = null) => new( new NameCell { @@ -196,6 +211,7 @@ private static Case Draft(CellKey key, Family family, string source, string? mod Outer = outer, Position = position, Construct = construct, + Relation = relation, SeedRefusalCodes = new HashSet(refusal, StringComparer.Ordinal), NeedsStdlib = stdlib, }, @@ -443,25 +459,32 @@ private static IEnumerable ConstantKindCases() { if (HostSkips(host, e.Type) != null) continue; - yield return ConstantCase(Key("read", "constant-kind", table, host.Label, kind, e.Form, e.Label), table, host, kind, e.Text, e.Type, e.Prints, e.Show, - imports: e.Import, prelude: e.Prelude, refusals: e.Refusals, target: e.Target, stdlib: e.Stdlib, - twin: host.Twin && e.Target == BindingKind.None && kind is ScopeConstantKind.ClrLiteralField or ScopeConstantKind.ComparisonChain); + // Python has the module-qualified read of a literal and the chain; every other spelling is Sharpy's own cell. + bool twin = host.Twin && (kind == ScopeConstantKind.ComparisonChain || (kind == ScopeConstantKind.ClrLiteralField && e.Spelling == ImportSpellings[0].Label)); + yield return ConstantCase(Key("read", "constant-kind", table, host.Label, kind, e.Form, e.Label, e.Spelling), table, host, kind, e.Text, e.Type, e.Prints, e.Show, + imports: e.Import, prelude: e.Prelude, refusals: e.Refusals, target: e.Target, stdlib: e.Stdlib, twin: twin); } } - foreach (var own in OwnReads) + foreach (var own in OwnReadsOf(host)) { if (HostSkips(host, own.Type) != null) continue; - yield return ConstantCase(Key("read", "constant-kind", table, host.Label, ScopeConstantKind.OwnMember, own.Kind, own.Annotation, own.Relation, own.Form), table, host, - ScopeConstantKind.OwnMember, own.Text, own.Type, "5", own.Show, imports: null, prelude: own.Prelude, refusals: own.Refusals, target: own.Kind, stdlib: false, twin: false); + bool inside = own.Relation == DeclaringRelation.Self; + yield return ConstantCase( + Key("read", "constant-kind", table, host.Label, ScopeConstantKind.OwnMember, own.Kind, own.Annotation, own.Spelling, own.Relation, own.Order, + own.Outer == BindingKind.None ? null : $"outer={own.Outer}", own.Form, + inside && own.Spelling == Harness.Spelling.Bare ? BareSibling : null, inside && host.InMethod ? InMethod : null), + table, host, ScopeConstantKind.OwnMember, own.Text, own.Type, own.Prints, own.Show, imports: null, prelude: own.Prelude, refusals: own.Refusals, target: own.Kind, + stdlib: false, twin: false, own: own); } } } /// One cell: the expression's imports and declarations, then the host's program around it. What main shows is - /// the slot's value read into a local of the slot's type first, since a call on a function-typed property is #2770's. + /// the slot's value read into a local of the slot's type first, since a call on a function-typed property is #2770's. A + /// read from the member's own type takes the host's Inside program, with the member above or below the slot. private static Case ConstantCase(CellKey key, AdmissionTable? table, ConstantHost host, ScopeConstantKind kind, string text, string type, string prints, string show, - string? imports, string? prelude, string[]? refusals, BindingKind target, bool stdlib, bool twin) + string? imports, string? prelude, string[]? refusals, BindingKind target, bool stdlib, bool twin, OwnRead? own = null) { var lines = new List(); if (host.Imports != null) @@ -470,10 +493,19 @@ private static Case ConstantCase(CellKey key, AdmissionTable? table, ConstantHos lines.Add(imports); if (prelude != null) lines.Add(prelude); - lines.Add(host.Program.Replace("{T}", type, StringComparison.Ordinal).Replace("{e}", text, StringComparison.Ordinal) + string program = host.Program; + if (own?.Relation == DeclaringRelation.Self) + { + bool below = own.Order == Harness.Order.Later; + program = host.Inside! + .Replace("{above}", below ? "" : own.Member, StringComparison.Ordinal) + .Replace("{below}", below ? own.Member : "", StringComparison.Ordinal) + .Replace("{after}", own.After ?? "", StringComparison.Ordinal); + } + lines.Add(program.Replace("{T}", type, StringComparison.Ordinal).Replace("{e}", text, StringComparison.Ordinal) .Replace("{s}", string.Format(System.Globalization.CultureInfo.InvariantCulture, show, "v"), StringComparison.Ordinal)); - return Draft(key, Family.Read, Lines(lines), host.PrintsOne ? "1" : prints, new[] { host.Refusal }.Concat(refusals ?? Array.Empty()).ToArray(), twin, - target: target, position: host.Position, stdlib: stdlib); + return Draft(key, Family.Read, Lines(lines), host.PrintsOne ? "1" : prints, own?.Only ?? new[] { host.Refusal }.Concat(refusals ?? Array.Empty()).ToArray(), twin, + target: target, outer: own?.Outer ?? BindingKind.None, position: host.Position, stdlib: stdlib, relation: own?.Relation == DeclaringRelation.Self ? DeclaringRelation.Self : null); } // ------------------------------------------------------------------------------------------- // @@ -635,7 +667,8 @@ public void RuleTable_EveryCaseHasOneRow_AndTakesItsVerdictFromIt() /// The issue whose fix turns a red cell of a route green: #2432 for a constant position's verdict, #2423 for the rest /// (R-QI's cells, the untyped forward read, the callee lookup, the alias refusal: charter §3.20l). A typed read that is /// red at the EARLIER order is no order defect, and it and its later twin are #2417's; an alias that reaches itself is - /// #2769's (). + /// #2769's; in a constant position, N2's cells are #2423's, as is a bare sibling read red at the later order alone, and a + /// member that dies of an instance receiver is #2147's (). internal static readonly IReadOnlyDictionary RouteIssues = new Dictionary(StringComparer.Ordinal) { ["no-initializer"] = "#2423", @@ -653,6 +686,17 @@ public void RuleTable_EveryCaseHasOneRow_AndTakesItsVerdictFromIt() /// and a red one is that tracker's. internal const string SelfReachingAlias = "#2769"; + /// The class of a bare sibling read at-or-after its member under a module binding of the name (N2): the class-body + /// rule's refusal is #2423's whatever the position, a constant one included. + internal const string ClassBodyRule = "#2423"; + + /// The class of a constant or static member read through an instance (#2147): C# refuses the emitted instance + /// access (CS0176) at every position, so a constant position's cell that dies of it waits on that tracker. + internal const string StaticThroughInstance = "#2147"; + + /// The C# error that is #2147's symptom. + internal const string StaticThroughInstanceCs = "CS0176"; + internal sealed record Result(Case Case, Harness.SharpyRun Run, SharpyKind Kind, VerdictClass Class, bool WrongCode, string? PythonFailure); /// The harness's table, and one more red: a must-refuse cell refused under a code it does not admit. @@ -671,6 +715,15 @@ internal static (VerdictClass Class, bool WrongCode) Judge(NameCell cell, Sharpy return order == Harness.Order.Earlier ? cell.Id : Key(key.Parts.Select(p => p is Harness.Order ? Harness.Order.Earlier : p).ToArray()).Text; } + /// The id of a bare sibling read's twin above the reader in a constant position, or null for a cell that is no + /// such read at the later order. + internal static string? SiblingAboveTwinId(NameCell cell) + { + if (cell.Key is not { Route: "constant-kind" } key || !key.Marks.Contains(BareSibling) || key.Part() != Harness.Order.Later) + return null; + return Key(key.Parts.Select(p => p is Harness.Order ? Harness.Order.Earlier : p).ToArray()).Text; + } + /// The cite a red cell's row must carry. are the ids red in the same run: a typed read /// whose earlier twin is red is untyped whatever the order, so declaring before reading does not cure it and it is #2417's. internal static string ProposedCite(Result r, IReadOnlySet redIds) @@ -680,6 +733,14 @@ internal static string ProposedCite(Result r, IReadOnlySet redIds) issue = UntypedAtEitherOrder; if (r.Case.Cell.Key.Part() == ScopeAliasTarget.Itself) issue = SelfReachingAlias; + // N2's refusal, and a sibling read that is red BELOW its member alone (above it the same position gives the same + // member its verdict): the class-body rule's order, whatever the position. + if (r.Case.Cell.Key.Route == "constant-kind" && r.Case.Cell.Rule == "N2") + issue = ClassBodyRule; + if (SiblingAboveTwinId(r.Case.Cell) is { } above && !redIds.Contains(above)) + issue = ClassBodyRule; + if (r.Case.Cell.Key.Route == "constant-kind" && r.Case.Cell.Key.Part() == Harness.Spelling.SelfDot && r.Run.CsCode == StaticThroughInstanceCs) + issue = StaticThroughInstance; string lane = r.WrongCode ? "wrong-code" : r.Class switch { VerdictClass.Ice => "ice", @@ -892,5 +953,35 @@ Result Of(Case c, Harness.SharpyRun run, string? pythonFailure = null) var refusedItself = new[] { Of(itself, Refused("SPY0202")) }; Assert.Empty(RatchetFailures(refusedItself, Rows((itself, VerdictClass.FalseRefusal, "#2769 false-refusal")))); Assert.Contains("the route says '#2769", Assert.Single(RatchetFailures(refusedItself, Rows((itself, VerdictClass.FalseRefusal, "#2423 false-refusal"))))); + + // A constant position's cell is #2432's, with three classes that are another tracker's whatever the position. + static Harness.SharpyRun Ice(string cs) => new(false, null, false, false, "", "", new[] { "SPY0908" }, new[] { "SPY0908" }, cs); + bool Constant(Case c) => c.Cell.Key!.Route == "constant-kind"; + var member = pool.First(c => Constant(c) && c.Cell.Tag == SharpyTag.MustRun && c.Cell.Key!.Part() == Harness.Spelling.Qualified); + Assert.Contains("the route says '#2432", Assert.Single(RatchetFailures(new[] { Of(member, Ice("CS0133")) }, Rows((member, VerdictClass.Ice, "#2423 ice"))))); + // N2: a bare sibling at-or-after its reader under a module binding of the name is the class-body rule's refusal (#2423). + // It is so whatever its twin above the member does: red there too, the twin is the position's own and N2 is still N2. + var shadowed = pool.First(c => Constant(c) && c.Cell.Rule == "N2"); + var shadowedAbove = pool.Single(c => c.Cell.Id == SiblingAboveTwinId(shadowed.Cell)); + Assert.Equal(SharpyTag.MustRefuse, shadowed.Cell.Tag); + var shadowedBoth = new[] { Of(shadowedAbove, Ice("CS0133")), Of(shadowed, Ran("12")) }; + Assert.Empty(RatchetFailures(shadowedBoth, Rows((shadowedAbove, VerdictClass.Ice, "#2432 ice"), (shadowed, VerdictClass.SilentWrong, "#2423 missing-refusal")))); + Assert.Contains("the route says '#2423", Assert.Single(RatchetFailures(shadowedBoth, Rows((shadowedAbove, VerdictClass.Ice, "#2432 ice"), (shadowed, VerdictClass.SilentWrong, "#2432 missing-refusal"))))); + // A member read through `self` that dies of CS0176 is #2147's; dying of anything else it is the position's own. + var throughSelf = pool.First(c => Constant(c) && c.Cell.Tag == SharpyTag.MustRun && c.Cell.Key!.Part() == Harness.Spelling.SelfDot); + Assert.Empty(RatchetFailures(new[] { Of(throughSelf, Ice(StaticThroughInstanceCs)) }, Rows((throughSelf, VerdictClass.Ice, "#2147 ice")))); + Assert.Contains("the route says '#2147", Assert.Single(RatchetFailures(new[] { Of(throughSelf, Ice(StaticThroughInstanceCs)) }, Rows((throughSelf, VerdictClass.Ice, "#2432 ice"))))); + Assert.Contains("the route says '#2432", Assert.Single(RatchetFailures(new[] { Of(throughSelf, Ice("CS1736")) }, Rows((throughSelf, VerdictClass.Ice, "#2147 ice"))))); + // A bare sibling read red BELOW its member alone is the class-body rule's order (#2423); red above it too, no order + // cures it and it is the position's own (#2432). + var below = pool.First(c => Constant(c) && c.Cell.Tag == SharpyTag.MustRun && c.Cell.Rule != "N2" && SiblingAboveTwinId(c.Cell) != null); + var aboveTwin = pool.Single(c => c.Cell.Id == SiblingAboveTwinId(below.Cell)); + Assert.Equal(SharpyTag.MustRun, aboveTwin.Cell.Tag); + var belowOnly = new[] { Of(aboveTwin, Ran(aboveTwin.Cell.Model)), Of(below, Refused("SPY0200")) }; + Assert.Empty(RatchetFailures(belowOnly, Rows((below, VerdictClass.FalseRefusal, "#2423 false-refusal")))); + Assert.Contains("the route says '#2423", Assert.Single(RatchetFailures(belowOnly, Rows((below, VerdictClass.FalseRefusal, "#2432 false-refusal"))))); + var atBoth = new[] { Of(aboveTwin, Refused("SPY0425")), Of(below, Refused("SPY0425")) }; + Assert.Empty(RatchetFailures(atBoth, Rows((aboveTwin, VerdictClass.FalseRefusal, "#2432 false-refusal"), (below, VerdictClass.FalseRefusal, "#2432 false-refusal")))); + Assert.Contains("the route says '#2432", Assert.Single(RatchetFailures(atBoth, Rows((aboveTwin, VerdictClass.FalseRefusal, "#2432 false-refusal"), (below, VerdictClass.FalseRefusal, "#2423 false-refusal"))))); } } diff --git a/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt b/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt index 6cac55779..2ed58ccb2 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt +++ b/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt @@ -226,17 +226,36 @@ MustRun N1 family=Read route=no-initializer initializer=Present,AccessorBodies MustRefuse N1-typed-read family=Read route=typed-read MustRun N1-innermost family=Local route=callee MustRun N4 family=Read route=constant-kind constantKind=ClrLiteralField,ClrTypeLiteralField,ClrTypeEnumMember,IntEnumMember,IntEnumValue,ComparisonChain -MustRun N4 family=Read route=constant-kind constantKind=OwnMember target=ModuleLiteralConst,ClassLiteralConst -MustRun N4 family=Read route=constant-kind admission=ConstInitializer constantKind=StdlibModuleVariable,ClrStaticMember,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink -MustRun N4 family=Read route=constant-kind admission=ConstInitializer constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin -MustRun #1938 family=Read route=constant-kind mark=struct-auto-property constantKind=StdlibModuleVariable,ClrStaticMember,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink -MustRun #1938 family=Read route=constant-kind mark=struct-auto-property constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin -MustRefuse SPY0401 family=Read route=constant-kind admission=ParameterDefault,LambdaParameterDefault,PerInstanceFieldDefault,- mark=def,lambda,dataclass,struct,enum-member constantKind=StdlibModuleVariable,ClrStaticMember,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink -MustRefuse SPY0401 family=Read route=constant-kind admission=ParameterDefault,LambdaParameterDefault,PerInstanceFieldDefault,- mark=def,lambda,dataclass,struct,enum-member constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin -MustRefuse SPY0425 family=Read route=constant-kind admission=DecoratorArgument constantKind=StdlibModuleVariable,ClrStaticMember,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink -MustRefuse SPY0425 family=Read route=constant-kind admission=DecoratorArgument constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin -MustRefuse kind:SPY0290 family=Read route=constant-kind constantKind=OwnMember target=InstanceField,InstanceProperty,InstanceMethod +MustRun N4 family=Read route=constant-kind admission=ConstInitializer constantKind=StdlibModuleVariable,ClrStaticMember,ModuleFunction,ModuleFunctionGroup,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,ClrTypeDeclinedMethod,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink +MustRun #1938 family=Read route=constant-kind mark=struct-auto-property constantKind=StdlibModuleVariable,ClrStaticMember,ModuleFunction,ModuleFunctionGroup,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,ClrTypeDeclinedMethod,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink +MustRefuse SPY0401 family=Read route=constant-kind admission=ParameterDefault,LambdaParameterDefault,PerInstanceFieldDefault,- mark=def,lambda,dataclass,struct,enum-member constantKind=StdlibModuleVariable,ClrStaticMember,ModuleFunction,ModuleFunctionGroup,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,ClrTypeDeclinedMethod,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink +MustRefuse SPY0425 family=Read route=constant-kind admission=DecoratorArgument constantKind=StdlibModuleVariable,ClrStaticMember,ModuleFunction,ModuleFunctionGroup,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,ClrTypeDeclinedMethod,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink MustRefuse kind:SPY0336 family=Read route=constant-kind constantKind=ClrTypeMethodGroup +# A name of the program's own, under every spelling and from every placement but a bare sibling read: one answer (N7). +MustRun N4 family=Read route=constant-kind constantKind=OwnMember target=ModuleLiteralConst,ClassLiteralConst mark!=bare-sibling +MustRun N4 family=Read route=constant-kind admission=ConstInitializer constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin mark!=bare-sibling +MustRun #1938 family=Read route=constant-kind mark=struct-auto-property constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin mark!=bare-sibling +MustRefuse SPY0401 family=Read route=constant-kind admission=ParameterDefault,LambdaParameterDefault,PerInstanceFieldDefault,- mark=def,lambda,dataclass,struct,enum-member constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin mark!=bare-sibling +MustRefuse SPY0425 family=Read route=constant-kind admission=DecoratorArgument constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin mark!=bare-sibling +MustRefuse kind:SPY0290 family=Read route=constant-kind constantKind=OwnMember target=InstanceField,InstanceProperty,InstanceMethod spelling!=SelfDot +MustRun N4 family=Read route=constant-kind admission=ConstInitializer constantKind=OwnMember target=InstanceField,InstanceProperty,InstanceMethod spelling=SelfDot +MustRefuse SPY0401 family=Read route=constant-kind admission=LambdaParameterDefault constantKind=OwnMember target=InstanceField,InstanceProperty,InstanceMethod spelling=SelfDot +# A bare read of a sibling in the member's own type is the class-body rule's first (D3): in a method's body the member is not +# visible (N1) and the read is the module's binding (R-Y); at the type body's level it is the member, earlier or with no module +# binding of the name, and N2's refusal at-or-after under one. Where it is the member, the constant position then answers. +MustRefuse N1-methods family=Read route=constant-kind constantKind=OwnMember mark=bare-sibling mark=in-method outer=None +MustRun R-Y family=Read route=constant-kind constantKind=OwnMember mark=bare-sibling mark=in-method outer!=None +MustRefuse N2 family=Read route=constant-kind constantKind=OwnMember mark=bare-sibling mark!=in-method order=Later outer!=None +MustRun N1 family=Read route=constant-kind constantKind=OwnMember target=ModuleLiteralConst,ClassLiteralConst mark=bare-sibling mark!=in-method order=Earlier +MustRun N4 family=Read route=constant-kind admission=ConstInitializer constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin mark=bare-sibling mark!=in-method order=Earlier +MustRun #1938 family=Read route=constant-kind mark=struct-auto-property constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin mark=bare-sibling mark!=in-method order=Earlier +MustRefuse SPY0401 family=Read route=constant-kind admission=ParameterDefault,LambdaParameterDefault,PerInstanceFieldDefault,- mark=def,lambda,dataclass,struct,enum-member constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin mark=bare-sibling mark!=in-method order=Earlier +MustRefuse SPY0425 family=Read route=constant-kind admission=DecoratorArgument constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin mark=bare-sibling mark!=in-method order=Earlier +MustRun N1+N3 family=Read route=constant-kind constantKind=OwnMember target=ModuleLiteralConst,ClassLiteralConst mark=bare-sibling mark!=in-method order=Later outer=None +MustRun N4 family=Read route=constant-kind admission=ConstInitializer constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin mark=bare-sibling mark!=in-method order=Later outer=None +MustRun #1938 family=Read route=constant-kind mark=struct-auto-property constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin mark=bare-sibling mark!=in-method order=Later outer=None +MustRefuse SPY0401 family=Read route=constant-kind admission=ParameterDefault,LambdaParameterDefault,PerInstanceFieldDefault,- mark=def,lambda,dataclass,struct,enum-member constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin mark=bare-sibling mark!=in-method order=Later outer=None +MustRefuse SPY0425 family=Read route=constant-kind admission=DecoratorArgument constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin mark=bare-sibling mark!=in-method order=Later outer=None MustRun N1 family=Read route=init-overload MustRefuse N1-alias-target family=Read route=alias-target aliasTarget=Missing MustRun N1 family=Read route=alias-target aliasTarget=Declared diff --git a/src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt b/src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt index 738cb8b47..2edb16e29 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt +++ b/src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt @@ -1,8 +1,10 @@ # Known-red cells of ScopeMeaningDifferentialTests (stage 0 of plan-777361, P78; verification contract §11). # ` # # `: the issue is the one whose fix turns the # cell green, by the cell's class (ScopeMeaningDifferentialTests.ProposedCite): its route's issue, except a typed read -# that is red at the EARLIER order too, which no order cures and is #2417's with its later twin, and an alias whose -# target reaches the alias itself, which is #2769's. A row whose cell passes fails the test until it is deleted. +# that is red at the EARLIER order too, which no order cures and is #2417's with its later twin; an alias whose +# target reaches the alias itself, which is #2769's; and, in a constant position, N2's refusal and a bare sibling read +# that is red BELOW its member alone, which are the class-body rule's (#2423), and a member read through `self` that +# dies of CS0176, which is #2147's. A row whose cell passes fails the test until it is deleted. # `wrong-code` is a must-refuse cell refused under a code its cell does not admit. The sweep writes the rows it would # list to .claude/tmp/scope-meaning-differential-proposed-allowlist.txt. local/callee/Comprehension/outer=ImportedName Ice # #2423 ice @@ -115,222 +117,776 @@ read/alias-target/Missing/Unused/Earlier/struct/optional SilentWrong # #2423 mis read/alias-target/Missing/Unused/Earlier/struct/result-error SilentWrong # #2423 missing-refusal read/alias-target/Missing/Unused/Earlier/struct/tuple-element SilentWrong # #2423 missing-refusal read/alias-target/Missing/Unused/Earlier/struct/type-argument SilentWrong # #2423 missing-refusal -read/constant-kind/ConstInitializer/block-const/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice -read/constant-kind/ConstInitializer/block-const/IntEnumName/name Ice # #2432 ice -read/constant-kind/ConstInitializer/block-const/StdlibModuleVariable/math.pi Ice # #2432 ice -read/constant-kind/ConstInitializer/block-const/StringEnumMember/member Ice # #2432 ice -read/constant-kind/ConstInitializer/block-const/StringEnumName/name Ice # #2432 ice -read/constant-kind/ConstInitializer/block-const/StringEnumValue/EnumValue/value Ice # #2432 ice -read/constant-kind/ConstInitializer/class-const/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice -read/constant-kind/ConstInitializer/class-const/IntEnumName/name Ice # #2432 ice -read/constant-kind/ConstInitializer/class-const/StdlibModuleVariable/math.pi Ice # #2432 ice -read/constant-kind/ConstInitializer/class-const/StringEnumMember/member Ice # #2432 ice -read/constant-kind/ConstInitializer/class-const/StringEnumName/name Ice # #2432 ice -read/constant-kind/ConstInitializer/class-const/StringEnumValue/EnumValue/value Ice # #2432 ice -read/constant-kind/ConstInitializer/interface-const/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice -read/constant-kind/ConstInitializer/interface-const/IntEnumName/name Ice # #2432 ice -read/constant-kind/ConstInitializer/interface-const/StdlibModuleVariable/math.pi Ice # #2432 ice -read/constant-kind/ConstInitializer/interface-const/StringEnumMember/member Ice # #2432 ice -read/constant-kind/ConstInitializer/interface-const/StringEnumName/name Ice # #2432 ice -read/constant-kind/ConstInitializer/interface-const/StringEnumValue/EnumValue/value Ice # #2432 ice -read/constant-kind/ConstInitializer/local-const/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice -read/constant-kind/ConstInitializer/local-const/IntEnumName/name Ice # #2432 ice -read/constant-kind/ConstInitializer/local-const/StdlibModuleVariable/math.pi Ice # #2432 ice -read/constant-kind/ConstInitializer/local-const/StringEnumMember/member Ice # #2432 ice -read/constant-kind/ConstInitializer/local-const/StringEnumName/name Ice # #2432 ice -read/constant-kind/ConstInitializer/local-const/StringEnumValue/EnumValue/value Ice # #2432 ice -read/constant-kind/ConstInitializer/module-const/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice -read/constant-kind/ConstInitializer/module-const/IntEnumName/name Ice # #2432 ice -read/constant-kind/ConstInitializer/module-const/StdlibModuleVariable/math.pi Ice # #2432 ice -read/constant-kind/ConstInitializer/module-const/StringEnumMember/member Ice # #2432 ice -read/constant-kind/ConstInitializer/module-const/StringEnumName/name Ice # #2432 ice -read/constant-kind/ConstInitializer/module-const/StringEnumValue/EnumValue/value Ice # #2432 ice -read/constant-kind/ConstInitializer/struct-const/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice -read/constant-kind/ConstInitializer/struct-const/IntEnumName/name Ice # #2432 ice -read/constant-kind/ConstInitializer/struct-const/StdlibModuleVariable/math.pi Ice # #2432 ice -read/constant-kind/ConstInitializer/struct-const/StringEnumMember/member Ice # #2432 ice -read/constant-kind/ConstInitializer/struct-const/StringEnumName/name Ice # #2432 ice -read/constant-kind/ConstInitializer/struct-const/StringEnumValue/EnumValue/value Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/ClrLiteralField/from-subprocess-import-PIPE FalseRefusal # #2432 false-refusal -read/constant-kind/DecoratorArgument/attribute-keyword/ClrLiteralField/subprocess.PIPE Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/ClrStaticMember/sys.maxsize Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeLiteralField/int.max_value Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeLiteralField/system.Int32.max_value Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeMethod/Value/Math.sqrt Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeMethodGroup/Value/Math.abs Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticProperty/Array.max_length Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/ClrTypeStaticField/BitConverter.is_little_endian/import Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/IntEnumName/name/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/OwnMember/ClassComputedConst/Annotated/SelfDot/Self/in-method Ice # #2147 ice +read/constant-kind/ConstInitializer/block-const/OwnMember/ClassComputedConst/Inferred/SelfDot/Self/in-method Ice # #2147 ice +read/constant-kind/ConstInitializer/block-const/OwnMember/ClassLiteralConst/Annotated/SelfDot/Self/in-method Ice # #2147 ice +read/constant-kind/ConstInitializer/block-const/OwnMember/ClassLiteralConst/Inferred/SelfDot/Self/in-method Ice # #2147 ice +read/constant-kind/ConstInitializer/block-const/OwnMember/StaticMethod/Annotated/SelfDot/Self/Value/in-method Ice # #2147 ice +read/constant-kind/ConstInitializer/block-const/OwnMember/StaticProperty/Annotated/SelfDot/Self/in-method Ice # #2147 ice +read/constant-kind/ConstInitializer/block-const/StdlibModuleVariable/math.pi/import Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/StdlibModuleVariable/math.pi/import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/StringEnumMember/member/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/StringEnumMember/member/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/StringEnumName/name/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/StringEnumName/name/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/StringEnumValue/EnumValue/value/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/StringEnumValue/EnumValue/value/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/ClrTypeStaticField/BitConverter.is_little_endian/import Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/IntEnumName/name/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/OwnMember/ClassComputedConst/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/ConstInitializer/class-const/OwnMember/ClassComputedConst/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/ConstInitializer/class-const/OwnMember/ClassLiteralConst/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ConstInitializer/class-const/OwnMember/ClassLiteralConst/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ConstInitializer/class-const/OwnMember/StaticField/Annotated/Bare/Self/Earlier/outer=ModuleLiteralConst/bare-sibling Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/OwnMember/StaticField/Annotated/Bare/Self/Later/bare-sibling FalseRefusal # #2423 false-refusal +read/constant-kind/ConstInitializer/class-const/OwnMember/StaticField/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ConstInitializer/class-const/OwnMember/StaticField/Inferred/Bare/Self/Earlier/outer=ModuleLiteralConst/bare-sibling Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/OwnMember/StaticField/Inferred/Bare/Self/Later/bare-sibling FalseRefusal # #2423 false-refusal +read/constant-kind/ConstInitializer/class-const/OwnMember/StaticField/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ConstInitializer/class-const/OwnMember/StaticMethod/Annotated/Bare/Self/Later/Value/bare-sibling FalseRefusal # #2423 false-refusal +read/constant-kind/ConstInitializer/class-const/OwnMember/StaticMethod/Annotated/Bare/Self/Later/outer=ModuleDef/Value/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ConstInitializer/class-const/OwnMember/StaticProperty/Annotated/Bare/Self/Earlier/outer=ModuleLiteralConst/bare-sibling Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/OwnMember/StaticProperty/Annotated/Bare/Self/Later/bare-sibling FalseRefusal # #2423 false-refusal +read/constant-kind/ConstInitializer/class-const/OwnMember/StaticProperty/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ConstInitializer/class-const/StdlibModuleVariable/math.pi/import Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/StdlibModuleVariable/math.pi/import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/StringEnumMember/member/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/StringEnumMember/member/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/StringEnumName/name/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/StringEnumName/name/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/StringEnumValue/EnumValue/value/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/StringEnumValue/EnumValue/value/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/ClrTypeStaticField/BitConverter.is_little_endian/import Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/IntEnumName/name/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/OwnMember/ClassComputedConst/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/ConstInitializer/interface-const/OwnMember/ClassComputedConst/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/ConstInitializer/interface-const/OwnMember/ClassLiteralConst/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ConstInitializer/interface-const/OwnMember/ClassLiteralConst/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ConstInitializer/interface-const/StdlibModuleVariable/math.pi/import Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/StdlibModuleVariable/math.pi/import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/StringEnumMember/member/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/StringEnumMember/member/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/StringEnumName/name/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/StringEnumName/name/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/StringEnumValue/EnumValue/value/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/StringEnumValue/EnumValue/value/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/ClrTypeStaticField/BitConverter.is_little_endian/import Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/IntEnumName/name/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/OwnMember/ClassComputedConst/Annotated/SelfDot/Self/in-method Ice # #2147 ice +read/constant-kind/ConstInitializer/local-const/OwnMember/ClassComputedConst/Inferred/SelfDot/Self/in-method Ice # #2147 ice +read/constant-kind/ConstInitializer/local-const/OwnMember/ClassLiteralConst/Annotated/SelfDot/Self/in-method Ice # #2147 ice +read/constant-kind/ConstInitializer/local-const/OwnMember/ClassLiteralConst/Inferred/SelfDot/Self/in-method Ice # #2147 ice +read/constant-kind/ConstInitializer/local-const/OwnMember/StaticMethod/Annotated/SelfDot/Self/Value/in-method Ice # #2147 ice +read/constant-kind/ConstInitializer/local-const/OwnMember/StaticProperty/Annotated/SelfDot/Self/in-method Ice # #2147 ice +read/constant-kind/ConstInitializer/local-const/StdlibModuleVariable/math.pi/import Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/StdlibModuleVariable/math.pi/import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/StringEnumMember/member/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/StringEnumMember/member/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/StringEnumName/name/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/StringEnumName/name/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/StringEnumValue/EnumValue/value/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/StringEnumValue/EnumValue/value/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/ClrTypeStaticField/BitConverter.is_little_endian/import Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/IntEnumName/name/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/StdlibModuleVariable/math.pi/import Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/StdlibModuleVariable/math.pi/import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/StringEnumMember/member/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/StringEnumMember/member/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/StringEnumName/name/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/StringEnumName/name/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/StringEnumValue/EnumValue/value/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/StringEnumValue/EnumValue/value/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/ClrTypeStaticField/BitConverter.is_little_endian/import Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/IntEnumName/name/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/OwnMember/ClassComputedConst/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/ConstInitializer/struct-const/OwnMember/ClassComputedConst/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/ConstInitializer/struct-const/OwnMember/ClassLiteralConst/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ConstInitializer/struct-const/OwnMember/ClassLiteralConst/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ConstInitializer/struct-const/OwnMember/StaticField/Annotated/Bare/Self/Earlier/outer=ModuleLiteralConst/bare-sibling Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/OwnMember/StaticField/Annotated/Bare/Self/Later/bare-sibling FalseRefusal # #2423 false-refusal +read/constant-kind/ConstInitializer/struct-const/OwnMember/StaticField/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ConstInitializer/struct-const/OwnMember/StaticField/Inferred/Bare/Self/Earlier/outer=ModuleLiteralConst/bare-sibling Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/OwnMember/StaticField/Inferred/Bare/Self/Later/bare-sibling FalseRefusal # #2423 false-refusal +read/constant-kind/ConstInitializer/struct-const/OwnMember/StaticField/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ConstInitializer/struct-const/OwnMember/StaticMethod/Annotated/Bare/Self/Later/Value/bare-sibling FalseRefusal # #2423 false-refusal +read/constant-kind/ConstInitializer/struct-const/OwnMember/StaticMethod/Annotated/Bare/Self/Later/outer=ModuleDef/Value/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ConstInitializer/struct-const/OwnMember/StaticProperty/Annotated/Bare/Self/Earlier/outer=ModuleLiteralConst/bare-sibling Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/OwnMember/StaticProperty/Annotated/Bare/Self/Later/bare-sibling FalseRefusal # #2423 false-refusal +read/constant-kind/ConstInitializer/struct-const/OwnMember/StaticProperty/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ConstInitializer/struct-const/StdlibModuleVariable/math.pi/import Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/StdlibModuleVariable/math.pi/import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/StringEnumMember/member/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/StringEnumMember/member/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/StringEnumName/name/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/StringEnumName/name/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/StringEnumValue/EnumValue/value/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/StringEnumValue/EnumValue/value/type-name Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrLiteralField/subprocess.PIPE/from-import FalseRefusal # #2432 false-refusal +read/constant-kind/DecoratorArgument/attribute-keyword/ClrLiteralField/subprocess.PIPE/from-import-as FalseRefusal # #2432 false-refusal +read/constant-kind/DecoratorArgument/attribute-keyword/ClrLiteralField/subprocess.PIPE/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrLiteralField/subprocess.PIPE/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrLiteralField/subprocess.PIPE/star-import FalseRefusal # #2432 false-refusal +read/constant-kind/DecoratorArgument/attribute-keyword/ClrStaticMember/sys.maxsize/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrStaticMember/sys.maxsize/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/from-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/from-import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/star-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeEnumMember/DayOfWeek.Monday/from-import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeEnumMember/DayOfWeek.Monday/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeEnumMember/DayOfWeek.Monday/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeEnumMember/DayOfWeek.Monday/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeLiteralField/Int32.max_value/builtin-name Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeLiteralField/Int32.max_value/from-import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeLiteralField/Int32.max_value/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeLiteralField/Int32.max_value/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeLiteralField/Int32.max_value/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeLiteralField/Math.PI/from-import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeLiteralField/Math.PI/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeLiteralField/Math.PI/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeLiteralField/Math.PI/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeMethod/Value/Math.sqrt/from-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeMethod/Value/Math.sqrt/from-import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeMethod/Value/Math.sqrt/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeMethod/Value/Math.sqrt/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeMethod/Value/Math.sqrt/star-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeMethod/Value/Math.sqrt/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeMethodGroup/Value/Math.abs/from-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeMethodGroup/Value/Math.abs/from-import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeMethodGroup/Value/Math.abs/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeMethodGroup/Value/Math.abs/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeMethodGroup/Value/Math.abs/star-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeMethodGroup/Value/Math.abs/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticField/BitConverter.is_little_endian/from-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticField/BitConverter.is_little_endian/from-import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticField/BitConverter.is_little_endian/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticProperty/Array.max_length/from-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticProperty/Array.max_length/from-import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticProperty/Array.max_length/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticProperty/Array.max_length/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticProperty/Array.max_length/star-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticProperty/Array.max_length/type-alias Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute-keyword/ComparisonChain/ordered FalseRefusal # #2432 false-refusal -read/constant-kind/DecoratorArgument/attribute-keyword/IntEnumName/name Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/IntEnumValue/EnumValue/value Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassComputedConst/Annotated Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassComputedConst/Annotated/Base Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassComputedConst/Inferred Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassComputedConst/Inferred/Base Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceField/Annotated Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceField/Annotated/Base Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceField/Inferred Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceField/Inferred/Base Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceMethod/Annotated/Base/Value Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceMethod/Annotated/Value Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceProperty/Annotated Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceProperty/Annotated/Base Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ModuleLiteralConst/Annotated Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ModuleLiteralConst/Inferred Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticField/Annotated Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticField/Annotated/Base Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticField/Inferred Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticField/Inferred/Base Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticMethod/Annotated/Base/Value Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticMethod/Annotated/Value Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticProperty/Annotated Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticProperty/Annotated/Base Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/StdlibModuleVariable/math.pi Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/StringEnumMember/member Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/StringEnumName/name Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute-keyword/StringEnumValue/EnumValue/value Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/ClrLiteralField/from-subprocess-import-PIPE FalseRefusal # #2432 false-refusal -read/constant-kind/DecoratorArgument/attribute/ClrLiteralField/subprocess.PIPE Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/ClrStaticMember/sys.maxsize Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/ClrTypeLiteralField/int.max_value Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/ClrTypeLiteralField/system.Int32.max_value Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/ClrTypeMethod/Value/Math.sqrt Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/ClrTypeMethodGroup/Value/Math.abs Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticProperty/Array.max_length Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/IntEnumMember/member/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/IntEnumName/name/type-name Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/IntEnumValue/EnumValue/value/type-name Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ModuleFunction/Value/math.sqrt/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ModuleFunction/Value/math.sqrt/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ModuleFunctionGroup/Value/math.log/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ModuleFunctionGroup/Value/math.log/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassComputedConst/Annotated/Alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassComputedConst/Annotated/Alias/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassComputedConst/Annotated/Bare/Self/Earlier/outer=ModuleLiteralConst/bare-sibling Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassComputedConst/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling Ice # #2423 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassComputedConst/Annotated/Qualified Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassComputedConst/Annotated/Qualified/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassComputedConst/Annotated/Qualified/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassComputedConst/Inferred/Alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassComputedConst/Inferred/Alias/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassComputedConst/Inferred/Bare/Self/Earlier/outer=ModuleLiteralConst/bare-sibling Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassComputedConst/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling Ice # #2423 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassComputedConst/Inferred/Qualified Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassComputedConst/Inferred/Qualified/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassComputedConst/Inferred/Qualified/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassLiteralConst/Annotated/Alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassLiteralConst/Annotated/Alias/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassLiteralConst/Annotated/Bare/Self/Earlier/bare-sibling FalseRefusal # #2432 false-refusal +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassLiteralConst/Annotated/Bare/Self/Later/bare-sibling FalseRefusal # #2432 false-refusal +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassLiteralConst/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassLiteralConst/Inferred/Alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassLiteralConst/Inferred/Alias/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassLiteralConst/Inferred/Bare/Self/Earlier/bare-sibling FalseRefusal # #2432 false-refusal +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassLiteralConst/Inferred/Bare/Self/Later/bare-sibling FalseRefusal # #2432 false-refusal +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ClassLiteralConst/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceField/Annotated/Alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceField/Annotated/Qualified Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceField/Annotated/Qualified/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceField/Inferred/Alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceField/Inferred/Qualified Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceField/Inferred/Qualified/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceMethod/Annotated/Alias/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceMethod/Annotated/Qualified/Base/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceMethod/Annotated/Qualified/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceProperty/Annotated/Alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceProperty/Annotated/Qualified Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/InstanceProperty/Annotated/Qualified/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ModuleLiteralConst/Annotated/Bare Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/ModuleLiteralConst/Inferred/Bare Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticField/Annotated/Alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticField/Annotated/Alias/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticField/Annotated/Bare/Self/Earlier/outer=ModuleLiteralConst/bare-sibling Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticField/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling Ice # #2423 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticField/Annotated/Qualified Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticField/Annotated/Qualified/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticField/Annotated/Qualified/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticField/Inferred/Alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticField/Inferred/Alias/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticField/Inferred/Bare/Self/Earlier/outer=ModuleLiteralConst/bare-sibling Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticField/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling Ice # #2423 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticField/Inferred/Qualified Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticField/Inferred/Qualified/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticField/Inferred/Qualified/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticMethod/Annotated/Alias/Self/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticMethod/Annotated/Alias/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticMethod/Annotated/Bare/Self/Later/outer=ModuleDef/Value/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticMethod/Annotated/Qualified/Base/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticMethod/Annotated/Qualified/Self/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticMethod/Annotated/Qualified/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticProperty/Annotated/Alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticProperty/Annotated/Alias/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticProperty/Annotated/Bare/Self/Earlier/outer=ModuleLiteralConst/bare-sibling Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticProperty/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling Ice # #2423 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticProperty/Annotated/Qualified Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticProperty/Annotated/Qualified/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/OwnMember/StaticProperty/Annotated/Qualified/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/StdlibModuleVariable/math.pi/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/StdlibModuleVariable/math.pi/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/StdlibModuleVariable/socket.AF_INET/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/StdlibModuleVariable/socket.AF_INET/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/StringEnumMember/member/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/StringEnumMember/member/type-name Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/StringEnumName/name/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/StringEnumName/name/type-name Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/StringEnumValue/EnumValue/value/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/StringEnumValue/EnumValue/value/type-name Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrLiteralField/subprocess.PIPE/from-import FalseRefusal # #2432 false-refusal +read/constant-kind/DecoratorArgument/attribute/ClrLiteralField/subprocess.PIPE/from-import-as FalseRefusal # #2432 false-refusal +read/constant-kind/DecoratorArgument/attribute/ClrLiteralField/subprocess.PIPE/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrLiteralField/subprocess.PIPE/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrLiteralField/subprocess.PIPE/star-import FalseRefusal # #2432 false-refusal +read/constant-kind/DecoratorArgument/attribute/ClrStaticMember/sys.maxsize/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrStaticMember/sys.maxsize/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/from-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/from-import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/star-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeEnumMember/DayOfWeek.Monday/from-import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeEnumMember/DayOfWeek.Monday/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeEnumMember/DayOfWeek.Monday/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeEnumMember/DayOfWeek.Monday/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeLiteralField/Int32.max_value/builtin-name Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeLiteralField/Int32.max_value/from-import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeLiteralField/Int32.max_value/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeLiteralField/Int32.max_value/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeLiteralField/Int32.max_value/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeLiteralField/Math.PI/from-import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeLiteralField/Math.PI/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeLiteralField/Math.PI/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeLiteralField/Math.PI/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeMethod/Value/Math.sqrt/from-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeMethod/Value/Math.sqrt/from-import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeMethod/Value/Math.sqrt/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeMethod/Value/Math.sqrt/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeMethod/Value/Math.sqrt/star-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeMethod/Value/Math.sqrt/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeMethodGroup/Value/Math.abs/from-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeMethodGroup/Value/Math.abs/from-import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeMethodGroup/Value/Math.abs/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeMethodGroup/Value/Math.abs/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeMethodGroup/Value/Math.abs/star-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeMethodGroup/Value/Math.abs/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticField/BitConverter.is_little_endian/from-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticField/BitConverter.is_little_endian/from-import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticField/BitConverter.is_little_endian/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticProperty/Array.max_length/from-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticProperty/Array.max_length/from-import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticProperty/Array.max_length/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticProperty/Array.max_length/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticProperty/Array.max_length/star-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticProperty/Array.max_length/type-alias Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute/ComparisonChain/ordered FalseRefusal # #2432 false-refusal -read/constant-kind/DecoratorArgument/attribute/IntEnumName/name Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/IntEnumValue/EnumValue/value Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassComputedConst/Annotated Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassComputedConst/Annotated/Base Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassComputedConst/Inferred Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassComputedConst/Inferred/Base Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceField/Annotated Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceField/Annotated/Base Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceField/Inferred Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceField/Inferred/Base Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceMethod/Annotated/Base/Value Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceMethod/Annotated/Value Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceProperty/Annotated Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceProperty/Annotated/Base Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/OwnMember/ModuleLiteralConst/Annotated Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/OwnMember/ModuleLiteralConst/Inferred Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticField/Annotated Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticField/Annotated/Base Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticField/Inferred Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticField/Inferred/Base Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticMethod/Annotated/Base/Value Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticMethod/Annotated/Value Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticProperty/Annotated Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticProperty/Annotated/Base Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/StdlibModuleVariable/math.pi Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/StringEnumMember/member Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/StringEnumName/name Ice # #2432 ice -read/constant-kind/DecoratorArgument/attribute/StringEnumValue/EnumValue/value Ice # #2432 ice -read/constant-kind/LambdaParameterDefault/lambda/ClrLiteralField/from-subprocess-import-PIPE FalseRefusal # #2432 false-refusal -read/constant-kind/LambdaParameterDefault/lambda/ClrStaticMember/sys.maxsize Ice # #2432 ice -read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice -read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticProperty/Array.max_length Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/IntEnumMember/member/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/IntEnumName/name/type-name Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/IntEnumValue/EnumValue/value/type-name Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ModuleFunction/Value/math.sqrt/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ModuleFunction/Value/math.sqrt/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ModuleFunctionGroup/Value/math.log/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ModuleFunctionGroup/Value/math.log/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassComputedConst/Annotated/Alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassComputedConst/Annotated/Alias/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassComputedConst/Annotated/Bare/Self/Earlier/outer=ModuleLiteralConst/bare-sibling Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassComputedConst/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling Ice # #2423 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassComputedConst/Annotated/Qualified Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassComputedConst/Annotated/Qualified/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassComputedConst/Annotated/Qualified/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassComputedConst/Inferred/Alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassComputedConst/Inferred/Alias/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassComputedConst/Inferred/Bare/Self/Earlier/outer=ModuleLiteralConst/bare-sibling Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassComputedConst/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling Ice # #2423 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassComputedConst/Inferred/Qualified Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassComputedConst/Inferred/Qualified/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassComputedConst/Inferred/Qualified/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassLiteralConst/Annotated/Alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassLiteralConst/Annotated/Alias/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassLiteralConst/Annotated/Bare/Self/Earlier/bare-sibling FalseRefusal # #2432 false-refusal +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassLiteralConst/Annotated/Bare/Self/Later/bare-sibling FalseRefusal # #2432 false-refusal +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassLiteralConst/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassLiteralConst/Inferred/Alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassLiteralConst/Inferred/Alias/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassLiteralConst/Inferred/Bare/Self/Earlier/bare-sibling FalseRefusal # #2432 false-refusal +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassLiteralConst/Inferred/Bare/Self/Later/bare-sibling FalseRefusal # #2432 false-refusal +read/constant-kind/DecoratorArgument/attribute/OwnMember/ClassLiteralConst/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceField/Annotated/Alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceField/Annotated/Qualified Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceField/Annotated/Qualified/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceField/Inferred/Alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceField/Inferred/Qualified Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceField/Inferred/Qualified/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceMethod/Annotated/Alias/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceMethod/Annotated/Qualified/Base/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceMethod/Annotated/Qualified/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceProperty/Annotated/Alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceProperty/Annotated/Qualified Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/InstanceProperty/Annotated/Qualified/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ModuleLiteralConst/Annotated/Bare Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/ModuleLiteralConst/Inferred/Bare Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticField/Annotated/Alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticField/Annotated/Alias/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticField/Annotated/Bare/Self/Earlier/outer=ModuleLiteralConst/bare-sibling Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticField/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling Ice # #2423 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticField/Annotated/Qualified Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticField/Annotated/Qualified/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticField/Annotated/Qualified/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticField/Inferred/Alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticField/Inferred/Alias/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticField/Inferred/Bare/Self/Earlier/outer=ModuleLiteralConst/bare-sibling Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticField/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling Ice # #2423 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticField/Inferred/Qualified Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticField/Inferred/Qualified/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticField/Inferred/Qualified/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticMethod/Annotated/Alias/Self/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticMethod/Annotated/Alias/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticMethod/Annotated/Bare/Self/Later/outer=ModuleDef/Value/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticMethod/Annotated/Qualified/Base/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticMethod/Annotated/Qualified/Self/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticMethod/Annotated/Qualified/Value Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticProperty/Annotated/Alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticProperty/Annotated/Alias/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticProperty/Annotated/Bare/Self/Earlier/outer=ModuleLiteralConst/bare-sibling Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticProperty/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling Ice # #2423 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticProperty/Annotated/Qualified Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticProperty/Annotated/Qualified/Base Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/OwnMember/StaticProperty/Annotated/Qualified/Self Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/StdlibModuleVariable/math.pi/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/StdlibModuleVariable/math.pi/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/StdlibModuleVariable/socket.AF_INET/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/StdlibModuleVariable/socket.AF_INET/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/StringEnumMember/member/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/StringEnumMember/member/type-name Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/StringEnumName/name/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/StringEnumName/name/type-name Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/StringEnumValue/EnumValue/value/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/StringEnumValue/EnumValue/value/type-name Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrLiteralField/subprocess.PIPE/from-import FalseRefusal # #2432 false-refusal +read/constant-kind/LambdaParameterDefault/lambda/ClrLiteralField/subprocess.PIPE/from-import-as FalseRefusal # #2432 false-refusal +read/constant-kind/LambdaParameterDefault/lambda/ClrLiteralField/subprocess.PIPE/star-import FalseRefusal # #2432 false-refusal +read/constant-kind/LambdaParameterDefault/lambda/ClrStaticMember/sys.maxsize/import Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrStaticMember/sys.maxsize/import-as Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/from-import Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/from-import-as Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/import Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/import-as Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/star-import Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/type-alias Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticField/BitConverter.is_little_endian/from-import Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticField/BitConverter.is_little_endian/from-import-as Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticField/BitConverter.is_little_endian/import Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticProperty/Array.max_length/from-import Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticProperty/Array.max_length/from-import-as Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticProperty/Array.max_length/import Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticProperty/Array.max_length/import-as Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticProperty/Array.max_length/star-import Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticProperty/Array.max_length/type-alias Ice # #2432 ice read/constant-kind/LambdaParameterDefault/lambda/ComparisonChain/ordered FalseRefusal # #2432 false-refusal -read/constant-kind/LambdaParameterDefault/lambda/IntEnumName/name Ice # #2432 ice -read/constant-kind/LambdaParameterDefault/lambda/OwnMember/StaticProperty/Annotated Ice # #2432 ice -read/constant-kind/LambdaParameterDefault/lambda/OwnMember/StaticProperty/Annotated/Base Ice # #2432 ice -read/constant-kind/LambdaParameterDefault/lambda/StdlibModuleVariable/math.pi Ice # #2432 ice -read/constant-kind/LambdaParameterDefault/lambda/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice -read/constant-kind/LambdaParameterDefault/lambda/StringEnumMember/member Ice # #2432 ice -read/constant-kind/LambdaParameterDefault/lambda/StringEnumName/name Ice # #2432 ice -read/constant-kind/LambdaParameterDefault/lambda/StringEnumValue/EnumValue/value Ice # #2432 ice -read/constant-kind/ParameterDefault/def/ClrLiteralField/from-subprocess-import-PIPE FalseRefusal # #2432 false-refusal -read/constant-kind/ParameterDefault/def/ClrStaticMember/sys.maxsize Ice # #2432 ice -read/constant-kind/ParameterDefault/def/ClrTypeMethod/Value/Math.sqrt Ice # #2432 ice -read/constant-kind/ParameterDefault/def/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice -read/constant-kind/ParameterDefault/def/ClrTypeStaticProperty/Array.max_length Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/IntEnumName/name/type-name Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/OwnMember/ClassComputedConst/Annotated/SelfDot/Self/in-method Ice # #2147 ice +read/constant-kind/LambdaParameterDefault/lambda/OwnMember/ClassComputedConst/Inferred/SelfDot/Self/in-method Ice # #2147 ice +read/constant-kind/LambdaParameterDefault/lambda/OwnMember/ClassLiteralConst/Annotated/SelfDot/Self/in-method Ice # #2147 ice +read/constant-kind/LambdaParameterDefault/lambda/OwnMember/ClassLiteralConst/Inferred/SelfDot/Self/in-method Ice # #2147 ice +read/constant-kind/LambdaParameterDefault/lambda/OwnMember/InstanceField/Annotated/SelfDot/Self/in-method Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/OwnMember/InstanceField/Inferred/SelfDot/Self/in-method Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/OwnMember/InstanceProperty/Annotated/SelfDot/Self/in-method Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/OwnMember/StaticProperty/Annotated/Alias Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/OwnMember/StaticProperty/Annotated/Alias/Self/in-method Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/OwnMember/StaticProperty/Annotated/Qualified Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/OwnMember/StaticProperty/Annotated/Qualified/Base Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/OwnMember/StaticProperty/Annotated/Qualified/Self/in-method Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/OwnMember/StaticProperty/Annotated/SelfDot/Self/in-method Ice # #2147 ice +read/constant-kind/LambdaParameterDefault/lambda/StdlibModuleVariable/math.pi/import Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/StdlibModuleVariable/math.pi/import-as Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/StdlibModuleVariable/socket.AF_INET/import Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/StdlibModuleVariable/socket.AF_INET/import-as Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/StringEnumMember/member/type-alias Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/StringEnumMember/member/type-name Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/StringEnumName/name/type-alias Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/StringEnumName/name/type-name Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/StringEnumValue/EnumValue/value/type-alias Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/StringEnumValue/EnumValue/value/type-name Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrLiteralField/subprocess.PIPE/from-import FalseRefusal # #2432 false-refusal +read/constant-kind/ParameterDefault/def/ClrLiteralField/subprocess.PIPE/from-import-as FalseRefusal # #2432 false-refusal +read/constant-kind/ParameterDefault/def/ClrLiteralField/subprocess.PIPE/star-import FalseRefusal # #2432 false-refusal +read/constant-kind/ParameterDefault/def/ClrStaticMember/sys.maxsize/import Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrStaticMember/sys.maxsize/import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/from-import Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/from-import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/import Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/star-import Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/type-alias Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeMethod/Value/Math.sqrt/from-import Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeMethod/Value/Math.sqrt/from-import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeMethod/Value/Math.sqrt/import Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeMethod/Value/Math.sqrt/import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeMethod/Value/Math.sqrt/star-import Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeMethod/Value/Math.sqrt/type-alias Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeStaticField/BitConverter.is_little_endian/from-import Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeStaticField/BitConverter.is_little_endian/from-import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeStaticField/BitConverter.is_little_endian/import Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeStaticProperty/Array.max_length/from-import Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeStaticProperty/Array.max_length/from-import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeStaticProperty/Array.max_length/import Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeStaticProperty/Array.max_length/import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeStaticProperty/Array.max_length/star-import Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeStaticProperty/Array.max_length/type-alias Ice # #2432 ice read/constant-kind/ParameterDefault/def/ComparisonChain/ordered FalseRefusal # #2432 false-refusal -read/constant-kind/ParameterDefault/def/IntEnumName/name Ice # #2432 ice -read/constant-kind/ParameterDefault/def/OwnMember/StaticMethod/Annotated/Base/Value Ice # #2432 ice -read/constant-kind/ParameterDefault/def/OwnMember/StaticMethod/Annotated/Value Ice # #2432 ice -read/constant-kind/ParameterDefault/def/OwnMember/StaticProperty/Annotated Ice # #2432 ice -read/constant-kind/ParameterDefault/def/OwnMember/StaticProperty/Annotated/Base Ice # #2432 ice -read/constant-kind/ParameterDefault/def/StdlibModuleVariable/math.pi Ice # #2432 ice -read/constant-kind/ParameterDefault/def/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice -read/constant-kind/ParameterDefault/def/StringEnumMember/member Ice # #2432 ice -read/constant-kind/ParameterDefault/def/StringEnumName/name Ice # #2432 ice -read/constant-kind/ParameterDefault/def/StringEnumValue/EnumValue/value Ice # #2432 ice -read/constant-kind/ParameterDefault/struct-auto-property/ClrStaticMember/sys.maxsize Ice # #2432 ice -read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeMethod/Value/Math.sqrt Ice # #2432 ice -read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice -read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticProperty/Array.max_length Ice # #2432 ice -read/constant-kind/ParameterDefault/struct-auto-property/IntEnumName/name Ice # #2432 ice -read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/ClassComputedConst/Annotated Ice # #2432 ice -read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/ClassComputedConst/Annotated/Base Ice # #2432 ice -read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/ClassComputedConst/Inferred Ice # #2432 ice -read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/ClassComputedConst/Inferred/Base Ice # #2432 ice -read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticField/Annotated Ice # #2432 ice -read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticField/Annotated/Base Ice # #2432 ice -read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticField/Inferred Ice # #2432 ice -read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticField/Inferred/Base Ice # #2432 ice -read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticMethod/Annotated/Base/Value Ice # #2432 ice -read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticMethod/Annotated/Value Ice # #2432 ice -read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticProperty/Annotated Ice # #2432 ice -read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticProperty/Annotated/Base Ice # #2432 ice -read/constant-kind/ParameterDefault/struct-auto-property/StdlibModuleVariable/math.pi Ice # #2432 ice -read/constant-kind/ParameterDefault/struct-auto-property/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice -read/constant-kind/ParameterDefault/struct-auto-property/StringEnumMember/member Ice # #2432 ice -read/constant-kind/ParameterDefault/struct-auto-property/StringEnumName/name Ice # #2432 ice -read/constant-kind/ParameterDefault/struct-auto-property/StringEnumValue/EnumValue/value Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/dataclass/ClrLiteralField/from-subprocess-import-PIPE FalseRefusal # #2432 false-refusal -read/constant-kind/PerInstanceFieldDefault/dataclass/ClrStaticMember/sys.maxsize Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeMethod/Value/Math.sqrt Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticProperty/Array.max_length Ice # #2432 ice +read/constant-kind/ParameterDefault/def/IntEnumName/name/type-name Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ModuleFunction/Value/math.sqrt/import Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ModuleFunction/Value/math.sqrt/import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ModuleFunctionGroup/Value/math.log/import Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ModuleFunctionGroup/Value/math.log/import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/def/OwnMember/ClassComputedConst/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/ParameterDefault/def/OwnMember/ClassComputedConst/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/ParameterDefault/def/OwnMember/ClassLiteralConst/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ParameterDefault/def/OwnMember/ClassLiteralConst/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ParameterDefault/def/OwnMember/StaticField/Annotated/Bare/Self/Later/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/ParameterDefault/def/OwnMember/StaticField/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ParameterDefault/def/OwnMember/StaticField/Inferred/Bare/Self/Later/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/ParameterDefault/def/OwnMember/StaticField/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ParameterDefault/def/OwnMember/StaticMethod/Annotated/Alias/Self/Value Ice # #2432 ice +read/constant-kind/ParameterDefault/def/OwnMember/StaticMethod/Annotated/Alias/Value Ice # #2432 ice +read/constant-kind/ParameterDefault/def/OwnMember/StaticMethod/Annotated/Bare/Self/Later/Value/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/ParameterDefault/def/OwnMember/StaticMethod/Annotated/Bare/Self/Later/outer=ModuleDef/Value/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/ParameterDefault/def/OwnMember/StaticMethod/Annotated/Qualified/Base/Value Ice # #2432 ice +read/constant-kind/ParameterDefault/def/OwnMember/StaticMethod/Annotated/Qualified/Self/Value Ice # #2432 ice +read/constant-kind/ParameterDefault/def/OwnMember/StaticMethod/Annotated/Qualified/Value Ice # #2432 ice +read/constant-kind/ParameterDefault/def/OwnMember/StaticProperty/Annotated/Alias Ice # #2432 ice +read/constant-kind/ParameterDefault/def/OwnMember/StaticProperty/Annotated/Alias/Self Ice # #2432 ice +read/constant-kind/ParameterDefault/def/OwnMember/StaticProperty/Annotated/Bare/Self/Later/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/ParameterDefault/def/OwnMember/StaticProperty/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ParameterDefault/def/OwnMember/StaticProperty/Annotated/Qualified Ice # #2432 ice +read/constant-kind/ParameterDefault/def/OwnMember/StaticProperty/Annotated/Qualified/Base Ice # #2432 ice +read/constant-kind/ParameterDefault/def/OwnMember/StaticProperty/Annotated/Qualified/Self Ice # #2432 ice +read/constant-kind/ParameterDefault/def/StdlibModuleVariable/math.pi/import Ice # #2432 ice +read/constant-kind/ParameterDefault/def/StdlibModuleVariable/math.pi/import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/def/StdlibModuleVariable/socket.AF_INET/import Ice # #2432 ice +read/constant-kind/ParameterDefault/def/StdlibModuleVariable/socket.AF_INET/import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/def/StringEnumMember/member/type-alias Ice # #2432 ice +read/constant-kind/ParameterDefault/def/StringEnumMember/member/type-name Ice # #2432 ice +read/constant-kind/ParameterDefault/def/StringEnumName/name/type-alias Ice # #2432 ice +read/constant-kind/ParameterDefault/def/StringEnumName/name/type-name Ice # #2432 ice +read/constant-kind/ParameterDefault/def/StringEnumValue/EnumValue/value/type-alias Ice # #2432 ice +read/constant-kind/ParameterDefault/def/StringEnumValue/EnumValue/value/type-name Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrStaticMember/sys.maxsize/import Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrStaticMember/sys.maxsize/import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/from-import Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/from-import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/import Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/star-import Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/type-alias Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeMethod/Value/Math.sqrt/from-import Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeMethod/Value/Math.sqrt/from-import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeMethod/Value/Math.sqrt/import Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeMethod/Value/Math.sqrt/import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeMethod/Value/Math.sqrt/star-import Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeMethod/Value/Math.sqrt/type-alias Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticField/BitConverter.is_little_endian/from-import Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticField/BitConverter.is_little_endian/from-import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticField/BitConverter.is_little_endian/import Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticProperty/Array.max_length/from-import Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticProperty/Array.max_length/from-import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticProperty/Array.max_length/import Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticProperty/Array.max_length/import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticProperty/Array.max_length/star-import Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticProperty/Array.max_length/type-alias Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/IntEnumName/name/type-name Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ModuleFunction/Value/math.sqrt/import Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ModuleFunction/Value/math.sqrt/import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ModuleFunctionGroup/Value/math.log/import Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ModuleFunctionGroup/Value/math.log/import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/ClassComputedConst/Annotated/Alias Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/ClassComputedConst/Annotated/Alias/Self Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/ClassComputedConst/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/ClassComputedConst/Annotated/Qualified Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/ClassComputedConst/Annotated/Qualified/Base Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/ClassComputedConst/Annotated/Qualified/Self Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/ClassComputedConst/Inferred/Alias Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/ClassComputedConst/Inferred/Alias/Self Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/ClassComputedConst/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/ClassComputedConst/Inferred/Qualified Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/ClassComputedConst/Inferred/Qualified/Base Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/ClassComputedConst/Inferred/Qualified/Self Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/ClassLiteralConst/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/ClassLiteralConst/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticField/Annotated/Alias Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticField/Annotated/Alias/Self Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticField/Annotated/Bare/Self/Later/bare-sibling FalseRefusal # #2423 false-refusal +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticField/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticField/Annotated/Qualified Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticField/Annotated/Qualified/Base Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticField/Annotated/Qualified/Self Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticField/Inferred/Alias Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticField/Inferred/Alias/Self Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticField/Inferred/Bare/Self/Later/bare-sibling FalseRefusal # #2423 false-refusal +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticField/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticField/Inferred/Qualified Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticField/Inferred/Qualified/Base Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticField/Inferred/Qualified/Self Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticMethod/Annotated/Alias/Self/Value Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticMethod/Annotated/Alias/Value Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticMethod/Annotated/Bare/Self/Later/Value/bare-sibling FalseRefusal # #2423 false-refusal +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticMethod/Annotated/Bare/Self/Later/outer=ModuleDef/Value/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticMethod/Annotated/Qualified/Base/Value Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticMethod/Annotated/Qualified/Self/Value Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticMethod/Annotated/Qualified/Value Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticProperty/Annotated/Alias Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticProperty/Annotated/Alias/Self Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticProperty/Annotated/Bare/Self/Later/bare-sibling FalseRefusal # #2423 false-refusal +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticProperty/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticProperty/Annotated/Qualified Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticProperty/Annotated/Qualified/Base Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/OwnMember/StaticProperty/Annotated/Qualified/Self Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/StdlibModuleVariable/math.pi/import Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/StdlibModuleVariable/math.pi/import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/StdlibModuleVariable/socket.AF_INET/import Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/StdlibModuleVariable/socket.AF_INET/import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/StringEnumMember/member/type-alias Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/StringEnumMember/member/type-name Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/StringEnumName/name/type-alias Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/StringEnumName/name/type-name Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/StringEnumValue/EnumValue/value/type-alias Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/StringEnumValue/EnumValue/value/type-name Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrLiteralField/subprocess.PIPE/from-import FalseRefusal # #2432 false-refusal +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrLiteralField/subprocess.PIPE/from-import-as FalseRefusal # #2432 false-refusal +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrLiteralField/subprocess.PIPE/star-import FalseRefusal # #2432 false-refusal +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrStaticMember/sys.maxsize/import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrStaticMember/sys.maxsize/import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/from-import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/from-import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/star-import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/type-alias Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeMethod/Value/Math.sqrt/from-import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeMethod/Value/Math.sqrt/from-import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeMethod/Value/Math.sqrt/import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeMethod/Value/Math.sqrt/import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeMethod/Value/Math.sqrt/star-import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeMethod/Value/Math.sqrt/type-alias Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticField/BitConverter.is_little_endian/from-import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticField/BitConverter.is_little_endian/from-import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticField/BitConverter.is_little_endian/import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticProperty/Array.max_length/from-import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticProperty/Array.max_length/from-import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticProperty/Array.max_length/import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticProperty/Array.max_length/import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticProperty/Array.max_length/star-import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticProperty/Array.max_length/type-alias Ice # #2432 ice read/constant-kind/PerInstanceFieldDefault/dataclass/ComparisonChain/ordered FalseRefusal # #2432 false-refusal -read/constant-kind/PerInstanceFieldDefault/dataclass/IntEnumName/name Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticMethod/Annotated/Base/Value Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticMethod/Annotated/Value Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticProperty/Annotated Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticProperty/Annotated/Base Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/dataclass/StdlibModuleVariable/math.pi Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/dataclass/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/dataclass/StringEnumMember/member Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/dataclass/StringEnumName/name Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/dataclass/StringEnumValue/EnumValue/value Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/struct/ClrLiteralField/from-subprocess-import-PIPE FalseRefusal # #2432 false-refusal -read/constant-kind/PerInstanceFieldDefault/struct/ClrStaticMember/sys.maxsize Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeMethod/Value/Math.sqrt Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticField/BitConverter.is_little_endian Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticProperty/Array.max_length Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/IntEnumName/name/type-name Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ModuleFunction/Value/math.sqrt/import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ModuleFunction/Value/math.sqrt/import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ModuleFunctionGroup/Value/math.log/import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ModuleFunctionGroup/Value/math.log/import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/ClassComputedConst/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/ClassComputedConst/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/ClassLiteralConst/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/ClassLiteralConst/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticField/Annotated/Bare/Self/Later/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticField/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticField/Inferred/Bare/Self/Later/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticField/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticMethod/Annotated/Alias/Self/Value Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticMethod/Annotated/Alias/Value Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticMethod/Annotated/Bare/Self/Later/Value/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticMethod/Annotated/Bare/Self/Later/outer=ModuleDef/Value/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticMethod/Annotated/Qualified/Base/Value Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticMethod/Annotated/Qualified/Self/Value Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticMethod/Annotated/Qualified/Value Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticProperty/Annotated/Alias Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticProperty/Annotated/Alias/Self Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticProperty/Annotated/Bare/Self/Later/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticProperty/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticProperty/Annotated/Qualified Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticProperty/Annotated/Qualified/Base Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/OwnMember/StaticProperty/Annotated/Qualified/Self Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/StdlibModuleVariable/math.pi/import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/StdlibModuleVariable/math.pi/import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/StdlibModuleVariable/socket.AF_INET/import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/StdlibModuleVariable/socket.AF_INET/import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/StringEnumMember/member/type-alias Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/StringEnumMember/member/type-name Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/StringEnumName/name/type-alias Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/StringEnumName/name/type-name Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/StringEnumValue/EnumValue/value/type-alias Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/StringEnumValue/EnumValue/value/type-name Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrLiteralField/subprocess.PIPE/from-import FalseRefusal # #2432 false-refusal +read/constant-kind/PerInstanceFieldDefault/struct/ClrLiteralField/subprocess.PIPE/from-import-as FalseRefusal # #2432 false-refusal +read/constant-kind/PerInstanceFieldDefault/struct/ClrLiteralField/subprocess.PIPE/star-import FalseRefusal # #2432 false-refusal +read/constant-kind/PerInstanceFieldDefault/struct/ClrStaticMember/sys.maxsize/import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrStaticMember/sys.maxsize/import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/from-import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/from-import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/star-import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/type-alias Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeMethod/Value/Math.sqrt/from-import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeMethod/Value/Math.sqrt/from-import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeMethod/Value/Math.sqrt/import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeMethod/Value/Math.sqrt/import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeMethod/Value/Math.sqrt/star-import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeMethod/Value/Math.sqrt/type-alias Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticField/BitConverter.is_little_endian/from-import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticField/BitConverter.is_little_endian/from-import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticField/BitConverter.is_little_endian/import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticProperty/Array.max_length/from-import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticProperty/Array.max_length/from-import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticProperty/Array.max_length/import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticProperty/Array.max_length/import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticProperty/Array.max_length/star-import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticProperty/Array.max_length/type-alias Ice # #2432 ice read/constant-kind/PerInstanceFieldDefault/struct/ComparisonChain/ordered FalseRefusal # #2432 false-refusal -read/constant-kind/PerInstanceFieldDefault/struct/IntEnumName/name Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticMethod/Annotated/Base/Value Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticMethod/Annotated/Value Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticProperty/Annotated Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticProperty/Annotated/Base Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/struct/StdlibModuleVariable/math.pi Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/struct/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/struct/StringEnumMember/member Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/struct/StringEnumName/name Ice # #2432 ice -read/constant-kind/PerInstanceFieldDefault/struct/StringEnumValue/EnumValue/value Ice # #2432 ice -read/constant-kind/enum-member/ClrStaticMember/from-sys-import-maxsize Ice # #2432 ice -read/constant-kind/enum-member/ClrStaticMember/sys.maxsize Ice # #2432 ice -read/constant-kind/enum-member/ClrTypeStaticProperty/Array.max_length Ice # #2432 ice -read/constant-kind/enum-member/OwnMember/ClassComputedConst/Annotated Ice # #2432 ice -read/constant-kind/enum-member/OwnMember/ClassComputedConst/Annotated/Base Ice # #2432 ice -read/constant-kind/enum-member/OwnMember/ClassComputedConst/Inferred Ice # #2432 ice -read/constant-kind/enum-member/OwnMember/ClassComputedConst/Inferred/Base Ice # #2432 ice -read/constant-kind/enum-member/OwnMember/ModuleComputedConst/Annotated Ice # #2432 ice -read/constant-kind/enum-member/OwnMember/ModuleComputedConst/Inferred Ice # #2432 ice -read/constant-kind/enum-member/OwnMember/ModuleProperty/Annotated Ice # #2432 ice -read/constant-kind/enum-member/OwnMember/ModuleVar/Annotated Ice # #2432 ice -read/constant-kind/enum-member/OwnMember/ModuleVar/Inferred Ice # #2432 ice -read/constant-kind/enum-member/OwnMember/StaticField/Annotated Ice # #2432 ice -read/constant-kind/enum-member/OwnMember/StaticField/Annotated/Base Ice # #2432 ice -read/constant-kind/enum-member/OwnMember/StaticField/Inferred Ice # #2432 ice -read/constant-kind/enum-member/OwnMember/StaticField/Inferred/Base Ice # #2432 ice -read/constant-kind/enum-member/OwnMember/StaticProperty/Annotated Ice # #2432 ice -read/constant-kind/enum-member/OwnMember/StaticProperty/Annotated/Base Ice # #2432 ice -read/constant-kind/enum-member/StdlibModuleVariable/socket.AF_INET Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/IntEnumName/name/type-name Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ModuleFunction/Value/math.sqrt/import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ModuleFunction/Value/math.sqrt/import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ModuleFunctionGroup/Value/math.log/import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ModuleFunctionGroup/Value/math.log/import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/ClassComputedConst/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/ClassComputedConst/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/ClassLiteralConst/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/ClassLiteralConst/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticField/Annotated/Bare/Self/Later/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticField/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticField/Inferred/Bare/Self/Later/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticField/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticMethod/Annotated/Alias/Self/Value Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticMethod/Annotated/Alias/Value Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticMethod/Annotated/Bare/Self/Later/Value/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticMethod/Annotated/Bare/Self/Later/outer=ModuleDef/Value/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticMethod/Annotated/Qualified/Base/Value Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticMethod/Annotated/Qualified/Self/Value Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticMethod/Annotated/Qualified/Value Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticProperty/Annotated/Alias Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticProperty/Annotated/Alias/Self Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticProperty/Annotated/Bare/Self/Later/bare-sibling FalseRefusal # #2423 wrong-code +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticProperty/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling SilentWrong # #2423 missing-refusal +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticProperty/Annotated/Qualified Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticProperty/Annotated/Qualified/Base Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/OwnMember/StaticProperty/Annotated/Qualified/Self Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/StdlibModuleVariable/math.pi/import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/StdlibModuleVariable/math.pi/import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/StdlibModuleVariable/socket.AF_INET/import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/StdlibModuleVariable/socket.AF_INET/import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/StringEnumMember/member/type-alias Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/StringEnumMember/member/type-name Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/StringEnumName/name/type-alias Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/StringEnumName/name/type-name Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/StringEnumValue/EnumValue/value/type-alias Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/StringEnumValue/EnumValue/value/type-name Ice # #2432 ice +read/constant-kind/enum-member/ClrStaticMember/sys.maxsize/from-import Ice # #2432 ice +read/constant-kind/enum-member/ClrStaticMember/sys.maxsize/from-import-as Ice # #2432 ice +read/constant-kind/enum-member/ClrStaticMember/sys.maxsize/import Ice # #2432 ice +read/constant-kind/enum-member/ClrStaticMember/sys.maxsize/import-as Ice # #2432 ice +read/constant-kind/enum-member/ClrStaticMember/sys.maxsize/star-import Ice # #2432 ice +read/constant-kind/enum-member/ClrTypeStaticProperty/Array.max_length/from-import Ice # #2432 ice +read/constant-kind/enum-member/ClrTypeStaticProperty/Array.max_length/from-import-as Ice # #2432 ice +read/constant-kind/enum-member/ClrTypeStaticProperty/Array.max_length/import Ice # #2432 ice +read/constant-kind/enum-member/ClrTypeStaticProperty/Array.max_length/import-as Ice # #2432 ice +read/constant-kind/enum-member/ClrTypeStaticProperty/Array.max_length/star-import Ice # #2432 ice +read/constant-kind/enum-member/ClrTypeStaticProperty/Array.max_length/type-alias Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/ClassComputedConst/Annotated/Alias Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/ClassComputedConst/Annotated/Qualified Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/ClassComputedConst/Annotated/Qualified/Base Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/ClassComputedConst/Inferred/Alias Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/ClassComputedConst/Inferred/Qualified Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/ClassComputedConst/Inferred/Qualified/Base Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/ModuleComputedConst/Annotated/Bare Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/ModuleComputedConst/Inferred/Bare Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/ModuleProperty/Annotated/Bare Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/ModuleVar/Annotated/Bare Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/ModuleVar/Inferred/Bare Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/StaticField/Annotated/Alias Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/StaticField/Annotated/Qualified Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/StaticField/Annotated/Qualified/Base Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/StaticField/Inferred/Alias Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/StaticField/Inferred/Qualified Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/StaticField/Inferred/Qualified/Base Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/StaticProperty/Annotated/Alias Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/StaticProperty/Annotated/Qualified Ice # #2432 ice +read/constant-kind/enum-member/OwnMember/StaticProperty/Annotated/Qualified/Base Ice # #2432 ice +read/constant-kind/enum-member/StdlibModuleVariable/socket.AF_INET/from-import Ice # #2432 ice +read/constant-kind/enum-member/StdlibModuleVariable/socket.AF_INET/from-import-as Ice # #2432 ice +read/constant-kind/enum-member/StdlibModuleVariable/socket.AF_INET/import Ice # #2432 ice +read/constant-kind/enum-member/StdlibModuleVariable/socket.AF_INET/import-as Ice # #2432 ice +read/constant-kind/enum-member/StdlibModuleVariable/socket.AF_INET/star-import Ice # #2432 ice read/init-overload/InitDelegation/Later FalseRefusal # #2423 false-refusal read/no-initializer/ModuleProperty/Absent/callable RuntimeThrow # #2423 runtime-throw read/no-initializer/ModuleProperty/Absent/class RuntimeThrow # #2423 runtime-throw From 73c785856a6001d926299f3eb01676bbd9193d66 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 19:14:23 +0000 Subject: [PATCH 16/22] process(plan): plan-777361 (P78) revised after pass 3 Revised after /verify-plan pass 3 (NEEDS REVISION, Dimension 6, @ 56dbb009f) under the owner's rulings 12 and 13 (#2423 comment 7046304965); the fourth pass the owner asked for (#2423 comment 7046359997) is recorded in Scope. Stage 0 is 0fe74e4c1. - Finding 1: the Generator row cites the new stage 0 (4682 cases, 1383 known-red rows); D8 says an attribute argument is checked in the scope its declaration stands in, so D3 and D4 decide a member's attribute's bare names; A9 and M9 hold it, and the by-direction entry names the attribute argument among N2's cells. - Findings 2 and 3: answered in stage 0; the Generator row names the hand lists that remain, each a decision, and the exclusions. - Finding 4: A14 is D8's control on the project route, per importer form, with M14; T10, the Testing Strategy and #2432's close criterion name it. - The stamp lines and the Verification Summary are deleted; one Revision log line carries the pass. Body 20,473 -> 20,473 of 20,480 bytes. Paid for by cuts: Current State's three example bullets became one sentence; #2487's list of remaining items left the Context and the Class trackers; A12's "regenerate" repeats left T1, T4 and the Adversarial Review; file names left T3 and T12; wording in the pre-mortem, D1, D3, D9, the Testing Strategy and the 2nd-pass log line (its deferred row untouched). `check_plan_refs.py`: RESULT: OK. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01LGMKZVcFYGqQRfHgd16DLa --- docs/process/plans/plan-777361.md | 168 ++++++------------------------ 1 file changed, 29 insertions(+), 139 deletions(-) diff --git a/docs/process/plans/plan-777361.md b/docs/process/plans/plan-777361.md index 623166f2d..a0550d6cf 100644 --- a/docs/process/plans/plan-777361.md +++ b/docs/process/plans/plan-777361.md @@ -1,20 +1,14 @@ - - - - + # P78 — N1/N2/N4/N7: scope decides meaning ## Context -Rules N1, N2, N4 and N7 of `docs/design/name-resolution.md` (charter §3.20l): #2423 (tracker), #2398, #2432. #2426 closes here; the rule table #2487 (R-LO) lands as a drift guard and stays open. +Rules N1, N2, N4 and N7 of `docs/design/name-resolution.md` (charter §3.20l): #2423 (tracker), #2398, #2432. #2426 closes here. ## Current State -`sharpyc run` @ 19ffa7ad1 (code e24aaf9f0); python 3.15.2. The known-red rows are the state; by class: -- **Order, kind:** a function reading a later module variable is SPY0200 (python `3`); under a module binding a later `@static` yields (`64`), a later literal `const` outranks (`3`, python `10`), a later computed `const` is SPY0618. -- **Untyped, bodies (#2398):** a forward read in a `bool` slot is CS0029 behind SPY0908; a nested type's initializer reading the enclosing type's field is SPY0909; `x()` on a parameter under a module `def x` prints `12` (python `1`). -- **Constants (#2432), R-QI, D10:** `RED = x` is CS0133; a default through `math.pi`, and a struct auto-property's through `H.x`, CS1736; bare imported `PIPE` SPY0401; module `x: T` reads `0`; an unused `type K0 = nosuch` runs. +`sharpyc run` @ 19ffa7ad1 (code e24aaf9f0); python 3.15.2. The known-red rows are the state. By class: order and kind (under a module binding a later `@static` yields, `64`, and a later literal `const` outranks, `3`); untyped reads and bodies (#2398: `x()` on a parameter under a module `def x` prints `12`); constant positions (#2432); R-QI (module `x: T` reads `0`). ## Scope @@ -25,6 +19,7 @@ Rules N1, N2, N4 and N7 of `docs/design/name-resolution.md` (charter §3.20l): # - **Filing:** findings ledger; the lead files by class (contract §10) - **Override:** none - Extra verify pass 3: owner, 2026-11-20 "run a third verify pass" +- Extra verify pass 4: owner, 2026-11-20 "run a fourth verify pass when the revision lands" ## Defect Class @@ -34,32 +29,32 @@ Rules N1, N2, N4 and N7 of `docs/design/name-resolution.md` (charter §3.20l): # - **Sibling cells this plan must also cover:** none; see Generator. - **Lane / reach:** false-refusal + silent-wrong + ice · program; **fidelity-scope row:** "which programs run vs. are refused" and "value of an expression", both COMPARED. - **Standing harness that should have caught it:** `NameResolutionDifferentialTests`; `ClassBodyReadPositionMatrixTests` is the hand control (R-KF) for steer text and diagnostic count per position × host. -- **Generator:** stage 0 (§2.1) @ 3a422a6fe. `name-resolution-rules.txt` (S0a, #2487): every cell of both pools has exactly one row and every row a cell. `NameResolutionDifferentialTests`: 8951 cases, 2368 known-red rows. `ScopeMeaningDifferentialTests` (S0b): 3070 cases, 829 known-red rows (463 / 216 / 150 cite #2423 / #2432 / #2417), verdicts read from the rows. Each S0b axis is an image with its source in `ScopeMeaningDifferentialTests.Axes.cs`, every value generated or excluded with a reason, 15 of them probed (`Axes_EveryValueIsGeneratedOrExcluded`). Hand lists: a reader's hosts (a `const`'s aside), one expression per member kind, one value per declared type. Closed by decision: the chain pair (call 45), the five other `Scope*` enums, one call site per callee cell (D5's census). Excluded: the project route (A3), message text, a self-reaching alias an annotation names (#2769), an interface host (#2383). Green by D1, D2, D5, D10 (A1, A2, A4, A13), D3, D4, D6, D7 (A5–A7), D8 (A9). -- **Owner rulings:** R-KD, R-KF, R-KG, R-KJ, R-KV, R-LJ, R-LO, R-PM, R-QE, R-QI (charter §4); #2432's call-43 and call-45 cells (§3.20l); owner 2026-11-20, #2423 comments 7030074628 (rulings 1–4), 7039834146 (5–6), 7042723494 (7–9), 7045166298 (10). +- **Generator:** stage 0 (§2.1) @ 0fe74e4c1. `name-resolution-rules.txt` (S0a, #2487): one row per cell of both pools and a cell per row. `NameResolutionDifferentialTests`: 8951 cases, 2368 known-red rows. `ScopeMeaningDifferentialTests` (S0b): 4682 cases, 1383 known-red rows (555 / 661 / 150 / 17 cite #2423 / #2432 / #2417 / #2147), verdicts read from the rows. Each S0b axis is an image, every value generated or excluded with a reason, 27 of them probed, one in a child process (`Axes_EveryValueIsGeneratedOrExcluded`). Hand lists, each a decision: one host program per reader, one or two members per kind, one outer binding per sibling form, one value per declared type, the census's namespace (`System`). Closed by decision: the chain pair (call 45), the five other `Scope*` enums, one call site per callee cell (D5's census), a reader nested in or beside the member's type (the 8951 pool's). Excluded: the project route (A3, A14), message text, a self-reaching alias an annotation names (#2769), an interface's statics (#2383, #2111), an int enum's `.value` / `.name` through an alias, a lambda's dotted annotation. Green by D1–D7, D10 (A1, A2, A4–A7, A13), D8 (A9). +- **Owner rulings:** R-KD, R-KF, R-KG, R-KJ, R-KV, R-LJ, R-LO, R-PM, R-QE, R-QI (charter §4); #2432's call-43 and call-45 cells (§3.20l); owner 2026-11-20, #2423 comments 7030074628 (rulings 1–4), 7039834146 (5–6), 7042723494 (7–9), 7045166298 (10), 7046304965 (12–13). ## Adversarial Review (pre-mortem) - **Alternative root cause:** "bodies are checked in textual order" — refuted: the same function reads a later `const`, `def` and class; only the variable's symbol is missing. Second cause: a symbol is untyped until its declaration is checked (D2). - **Alternative layer:** scoping has no `.spy`, dunder or protocol spelling; D8's literal arm is rung 3. -- **How the fix could be inert:** D1 without D2 prints `3` and leaves CS0029; F2's yield one branch above the N2 refusal keeps `64`; a callee site left on its own lookup keeps `12`. -- **Before/after by direction:** newly refused and `worked`, each ruled: N2's cells whatever the member's kind or position (`64`, `3`; R-KD, R-KJ); a nested type's bare read of its enclosing type's `const` (`7`; R-KG); a class member read bare in a comprehension element of a `@static` initializer (`2`; N1); a module initializer under a later same-named declaration (`2`, python `7`; R-LJ); a declaration with no initializer (R-QI; none in 4,565 `.spy` files, 22 in five spec files: A11); an unused alias to a missing type (`1`; D10). Newly running: every order-only refusal, and bare imported `PIPE` as a default. D8 refuses nothing that runs. A8 is the record. -- **Blast radius:** the whole gate; Stdlib.Tests (the `.spy` stdlib's module variables), cold/warm and `FrontEndParityTests` first. -- **Generated artifacts touched:** none may move (A12's regeneration after T1 and T4); the oracle ledger follows T11. +- **How the fix could be inert:** D1 without D2 leaves CS0029; F2's yield above the N2 refusal keeps `64`; a callee site on its own lookup keeps `12`. +- **Before/after by direction:** newly refused and `worked`, each ruled: N2's cells whatever the member's kind or position, an attribute argument included (`64`, `3`; R-KD, R-KJ); a nested type's bare read of its enclosing type's `const` (`7`; R-KG); a class member read bare in a comprehension element of a `@static` initializer (`2`; N1); a module initializer under a later same-named declaration (`2`, python `7`; R-LJ); a declaration with no initializer (R-QI; none in 4,565 `.spy` files, 22 in five spec files: A11); an unused alias to a missing type (`1`; D10). Newly running: every order-only refusal, and bare imported `PIPE` as a default. D8 refuses nothing that runs. A8 is the record. +- **Blast radius:** the whole gate; Stdlib.Tests (module variables), cold/warm and `FrontEndParityTests` first. +- **Generated artifacts touched:** none may move (A12); the oracle ledger follows T11. ## Design Decisions No rule below reads a builtin or type name; a rung applies only in D8. -- **D1 (module variables are declared first; Semantic).** `NameResolver.ResolveDeclaration` declares every module-level `VariableDeclaration`, annotated or `auto`, as it does a `const`; `TypeChecker.CheckVariableDeclaration` completes that symbol and creates none at module level. A module `let` (SPY0340) and a second declaration of the name (#2125) keep today's verdicts (P21b). Predicates: no module-level `VariableSymbol` is created by `TypeChecker`; a variable's export is its declared symbol, cold and warm, so the identity-bridge arm of `ImportedStaticFacts.ImportedStorage` and `SemanticBinding`'s module-value map are deleted (its first arm stays). +- **D1 (module variables are declared first; Semantic).** `NameResolver.ResolveDeclaration` declares every module-level `VariableDeclaration`, annotated or `auto`, as it does a `const`; `TypeChecker.CheckVariableDeclaration` completes that symbol. A module `let` (SPY0340) and a second declaration of the name (#2125) keep today's verdicts (P21b). Predicates: no module-level `VariableSymbol` is created by `TypeChecker`; a variable's export is its declared symbol, cold and warm, so the identity-bridge arm of `ImportedStaticFacts.ImportedStorage` and `SemanticBinding`'s module-value map are deleted (its first arm stays). - **D2 (a read is typed whatever the order; Semantic).** `CheckModule` resolves every declared type before it checks a body or an initializer: annotated module variables and module properties beside the consts, and each type's annotated members (fields, consts, properties, method signatures, union cases), nested types included. An unannotated module-level or type-level value is checked on its first read, in its own declaration's scope state, under an in-progress mark; a read that re-enters its own inference stays `Unknown` as today and adds no refusal (the cycle graph's SPY0278 is a ring's). Predicate: no read of a declared module-level or type-level name is `Unknown` because of where the declaration stands. -- **D3 (one class-body rule: N1, N2, N4, N7).** `TryResolveClassBodySiblingRead` decides a bare read of a member its type body declares by four facts: the member's level (type or instance), its order against the reader, whether a binding outside the body holds the name, and the position. Earlier: the member. At-or-after with an outer binding: SPY0619 in every position and for every member kind, instance included, judged before the kind refusal and SPY0401. At-or-after with none: the member, a forward read (N3); a self read is the cycle graph's. Outside N2 an instance member keeps its kind refusal and never yields, a parameter default keeps SPY0401 for a non-constant, an inherited member R1 (b). Deleted: F1's refusal, F2's yield, the `const` exemption in `IsDeclaredLater`, `ReportAmbiguousLaterConstReads`, SPY0618. Predicate: the verdict never reads `IsConstant`, the compile-time fact or the spelling. +- **D3 (one class-body rule: N1, N2, N4, N7).** `TryResolveClassBodySiblingRead` decides a bare read of a member its type body declares by four facts: the member's level (type or instance), its order against the reader, whether a binding outside the body holds the name, and the position. Earlier: the member. At-or-after with an outer binding: SPY0619 in every position and for every member kind, instance included, judged before the kind refusal and SPY0401. At-or-after with none: the member, a forward read (N3); a self read is the cycle graph's. Outside N2 an instance member keeps its kind refusal and never yields, a parameter default keeps SPY0401 for a non-constant, an inherited member R1 (b). Deleted: F1's refusal, F2's yield, the `const` exemption in `IsDeclaredLater`, `ReportAmbiguousLaterConstReads`. Predicate: the verdict never reads `IsConstant`, the compile-time fact or the spelling. - **D4 (bodies do not see class variables: N1, R-KG).** `Scope.ResolveName` crosses a type body from a nested type's body as from a function-like scope: no field, `const` or property of an enclosing type binds there bare. The crossing is variable-only, as today: a type, alias, type parameter or function still binds. `ClassifyClassBodyReadPosition` names three more positions — a nested type's body, a lambda in an initializer, a comprehension's body (all but its first iterable) — each with its phrase in the one SPY0200 steer. With an outer binding the read is that binding (R-Y), recorded through `SetModuleAccessCrossesClassMember` for an imported name as for a module variable. Predicate: every scope kind between a read and a type body is classified, with no default arm. - **D5 (one callee resolver).** A bare callee resolves by the scope walk a bare read uses and dispatches on the symbol it bound, whatever an outer binding of the name is. The 33 direct `LookupFunctionOverloads` / `BuiltinRegistry.GetFunction` / `GetFunctionOverloads` sites in `TypeChecker*.cs` go behind it; a census test pins the remainder at the helper's own. A constructor's overload set is the whole body's. - **D6 (N2 at module level; R-LJ).** A read evaluated at load — a module-level or class-level initializer or default, never a function body — of a builtin name its module declares at or after the reader is SPY0619. An import its module redeclares stays SPY0204 at the declaration. - **D7 (R-QI).** A module variable, a `@static` field, and a module or `@static` auto-property with no initializer is SPY0620 at its declaration, whatever its type and host; the steer names `x: T = ` and `x: T | None = None`. Untouched: an instance field, a local `x: T`, a property with accessor bodies. -- **D8 (#2432; Semantic, Validation, CodeGen).** One answer per name the checker bound, for the identifier and member hooks, under every spelling (N7). True: a `const` whose fact is true; an int enum's member and its `.value`; and — rung 3: a referenced assembly's constant has no Sharpy symbol — a literal field of a referenced type or module (a module's by discovery's `IsConst`; a type's or enum's by `FieldInfo.IsLiteral`, through `ClrTypeHelper`). False: every other bound name (a `@static` member, own or inherited; a module variable, property or function; a string enum's member, any `.name`; a CLR static that is no literal). The shape rule keeps only what the checker did not bind. Every `IsAdmitted` call passes the answer: a `const` handed a non-constant is a computed constant, never C#'s `const`; a struct auto-property is a constructor parameter only for a constant (`MarkStructConstructorProperty`) and otherwise keeps its initializer and runs; the validator judges an enum member's value (a new `AdmissionTable` row), pushes interface and union hosts on `_enclosingTypes`, and refuses an attribute argument under SPY0425, each argument first checked by the checker as an expression (its names bound and refused by kind) and printed by `GenerateAttributeArgumentExpression`'s ordinary read route. A `ComparisonChain` is admitted when each link is. Predicate: no expression reaches C# as a non-constant in a constant position, and no constant admitted today is refused. -- **D9 (codes).** SPY0619 (N2; the text carries both readings and the qualified spelling) and SPY0620 (R-QI), each with its `DiagnosticExplanations` entry; SPY0618 retires. T8 edits, in one commit, the table's rows, the `Expect*` arms that mirror them and `AdmittedRefusals`: D3's N2 cells leave `kind:instance-at-initializer` and `SPY0401`, N2 admits SPY0619 alone, N2-module SPY0619 and SPY0204, `kind:enum-member-constant` SPY0401, `N1-arity` names its code; S0b's R-QI cells, which admit none today, admit SPY0620. +- **D8 (#2432; Semantic, Validation, CodeGen).** One answer per name the checker bound, for the identifier and member hooks, under every spelling (N7). True: a `const` whose fact is true; an int enum's member and its `.value`; and — rung 3: a referenced assembly's constant has no Sharpy symbol — a literal field of a referenced type or module (a module's by discovery's `IsConst`; a type's or enum's by `FieldInfo.IsLiteral`, through `ClrTypeHelper`). False: every other bound name (a `@static` member, own or inherited; a module variable, property or function; a string enum's member, any `.name`; a CLR static that is no literal). The shape rule keeps only what the checker did not bind. Every `IsAdmitted` call passes the answer: a `const` handed a non-constant is a computed constant, never C#'s `const`; a struct auto-property is a constructor parameter only for a constant (`MarkStructConstructorProperty`) and otherwise keeps its initializer and runs; the validator judges an enum member's value (a new `AdmissionTable` row), pushes interface and union hosts on `_enclosingTypes`, and refuses an attribute argument under SPY0425, each argument first checked by the checker as an expression in the scope its declaration stands in (a member's attribute in its type's body, so D3 and D4 decide its bare names) and printed by `GenerateAttributeArgumentExpression`'s ordinary read route. A `ComparisonChain` is admitted when each link is. Predicate: no expression reaches C# as a non-constant in a constant position, and no constant admitted today is refused. +- **D9 (codes).** SPY0619 (N2; the text carries both readings and the qualified spelling) and SPY0620 (R-QI); SPY0618 retires. T8 edits, in one commit, the table's rows, the `Expect*` arms that mirror them and `AdmittedRefusals`: D3's N2 cells leave `kind:instance-at-initializer` and `SPY0401`, N2 admits SPY0619 alone, N2-module SPY0619 and SPY0204, `kind:enum-member-constant` SPY0401, `N1-arity` names its code; S0b's R-QI cells, which admit none today, admit SPY0620. - **D10 (an alias names a type that exists; owner).** An alias whose target names a missing type — as the name itself, inside a wrapper, type argument or callable, dotted, or in a generic alias's body — is SPY0202 at the alias, at every site (module, type body, function, block), named or not: both binders resolve the target where the alias is declared, expanding none that reaches its own alias (#2769, unruled: unused, it still runs). Predicate: no declared alias's target names a missing type. -- **Out of contract:** a read above a same-scope local (P80); a store without `global` (P79); a walrus over `let` (P21b); `ALSO = RED` (#2069); a receiver read untyped at either order (#2417, S0b's 150 rows); a self-reaching alias named by an annotation (#2769); the #2397 rows; `T !E` above its `E` (#2249); `from m import x` as a live alias (N6). +- **Out of contract:** a read above a same-scope local (P80); a store without `global` (P79); a walrus over `let` (P21b); `ALSO = RED` (#2069); a receiver read untyped at either order (#2417, S0b's 150 rows); `self.x` of a `const` (#2147, 17 rows); a self-reaching alias named by an annotation (#2769); the #2397 rows; `T !E` above its `E` (#2249); `from m import x` as a live alias (N6). ## Implementation @@ -74,10 +69,10 @@ No rule below reads a builtin or type name; a rung applies only in D8. #### Tasks -- **T1. Module variables (D1)** — `NameResolver.Declarations.cs`, `NameResolver.Members.cs`, `TypeChecker.Statements.cs`, `ProjectCompiler.Phases.cs`, `StaticStorageFacts.cs`; regenerate (A12). (A1, A3) +- **T1. Module variables (D1)** — `NameResolver.Declarations.cs`, `NameResolver.Members.cs`, `TypeChecker.Statements.cs`, `ProjectCompiler.Phases.cs`, `StaticStorageFacts.cs`. (A1, A3) - **T2. Types before reads (D2)** — `TypeChecker.cs`, `TypeChecker.Statements.cs`, `TypeChecker.Definitions.cs`. (A1, A2) -- **T3. One callee resolver (D5)** — the `TypeChecker*.cs` files holding the 33 sites; the census in `DispatchSiteInventoryTests`. (A4) -- **T12. Alias targets (D10)** — `ResolveTypeAliasDeclaration` (`NameResolver.Members.cs`), `RegisterScopedTypeAlias` (`TypeChecker.Utilities.cs`), `TypeResolver.cs`. (A13) +- **T3. One callee resolver (D5)** — D5's 33 sites; the census in `DispatchSiteInventoryTests`. (A4) +- **T12. Alias targets (D10)** — `ResolveTypeAliasDeclaration`, `RegisterScopedTypeAlias`, `TypeResolver.cs`. (A13) ### Phase 2: Ambiguity and bodies (N2, N4, N7) @@ -89,7 +84,7 @@ No rule below reads a builtin or type name; a rung applies only in D8. #### Tasks -- **T4. The class-body rule (D3)** — `TypeChecker.ClassScopeRule.cs`, `TypeBodyMembership.cs`; regenerate (A12). (A5) +- **T4. The class-body rule (D3)** — `TypeChecker.ClassScopeRule.cs`, `TypeBodyMembership.cs`. (A5) - **T5. Bodies and nested types (D4)** — `Scope.cs`, `SymbolTable.cs`, `TypeChecker.ClassScopeRule.cs`. (A6) - **T6. N2 at module level (D6)** — `TypeChecker.Expressions.cs`. (A5) - **T7. No-initializer refusal (D7)** — `TypeChecker.Statements.cs`, `TypeChecker.Definitions.cs`. (A7) @@ -99,12 +94,13 @@ No rule below reads a builtin or type name; a rung applies only in D8. ### Phase 3: Constant positions (#2432) **Acceptance:** -- **A9.** The #2432 rows of both allowlists drain, each S0b constant-kind cell as its row says (a non-constant refused, computed or kept by its position; a referenced literal run everywhere) — **M9:** answer null for a bound non-constant → CS1736; answer false for a type's literal → `int.max_value` SPY0401; skip the enum row → CS0133; classify the struct property with no resolver → CS1736; admit every chain → `0 < 2 in [1, 2]` reaches C#; skip the attribute argument's check → CS0120; keep the attribute printer's member arm → CS0103 +- **A9.** The #2432 rows of both allowlists drain, each S0b constant-kind cell as its row says, under every spelling and placement (a non-constant refused, computed or kept by its position; a referenced literal run everywhere) — **M9:** answer null for a bound non-constant → CS1736; answer false for a type's literal → `int.max_value` SPY0401; skip the enum row → CS0133; classify the struct property with no resolver → CS1736; admit every chain → `0 < 2 in [1, 2]` reaches C#; skip the attribute argument's check → CS0120; check it at module scope → a bare sibling `const` SPY0425; keep the attribute printer's member arm → CS0103 - **A10.** An interface or union parameter default draws one diagnostic — **M10:** drop either push → two +- **A14.** Per importer form, a two-file fixture reads an imported literal `const`, an imported class's and a computed one at a parameter default: `5 9`, then SPY0401 (`m.Q`: CS1736 today) — **M14:** answer false for an imported constant → SPY0401 #### Tasks -- **T10. Constants (D8)** — `ConstantPositionValidator.cs`, `ConstantDefaultClassifier.cs`, `ConstEligibility.cs`, `CodeGenInfoComputer.cs`, `TypeChecker.Definitions.cs`, `ClrTypeHelper.cs`, `RoslynEmitter.TypeDeclarations.cs`. (A9, A10) +- **T10. Constants (D8)** — `ConstantPositionValidator.cs`, `ConstantDefaultClassifier.cs`, `ConstEligibility.cs`, `CodeGenInfoComputer.cs`, `TypeChecker.Definitions.cs`, `ClrTypeHelper.cs`, `RoslynEmitter.TypeDeclarations.cs`. (A9, A10, A14) ### Phase 4: Spec and record @@ -120,131 +116,25 @@ No rule below reads a builtin or type name; a rung applies only in D8. ## Testing Strategy - Fixtures: one `.spy` + `.expected` per rule and one `.error` per refusal code and D4 phrase, each with its running control. -- Beyond the generator: host {interface, union}; the project route (A3). -- Outputs discriminate: member and outer values differ in every cell. +- Beyond the generator: host {interface, union}; the project route (A3, A14). +- Outputs discriminate: member and outer values differ. ## Issues to Close - #2423 — closed by T1–T9, T12; **close criterion:** A1–A8, A13 @ sha, 0 rows citing it in either allowlist - #2398 — closed by T5, T9, T10; **close criterion:** A6 and A10 @ sha -- #2432 — closed by T10; **close criterion:** A9 @ sha: the SPY0401 verdict (owner); the constants are #2768's +- #2432 — closed by T10; **close criterion:** A9 and A14 @ sha: the SPY0401 verdict (owner); the constants are #2768's - #2426 — closed by T11; **close criterion:** A11 @ sha ## Class trackers this plan may post cells to - #2427 (the principle), #2457 (the harness's residue) -- #2486 — the rule tables; #2487 stays open (owner): rows written from the rules, the generator reading its verdict from the table, every rule id in `name-resolution.md`, no negated constraint, the spec's tables generated from it -- #2397, #2417, #2069, #2249, #2383, #2768, #2769 — neighbours +- #2486 — the rule tables; #2487 stays open (owner) +- #2397, #2417, #2069, #2147, #2249, #2383, #2768, #2769 — neighbours ## Revision log - @ 8bd4b49fc — revised before the first pass: stage 0, D10, #2432's close. - @ a7fbd945d — revised after the 1st pass (NEEDS REVISION, Dimension 6): S0b's seven axes closed; D2 with no SPY0240 arm. -- @ 656991807 — revised after the 2nd pass (NEEDS REVISION, Dimension 6): stage 0 closes the member-kind axis and pins hosts to the reader census; D8 per bound name: a type's literal, the struct auto-property, checked attribute arguments (findings 1–3); 4, 6 and D2's mark folded. Deferred (owner): D10's module-level judgement ← the pipeline order — fix: judge the target once every type and import is declared — proved by the `dotted` and `Later` must-run cells. - -## Verification Summary - -**Result:** NEEDS REVISION (Dimension 6, with one Dimension 4 design row: D8). This is the third pass, the extra one the owner asked for (#2423 comment 7045333238), so the open findings go to the owner (R-LW). -**Adequacy:** CELL -**Verified on:** 2026-11-20 @ 56dbb009f (product code == e24aaf9f0; stage 0 @ 3a422a6fe; Debug `sharpyc` and the test binaries rebuilt at this tree; python = CPython 3.15.2, `.venv/bin/python3`) -**Plan file:** `docs/process/plans/plan-777361.md` (committed in §4 at every result, NEEDS REVISION included) - -### Paraphrase -- **Changes:** a module-level or class-level name gets one meaning, one type and one legality verdict whatever its binding kind, order, spelling and reading position. Name resolution declares every module variable up front as it does a `const`; the checker completes that symbol and creates none at module level, and a variable's export is that symbol cold and warm, so two bridging maps go (D1). `CheckModule` resolves every declared type (module variables and properties, each type's annotated members, nested types) before any body or initializer; an unannotated value is checked at its first read under an in-progress mark, and a read that re-enters its own inference stays untyped with no new refusal (D2). One class-body rule decides a bare sibling read by the member's level, its order against the reader, an outer binding of the name, and the position: earlier is the member; at-or-after under an outer binding is the new SPY0619 for every kind and position; at-or-after with none is a forward read; F1's refusal, F2's yield, the `const` exemption and SPY0618 go (D3). A nested type's body, a lambda in an initializer and a comprehension's body stop seeing an enclosing type's variables bare, each with its phrase in SPY0200; types, aliases and functions still bind (D4). A bare callee resolves by the walk a bare read uses, the 33 direct lookup sites behind one resolver with a census pin (D5). A load-time read of a builtin name its module declares at or after the reader is SPY0619 (D6). A module variable, a `@static` field and a module or `@static` auto-property with no initializer is the new SPY0620 (D7). A constant position gets one answer per name the checker bound: true for a `const` whose fact is true, an int enum's member and its `.value`, and a literal field of a referenced type or module (a CLR-keyed fact, rung 3); false for every other bound name. Every classifier call passes that answer: a `const` handed a non-constant is computed, a struct auto-property keeps a non-constant initializer and runs, the validator judges an enum member's value, pushes interface and union hosts, and refuses an attribute argument under SPY0425 after the checker has checked it as an expression; the attribute printer takes the ordinary read route; a chain is admitted link by link (D8). SPY0618 retires and T8 re-labels the table, the generator's arms and the admitted codes in one commit (D9). An alias whose target names a missing type is SPY0202 at the alias, at every site and shape, used or not; a target that reaches its own alias is not expanded and keeps running unused (D10). The spec is rewritten around N1–N7; rows drain in the commit that turns them green; #2487 stays open. · **Today:** order decides (a function reading a later module variable is SPY0200); kind decides (a later `@static` yields, `64`; a later literal `const` outranks, `3`; a later computed `const` is SPY0618); a forward read in a `bool` slot is CS0029 behind SPY0908; a nested type's initializer reading the enclosing type's field is SPY0909; `x()` on a parameter under a module `def x` prints `12`; `RED = x` is CS0133; a default through `math.pi`, and a struct auto-property's through `H.x`, CS1736; bare imported `PIPE` SPY0401; module `x: T` reads `0`; an unused `type K0 = nosuch` runs. Instruments: an 8951-case pool with 2368 known-red rows and a 3070-case generated type with 829. · **Could not paraphrase:** none. One sentence leaves a reading open and is raised below: D8 has the checker check an attribute argument "as an expression" and does not say in which scope its bare names bind. - -### Corrections Made -- The DRAFT marker is replaced by this pass's stamp. -- **Scope**, added: `- Extra verify pass 3: owner, 2026-11-20 "run a third verify pass"` (+67 bytes). It is the pass cap's record (R-LW; #2423 comment 7045333238), written by the verifier because the revision came before the owner asked. -- **Defect Class › Owner rulings**, the comment that rules D8's string-enum answer: before `7042723494 (7–9).`, after `7042723494 (7–9), 7045166298 (10).` (+17 bytes). -- **Revision log**, the 2nd-pass line: the sentence `Unruled: D8 refuses a string enum's member by call 43.` is deleted (−56 bytes). The owner ruled it after the revision (ruling 10, comment 7045166298: "Refuse with SPY0401 (Recommended)"; the residue is #2772), and that comment says the word is superseded. -- **Defect Class › Generator**, a claim that two exclusions refute (finding 3): before `with a reason and, where the reason is the compiler's, a probe (`, after `with a reason, 15 of them probed (` (−29 bytes). `BehaviourProbes` holds 15 reasons; `ExcludedClrTypeMemberShapes[InconclusiveResult]` and `ExcludedAliasUses[(Itself, Used)]` rest on what the compiler does and have no probe. -- Nothing else was changed. Body: 20,473 → 20,473 of 20,480 bytes (the four edits net −1; the blank line that now separates this summary is +1). The last two edits are corrections in their own right and are also the room the first one needed; every other finding grows the body or is the author's or the owner's. - -### Stage 0 checks (contract §11) -- **Path check:** `git merge-base origin/dev 3a422a6fe` = e24aaf9f0; `git diff --name-only e24aaf9f0..3a422a6fe -- ':!docs/process/plans/'` lists `build_tools/scorecard-baseline.json` and 14 files under `src/Sharpy.Compiler.Tests/Conformance/`. Not seeded. PASS. -- **Green @ 56dbb009f (measured):** `ScopeMeaningDifferentialTests` + the two `RuleTable_` facts 7/0/0 (3.1 min): pool 3070 (1224 must-run, 1846 must-refuse), python agreed 30/30, red 829, allowlist 829 (463 / 216 / 150 cite #2423 / #2432 / #2417); constant-kind 770 cells, 216 red; the 126 unused self-reaching alias cells are must-run and all match; the struct auto-property host has 57 cells, 22 red. After the last restore and a rebuild of the solution: both generated types, `ClassBodyReadPositionMatrixTests`, `StaticInitializerOrderMatrixTests`, `ConstantPositionValidator*`: 305/0/0 (13.4 min); the 8951 pool ran 8951, python agreed 8951/8951, allowlist 2368, no red outside it. Table: 207 rows, 52 rules. Scorecard: `allowlist_rows_outside_seed` 572 → 605 → 1211 → 1401 across the stage-0 commits, the last +190 all constant-kind rows citing #2432, none removed; `scorecard_metrics.py --check`: OK (seed 2368, outside 1401). CI on #2767 at this tip: 35 checks green, `review-line` red (no independent review yet). -- **The enumeration and the totality assertions, as read.** A cell's tag and rule come from its one row of `name-resolution-rules.txt`. `Axes_EveryValueIsGeneratedOrExcluded` partitions, with no default arm: `BindingKind` (four times), `TypeKind` (three times), `ScopeKind` (twice), `SemanticType`'s concrete subclasses, `Spelling` and `ReadPosition` for typed reads, `Order` per set, `LocalTarget`, `AdmissionTable`, the call-site census of `ConstantDefaultClassifier.IsAdmitted` (a syntax scan of `src/Sharpy.Compiler`, a table passed as a parameter followed to its callers: six sites, nine readers, eight generated, `IsExportedConstCompileTime` excluded), the Stdlib census of `FieldSignature` (`IsConst` × `IsGuarded`), the subclasses of `ClrMemberResolution` with a field refined by `FieldInfo.IsLiteral` and an enum owner, `EnumMemberAccessKind`, the pool's `Form`, the declared properties of the alias's three AST records, and target × use for an alias; each listed expression is checked against what discovery or `ClrMemberTypeResolver` answers for it. `Exclusions_RestingOnTheCompiler_GoRedWhenItChanges` runs 15 probes. The census has its own control (`ConstantReaders_TheCensusSeesACallSite_AndFollowsATableParameter`). -- **Mutations re-run, each ALONE, from a `cp` copy, restored by copy with a new modification time and confirmed by `cmp`** (the six facts that run no cell each time; the sweep alone for the known-red row): - - totality: the `kind:SPY0336` row deleted → both `RuleTable_` facts red, "matches no row" for 12 cells (2 failed, 4 passed); - - a passing case listed known-red (`read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeLiteralField/Math.PI Ice # #2432 ice`) → `ScopeMeaning_Sweep` red, "listed as Ice, now Match: STALE, delete the row" (1 failed); - - a reader removed (the struct auto-property entry) → `Axes_` red, "constant-kind × reader: CodeGenInfoComputer.cs:MarkStructConstructorProperty is neither generated nor excluded", and both `RuleTable_` facts (3 failed); - - PRODUCT side, never committed: a tenth `IsAdmitted` call in a new method of `CodeGenInfoComputer.cs` → `Axes_` red, "…:P78VerifyThreeMutation is neither generated nor excluded" (1 failed); - - the three the revising agent ran after its commit: the block `const` site emptied → "Block is listed with no host" (1 failed); the struct-const host given the class-const label → "class-const is the label of 2 hosts" (2 failed); own reads generated without the subclass receiver → "no cell carries Base" (1 failed); - - two expressions listed under each other's kind → `Axes_` red, "the checker's resolver answers Field/static for BitConverter.is_little_endian" and "… Property for Array.max_length" (1 failed); - - a probe handed a program that compiles (`int.max_value` for `int.nosuch`) → `Exclusions_` red, "rests on SPY0203, and the probe now gives [] stdout '1'" (1 failed); - - the (Itself, Used) exclusion removed → `Axes_` red, "alias-target × target × use: (Itself, Used) is neither generated nor excluded" (1 failed); - - **a control that stays green:** the `from math import pi` spelling of one module value removed → 6 passed. No fact holds the spellings a constant position is read under (finding 1); - - all restored → the full run above; `git status --short` empty. -- **A slip of this pass, undone:** a mistyped `touch` created an empty, untracked `CodeGenInfoComputer.cs` (0 bytes) in the compiler's `CodeGen` directory, where no such file belongs. It was moved out of the repository to the scratchpad before any commit. The first 7/0/0 run was built with that empty file in the compiler's source set; every mutation run and the full run above were built without it, and the solution was rebuilt before the full run. - -### Adequacy -- **Contract:** named — one answer per name for every binding kind, order, spelling and reading position; a refusal under one code where python's reading differs; a constant position refuses a non-constant itself. -- **Axes:** open: constant-kind × spelling and placement of the read ← `Spelling` and the reader's placement against the member's type (`DeclaringRelation`), as the typed-read set derives both from the 8951 pool; constant-kind × a referenced module's member ← the member collections of discovery's `ModuleOverloads` (`Functions`, `Types`, `Fields`; the census reads `Fields` alone). Closed, each with its assertion and that assertion's mutation: constant-kind × host (the reader census), a referenced type's member, the program's own enum, the program's own names, and the axes of the other five sets. The 8951 pool's rosters are P77a's and were not re-graded. -- **Cure:** seam + sweep — silent wrong behaviour, a position missing a shared check, SPY0908 as a net. -- **Harness:** named + allowlist delta (2368 seed rows; 829 rows of the new type). -- **Layer:** every decision rung-justified. D8's one rung-3 arm (a literal field of a referenced type, by `FieldInfo.IsLiteral` through `ClrTypeHelper`) has no lower rung: a referenced assembly's constant has no Sharpy source, dunder or protocol spelling. No rule reads a builtin or type name. - -### Scope & convergence -- **Group:** one (P78; chores none; #2432 in by R-KV) · **Alone:** no — required? no · **Gates:** 1 -- **Generator:** existing `NameResolutionDifferentialTests` + stage 0 @ 3a422a6fe, mutations re-run. Hand controls named: the project route (A3), which holds D1 and not D8 (finding 4); steer text and count per position × host. -- **Trackers named:** #2427, #2457, #2486, #2397, #2417, #2069, #2249, #2383, #2768, #2769 · **Fidelity rows:** named. -- **Convergence (contract §12):** the previous pass was NEEDS REVISION on Dimension 6 (the log's 2nd-pass line), so the rule was applied. Finding 1 is not deferrable: the spelling of a constant position's read is carried by hand (two receivers written into `BuildOwnReads`), a value missing from a hand-listed axis has no catcher, and its design row asks D8 for a sentence. NEEDS REVISION stands. Findings 2 and 3 are deferrable and are also written in the deferred-row form; finding 4 is a warning. - -### Findings -Each carries its label against the previous pass (19ffa7ad1). Programs are `sharpyc run` @ 56dbb009f (product code e24aaf9f0), each beside a control that runs. - -1. **A constant position's read has one spelling per name, written by hand, and an attribute argument has red ones** (Dimension 6, with a Dimension 4 design row on D8; **new**; not deferrable). D8 answers "under every spelling (N7)". The constant-kind set reads each of the program's names once: bare at module level, through its type's name, or through a subclass's, always from outside the type (`BuildOwnReads`: `"G."`, `"D."`). None of its 770 cells declares a type alias, renames an import or reads a sibling bare inside the member's own type. The 8951 pool does carry `Spelling`, and has no position for a lambda default, an attribute argument, a `const` outside a class or a struct auto-property. Removing one spelling from the set leaves every fact green (the control above). Red today at both attribute readers, where the same member through its type's name runs: - - bare, inside the member's own type: `class H:` / `const x: int = 5` / `@[system.component_model.default_value(x)]` on a method, and `@[Mark(w=x)]`: SPY0425 "'x' is not a compile-time constant". `H.x` there runs, and `def f(self, p: int = x)` in the same class runs `5`. The validator finds no symbol for an argument the checker never visited and falls back to module scope (`ResolveConstSymbol`); - - through a type alias: `type A = G` / `@[…default_value(A.x)]`, `@[Mark(w=A.x)]`, and `A.RED` of an int enum: CS0103 "The name 'A' does not exist" behind SPY0908. `G.x` and `E0.RED` there run, and through the alias a `def` default, a lambda default, a module `const`, an enum member's value and a struct auto-property all run `5`; - - and a silent one: `const x: int = 12` at module level, then `class H:` with `default_value(x)` on a method above `const x: int = 5`. It runs. The validator admits the module's constant, and the emitted `[System.ComponentModel.DefaultValue(X)]` sits inside `class H`, where C# binds `H.X` (read from `emit csharp`; the attribute's value was not observed at run time). Under D3 this is an at-or-after member with an outer binding: SPY0619 in every position. - - The design row: D8 has the checker check each attribute argument "as an expression (its names bound and refused by kind)" and does not say in which scope. A member's attribute stands in the class body, so D3 would decide its bare names (earlier: the member, and the first program runs; the third is SPY0619). A checker that binds them at module scope keeps SPY0425 or reads the module's. `ReadPosition` has no attribute argument, so no cell of either pool would tell the two implementations apart. -2. **The member-kind axis stops at a module's fields** (Dimension 6; **re-opened**: the log's 2nd-pass line says stage 0 closes the member-kind axis; deferrable). A referenced type's member is the image of `ClrMemberResolution`'s subclasses, a method and a method group included. A referenced module's member is the image of `FieldSignature`'s two facts, and discovery's `ModuleOverloads` holds `Functions` and `Types` beside `Fields`. `import math` / `def f(g: (float) -> float = math.sqrt)` is CS1736 behind SPY0908 (python `5.0`), as it is at a dataclass field, a struct field and a struct auto-property; at both attribute arguments it is CS0182. `const K: (float) -> float = math.sqrt` runs `5.0`, and `b: bool = math.sqrt` is SPY0220, so the checker binds it. D8 already answers false for it; no cell holds that answer. The type-member twin `Math.sqrt` has its 12 cells. -3. **Two exclusions rest on the compiler with no probe, and one states what the code does not do** (Dimension 7 and Dimension 1; **new**; deferrable). (a) `ExcludedClrTypeMemberShapes[InconclusiveResult]` says "the checker binds nothing". `TypeChecker.Expressions.Access.cs` types such a member `UnmappedClrType` in value position: `from system import DateTime` / `b: bool = DateTime.year` is SPY0220 "Cannot assign type 'object'", and `x: object = DateTime.year` is CS0120 behind SPY0908 in a function body, a parameter default, a module `const` and an attribute argument alike. The exclusion stands for another reason: the crash is the same at every position, so it is a missing kind refusal and no constant position's defect (the pass report's ledger; candidate tracker #1975). (b) `ExcludedAliasUses[(Itself, Used)]` cites #2769 and has no probe because the overflow kills the process (re-measured: `type K0 = list[K0]` named by a parameter exits 134). When #2769 is fixed, nothing goes red to say the used cells are owed. -4. **The project route has no control for D8** (Dimension 7; **new**; a warning). The plan says "Beyond the generator: … the project route (A3)", and the census excludes its ninth reader (`IsExportedConstCompileTime`) on the same words. A3 holds a variable's export identity, which is D1's. Nothing holds an imported `const` in a constant position: with `consts.spy` beside `main.spy`, `from consts import K` / `def f(p: int = K)`, `def g(p: int = consts.C)` and an imported class's `G.y` print `5 5 9` today, and the two cross-module fixtures (`const_ref_cross_module`, `const_chained_cross_module`) read the constant in a local and in a `const` initializer only. D8 re-answers every bound name, and an imported constant's fact has its own producer. Expected: a multi-file control per importer form at a parameter default, with the mutation "answer false for an imported constant → SPY0401". - -Against the previous pass's six findings: 1 (a referenced type's literal) is answered in D8 and held by the `ClrTypeLiteralField` cells at every host, with the axis re-opened for a module's functions (finding 2 here). 2 (the struct auto-property host and the reader census) is answered, with its mutations above. 3 (attribute arguments are unchecked) is answered in D8 and T10, with the scope left open (finding 1's design row). 4 (the unused self-reaching alias) is answered by 126 must-run cells, all green. 5 (D10's module-level judgement) stays the owner's deferred row, carried below. 6 (the delegate exclusion's reason) is answered, with its probe. - -**settled** (an owner ruling decides it; not raised): a string enum's member, its `.value` and any `.name` are SPY0401 in a constant position (ruling 10, comment 7045166298; residue #2772); the struct auto-property host must run (ruling 8); a literal field of a referenced type is admitted (ruling 7); a used self-reaching alias is out of P78 and D10's module-level judgement is deferred (ruling 9); `math.pi` as a default is SPY0401 and #2432 closes on that (ruling 4); #2487 stays open (ruling 6). **declined:** none in the log. **churn:** none; no cure above undoes an answer a revision gave. - -Decisions that are the owner's (this pass asked nothing and offers no further pass): -1. **Finding 1**, with finding 2 riding the same commit. (a) One more stage-0 commit and a revision: the constant-kind set takes the read's spelling and placement as an axis (the image of `Spelling` and of the reader's placement, at each host the 8951 pool has no position for), the module-member roster reads every member collection of `ModuleOverloads`, and D8 gains the sentence that says where an attribute argument's names bind (suggested: in the scope its declaration stands in, so D3 decides a member's attribute). `allowlist_rows_outside_seed` rises by the measured red count, which needs the owner's word. (b) The owner rules the axis closed at the two receivers generated: the plan lists it under "Closed by decision", the three attribute programs above become a named hand control in A9, and D8 still gains its sentence; no stage-0 commit. (c) Attribute arguments keep today's verdicts for the spellings not generated, the cells go to #2432 as a comment, and #2432 does not close on A9 alone. Recommended: (a). D8's cure as written probably reaches all three programs; what is missing is the pin and one sentence, and the typed-read set already shows the derivation. -2. **What follows the revision.** The cap is spent and so is the extra pass. A fourth pass runs only on the owner's own words; without one, `/implement-plan` needs the owner's `override:`. The three passes found seven open axes, then two, then one axis and one roster source, and no decision from D1 to D10 was refuted in this pass. - -### Falsifiability -- A1 / M1, A2 / M2 (three, the in-progress mark now among them), A3 / M3, A4 / M4 (and the census pin), A5 / M5 (four), A6 / M6 (two), A7 / M7 (with its control), A9 / M9 (seven), A10 / M10, A13 / M13 (three): mutation named; exemption not subject; positive control yes; by-direction specified (A8). -- M9's anchors re-measured today: a default through `math.pi` and a struct auto-property's through `H.x` are CS1736; `RED = x` is CS0133; `int.max_value` as a default runs `2147483647`; an instance field at an attribute argument is CS0120; `subprocess.PIPE` there is CS0103; `0 < 2 in [1, 2]` as a default is SPY0401. M13's third: exit 134. M2's third: the ring of two `auto` lambdas runs `1`. -- D8 on the project route: mutation MISSING — expected: answer false for an imported `const` → `from consts import K` / `def f(p: int = K)` SPY0401; restored → `5` (finding 4). -- M13's third mutation ends the test host with a stack overflow: its red is a dead process, not a failed assertion. -- A8 (the direction record): every code. Checking attribute arguments is a new refusal channel for any program whose attribute argument C# accepts and the checker does not; A8's "under any code" and the gate hold it. -- A11: each example discriminates. A12: an absence assertion whose positive control is the staleness gates. -- Stage 0's facts and sweeps: mutations re-run above, each alone. - -### Deferred findings -- (not CONVERGED; findings 2 and 3 in the form a CONVERGED stamp would list them, and the owner's deferred row carried from the log) -- constant-kind × a referenced module's member ← the member collections of `ModuleOverloads` — fix: the universe of `Partition("constant-kind × module value", …)` gains `Functions` (a kind with its expression, `math.sqrt` read uncalled) and `Types` (excluded: names a type) — proved by `Axes_EveryValueIsGeneratedOrExcluded` (red until the kind has an expression) and `ScopeMeaning_Sweep` (the cells are red until T10: rows under the owner's word for the baseline, or cells that land with T10's commit). -- `ExcludedClrTypeMemberShapes[InconclusiveResult]` ← `TypeChecker.Expressions.Access.cs` (the `InconclusiveResult` arm types the member `UnmappedClrType`) — fix: the reason's text, and a probe (`x: object = DateTime.year` in a function body is SPY0908 CS0120) — proved by `Exclusions_RestingOnTheCompiler_GoRedWhenItChanges` and the orphan check in `Axes_…`. -- `ExcludedAliasUses[(Itself, Used)]` ← #2769 — fix: a probe that runs the compiler in a child process and expects exit 134, or the pair generated in the commit that fixes #2769 — proved by that probe going red when the overflow stops. -- D10's module-level judgement ← the pipeline order — fix: judge the target once every type and import is declared — proved by the `dotted` and `Later` must-run cells (owner, ruling 9). - -### Warnings -- Finding 4: the project route's control for D8. -- T3 names "the `TypeChecker*.cs` files holding the 33 sites": 33 re-measured, in nine files. The census pin is the catcher. -- The plan no longer names the gate's local fallback or the control run at the base for a red (CLAUDE.md carries both), and states no verify cost or prober budget (Dimension 9's filing budget). -- A1's, A4's, A5's and A6's "which decision drains which rule" is the author's reading, not run. -- `x: object = DateTime.year` (CS0120 behind SPY0908 at every position) is outside this plan's contract: the pass report's ledger. - -### Missing Steps Added -- None added to the body (the cap). For the revision: D8's sentence on where an attribute argument's names bind; the constant-kind spelling axis and the module-member roster in a stage-0 commit; the project-route control for D8 in A9 or the Testing Strategy; the two probes. - -### Unchecked Claims -- D2's pre-pass and first-read check drain the typed-read rows that cite #2423: a design with no prototype. That D2 also types the #2417 cells: not run; the ratchet's STALE arm reports it. -- D5's "one resolver carries all 33 sites": the count is measured, the rest untraced. -- D1's cold and warm export identity and the bridge arm's deletion: not run. -- D8 as rewritten drains the 216 #2432 rows: read against the rule table (each kind's row matches D8's true and false lists), not prototyped. That `TypeChecker.Definitions.cs` is where the attribute-argument check lands and `ClrTypeHelper` the home of the literal fact: the author's inference. -- A missing member at an attribute argument is CS0117 behind SPY0908 today (`default_value(H.nosuch)`, measured); that the checker's SPY0203 replaces it rests on D8's check. -- "No snapshot moves" (A12): the regeneration after T1 and T4 proves or refutes it. -- A11's 22 declarations in five spec files, and that each becomes SPY0620: pass 1's count, not re-taken. The 4,565 `.spy` files: re-counted, 4,565. -- Which interpreter the sweep's python arm picked: not read from the run; the cells agreed 30/30, and `.venv/bin/python3` is 3.15.2. -- "A module initializer under a later same-named declaration (`2`, python `7`)": the pair follows the pool's convention (the module's later declaration against the builtin). One program of that shape was run (`x: int = len([1, 2])` above `def len`: Sharpy reads the module's, python the builtin's), not the pool's own cell. -- Not run: a control at the base sha (product code at this tip is the base's); `check_spec_blocks.sh` (no spec or product path moved since the pass that ran it; CI at this tip is green); the whole `build_tools/tests` suite (two tests of `test_check_review_line.py` fail in this shallow clone, as before); the hand controls' own mutations; a local whole-solution gate (CI at this tip is green). +- @ 656991807 — revised after the 2nd pass (NEEDS REVISION, Dimension 6): stage 0's member-kind axis and reader census; D8 per bound name (findings 1–3); 4, 6 and D2's mark folded. Deferred (owner): D10's module-level judgement ← the pipeline order — fix: judge the target once every type and import is declared — proved by the `dotted` and `Later` must-run cells. +- @ 56dbb009f — revised after the 3rd pass (NEEDS REVISION, Dimension 6): stage 0: a constant position's spelling and placement, a module's functions, a declined method, a probe per compiler-resting exclusion; D8: an attribute argument's scope; A14 (findings 1–4). From 5e9277523c07a8e029e8dd41be6ba750e067b49f Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 20:05:58 +0000 Subject: [PATCH 17/22] =?UTF-8?q?process(plan):=20plan-777361=20=E2=80=94?= =?UTF-8?q?=20verified=20NEEDS=20REVISION=20@=2073c785856?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /verify-plan pass 4 of plan-777361 (P78), the extra pass the owner asked for (#2423 comment 7046359997). Adequacy CELL; Dimension 4 (a design row on D8) and Dimension 6. The stamp and the Verification Summary only; the plan body is unchanged. Two findings are not deferrable: - D8 reads a referenced type's constant by FieldInfo.IsLiteral, so a decimal constant (decimal.one as a parameter default, which runs today at a def, a lambda, a dataclass field and a struct field) would become SPY0401 with no cell to notice. - A constant position's hosts are the classifier's own call sites, one hand-written program each: a delegate's default, an interface's signature-only method's default and attributes on other targets are red today outside them. Measured @ 73c785856 (product code e24aaf9f0): the two generated types 241/0/0; with the four neighbouring types after the last mutation was restored, 346/0/0. Seven mutations re-run, each alone, restored by copy. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01LGMKZVcFYGqQRfHgd16DLa --- docs/process/plans/plan-777361.md | 127 +++++++++++++++++++++++++++++- 1 file changed, 126 insertions(+), 1 deletion(-) diff --git a/docs/process/plans/plan-777361.md b/docs/process/plans/plan-777361.md index a0550d6cf..2c5bd78c8 100644 --- a/docs/process/plans/plan-777361.md +++ b/docs/process/plans/plan-777361.md @@ -1,4 +1,7 @@ - + + + + # P78 — N1/N2/N4/N7: scope decides meaning @@ -138,3 +141,125 @@ No rule below reads a builtin or type name; a rung applies only in D8. - @ a7fbd945d — revised after the 1st pass (NEEDS REVISION, Dimension 6): S0b's seven axes closed; D2 with no SPY0240 arm. - @ 656991807 — revised after the 2nd pass (NEEDS REVISION, Dimension 6): stage 0's member-kind axis and reader census; D8 per bound name (findings 1–3); 4, 6 and D2's mark folded. Deferred (owner): D10's module-level judgement ← the pipeline order — fix: judge the target once every type and import is declared — proved by the `dotted` and `Later` must-run cells. - @ 56dbb009f — revised after the 3rd pass (NEEDS REVISION, Dimension 6): stage 0: a constant position's spelling and placement, a module's functions, a declined method, a probe per compiler-resting exclusion; D8: an attribute argument's scope; A14 (findings 1–4). + +## Verification Summary + +**Result:** NEEDS REVISION (Dimension 4, a design row on D8, and Dimension 6). This is the fourth pass, the extra one the owner asked for (#2423 comment 7046359997), so the open findings go to the owner (R-LW). +**Adequacy:** CELL +**Verified on:** 2026-11-20 @ 73c785856 (product code == e24aaf9f0; stage 0 @ 0fe74e4c1; the solution, Debug `sharpyc` and the test binaries rebuilt at this tree; python = CPython 3.15.2, `.venv/bin/python3`) +**Plan file:** `docs/process/plans/plan-777361.md` (committed in §4 at every result, NEEDS REVISION included) + +### Paraphrase +- **Changes:** a module-level or class-level name gets one meaning, one type and one legality verdict whatever its binding kind, order, spelling and reading position. Name resolution declares every module variable up front, annotated or `auto`; the checker completes that symbol and creates none, and a variable's export is that symbol cold and warm, so two bridging maps are deleted (D1). `CheckModule` resolves every declared type (module variables and properties, each type's annotated members, nested types) before any body or initializer; an unannotated value is checked at its first read under an in-progress mark, and a read that re-enters its own inference stays untyped and adds no refusal (D2). One class-body rule decides a bare sibling read from the member's level, its order against the reader, an outer binding of the name and the position: earlier is the member; at-or-after under an outer binding is the new SPY0619 for every kind and position, judged before the kind refusal and SPY0401; at-or-after with none is a forward read; F1, F2, the `const` exemption and the later-const report go (D3). A nested type's body, a lambda in an initializer and a comprehension's body stop seeing an enclosing type's variables bare, each with its phrase in SPY0200; types, aliases and functions still bind; under an outer binding the read is that binding (D4). A bare callee resolves by the walk a bare read uses; 33 direct lookup sites go behind one resolver with a census pin (D5). A load-time read of a builtin name its module declares at or after the reader is SPY0619 (D6). A module variable, a `@static` field and a module or `@static` auto-property with no initializer is the new SPY0620 (D7). A constant position gets one answer per name the checker bound: true for a `const` whose fact is true, an int enum's member and its `.value`, and a literal field of a referenced type or module; false for every other bound name. Every classifier call passes that answer: a `const` handed a non-constant is computed, a struct auto-property keeps a non-constant initializer and runs, the validator judges an enum member's value, pushes interface and union hosts, and refuses an attribute argument under SPY0425 once the checker has checked it in the scope its declaration stands in; the attribute printer takes the ordinary read route; a chain is admitted link by link (D8). SPY0618 retires and one commit re-labels the table and the generator's arms (D9). An alias whose target names a missing type is SPY0202 at the alias at every site and shape, used or not; a target that reaches its own alias is not expanded (D10). The spec is rewritten around N1–N7; a row drains in the commit that turns it green; #2487 stays open. · **Today:** by the plan, the known-red rows are the state: order and kind decide (a later `@static` yields, `64`; a later literal `const` outranks, `3`), a forward read is untyped and a callee keeps its own lookup (`x()` on a parameter under a module `def x` prints `12`), a constant position reaches C#, and a module `x: T` reads `0`. Instruments: an 8951-case pool with 2368 known-red rows and a 4682-case generated type with 1383. · **Could not paraphrase:** none. Two sentences leave a reading open and are raised below: D8's "a type's or enum's by `FieldInfo.IsLiteral`" beside its predicate "no constant admitted today is refused" (finding 1), and D4's "a lambda in an initializer", which does not say whether the lambda's parameter default is part of it (finding 5). + +### Corrections Made +- The DRAFT marker is replaced by this pass's stamp. Nothing else was changed: the body is 20,473 of 20,480 bytes, and every finding below grows it or is the author's or the owner's. The `Extra verify pass 4` line was already in `## Scope` and matches the owner's words in comment 7046359997 letter for letter. + +### Stage 0 checks (contract §11) +- **Path check:** `git merge-base origin/dev 0fe74e4c1` = e24aaf9f0 (`origin/dev` is now 11b0e95aa). `git diff --name-only e24aaf9f0..0fe74e4c1 -- ':!docs/process/plans/'` lists `build_tools/scorecard-baseline.json` and 14 files under `src/Sharpy.Compiler.Tests/Conformance/`. Not seeded. No product path differs from e24aaf9f0. PASS. +- **Green @ 73c785856 (measured):** the two generated types, 241 passed / 0 failed / 0 skipped (11.3 min). After the last restore, the two types with `ClassBodyReadPositionMatrixTests`, `StaticInitializerOrderMatrixTests`, `ConstantPositionValidator*` and `CiFilterCoverageConformanceTests`: 346 / 0 / 0 (11.1 min). `ScopeMeaning_Sweep`, from its own report: pool 4682 (2139 must-run, 2543 must-refuse), python agreed 30/30, red 1383, allowlist 1383; no-initializer 318 / red 72, typed-read 1308 / 430, callee 120 / 40, constant-kind 2382 / 770, init-overload 8 / 1, alias-target 546 / 70; cites #2147 17, #2417 150, #2423 555, #2432 661. `ClrTypeDeclinedMethod`: 78 cells, 42 red. The 8951 pool ran 8951 cells with 2368 red (1167 silent-wrong, 928 ice, 273 false-refusal), allowlist 2368, `CellBudget` 8951. Rule table: 222 rows, 52 rules. `scorecard_metrics.py --check`: OK (outside seed 1955, seed 2368). `pytest build_tools/tests`: 2216 passed, 2 failed, both `test_check_review_line.py::test_real_lines_on_real_history` with "no merge base" (the clone is shallow). +- **The 829 rows of the previous stage-0 commit:** 619 are in the file verbatim. The other 210, all constant-kind, were re-keyed, and each has a successor row with the same class and cite (153 by id prefix, 57 by the label the new id spells differently). The programs were not compared by source. +- **The enumeration and the totality assertions, as read.** A cell's tag and rule come from its one row of `name-resolution-rules.txt`. `Axes_EveryValueIsGeneratedOrExcluded` partitions with no default arm. In the constant-kind set its sources are: the call-site census of `ConstantDefaultClassifier.IsAdmitted` (hosts) and `AdmissionTable`; `ScopeKind` and `TypeKind` for a `const`; the properties of `ModuleOverloads` and the shapes a Stdlib census finds under them; the subclasses of `ClrMemberResolution`, three of them refined by what reflection finds; `EnumMemberAccessKind`; `BindingKind`; the pool's `Form`, `Spelling` and `DeclaringRelation`; `ImportBindingForm`, `ImportKind` and the star flag. Per host it asks for a cell or a reason for every (kind, spelling, placement) that `OwnSpellings` derives from the typed-read set's readers, and for every referenced member under every spelling. A bare sibling needs both orders, with and without a module binding. 26 probes run in process and one in a child process. +- **Mutations re-run, each ALONE, from a `cp` copy, restored by copy, confirmed by `cmp`, then touched** (the seven facts that run no cell and the pool's `RuleTable_` fact, unless said): + - totality: the constant-position N2 row deleted from the table → `RuleTable_EveryCaseHasOneRow_…` red, "matches no row" for its cells, and `Ratchet_` red (2 failed, 6 passed); + - a passing case listed known-red (`read/constant-kind/ParameterDefault/def/OwnMember/ClassLiteralConst/Annotated/Alias Ice # #2432 ice`) → `ScopeMeaning_Sweep` red, "listed as Ice, now Match: STALE, delete the row" (1 failure; the sweep alone, 5.4 min); + - one member loses one spelling (`math.pi`, from-import; the control that stayed green in pass 3) → `Axes_` red, "no cell reads StdlibModuleVariable math.pi under from-import" (1 failed, 7 passed); + - own reads not generated under `Alias` → `Axes_` red, "own spelling: Alias is neither generated nor excluded" and the per-host lines (1 failed); + - the N2 cite rule removed from `ProposedCite`, on the committed text → `Ratchet_` red (1 failed); + - the crash probe handed a program that compiles → `Exclusions_RestingOnACompilerCrash_…` red (1 failed); + - a probe of this pass, never committed: `Decimal.one` listed under `ClrTypeLiteralField` → `Axes_` red, "the checker's resolver answers Field/static for Decimal.one" (finding 1); + - not re-run: the other 25 of the 31 mutations in 0fe74e4c1's body; + - all restored → the 346 / 0 / 0 run above; `git status --short` empty. + +### Adequacy +- **Contract:** named — one answer per name for every binding kind, order, spelling and reading position; a refusal under one code where python's reading differs; a constant position refuses a non-constant itself. +- **Axes:** open: constant-kind × host ← the declarations that hold a constant slot, which the classifier's own call sites are not: the AST records that declare `Parameters` (`FunctionDef`, `LambdaExpression`, `DelegateDef`, `PropertyDef`, `EventDef`) and `Decorators` (ten records), with a `def`'s place refined by `ScopeKind` × `TypeKind` × body-or-signature, as `ConstSites` already refines a `const`'s (finding 2). Open: constant-kind × a referenced type's field ← what C# reads as a constant from metadata, which is `FieldInfo.IsLiteral` or a `DecimalConstantAttribute` (finding 1). Closed, each with its assertion and that assertion's mutation: the member's spelling and placement, a referenced module's member collections, the program's own enum and names, the tables, and the axes of the other five sets. The 8951 pool's rosters are P77a's and were not re-graded. +- **Cure:** seam + sweep — silent wrong behaviour, a position missing a shared check, SPY0908 as a net. +- **Harness:** named + allowlist delta (2368 seed rows; 1383 rows of the new type). +- **Layer:** every decision rung-justified. D8's one rung-3 arm has no lower rung (a referenced assembly's constant has no Sharpy source, dunder or protocol spelling); finding 1 is about which CLR fact that arm reads, not its rung. No rule reads a builtin or type name. + +### Scope & convergence +- **Group:** one (P78; chores none; #2432 in by R-KV) · **Alone:** no — required? no · **Gates:** 1 +- **Generator:** existing `NameResolutionDifferentialTests` + stage 0 @ 0fe74e4c1, mutations re-run. Hand controls named: the project route (A3, A14; A14's programs re-measured, below), steer text and count per position × host. +- **Trackers named:** #2427, #2457, #2486, #2397, #2417, #2069, #2147, #2249, #2383, #2768, #2769 · **Fidelity rows:** named. +- **Convergence (contract §12):** the previous pass was NEEDS REVISION on Dimension 6 (the log's 3rd-pass line), so the rule was applied. Finding 1 changes a `## Design Decisions` predicate, or needs a ruling for a `worked` → refused change: not deferrable. Finding 2 is values missing from a hand-listed axis, with no catcher, and its cure adds text to D8: not deferrable. NEEDS REVISION stands. Finding 4 is deferrable; findings 3 and 5 are warnings. + +### Findings +Each carries its label against the previous pass (620dfff80). Programs are `sharpyc run` @ 73c785856 (product code e24aaf9f0), each beside a control. + +1. **D8 refuses a constant that runs today: a `decimal` constant of a referenced type** (Dimension 4, a design row on D8, with Dimension 6 on the type-member axis; **re-opened**: the log's 2nd-pass line answers pass 2's finding 1 with "D8 per bound name", and ruling 7 admitted "a literal field"; not deferrable). D8 answers true for a type's field "by `FieldInfo.IsLiteral`" and false for "a CLR static that is no literal". C# compiles `const decimal` to a `static readonly` field carrying `DecimalConstantAttribute`, which is no literal in metadata, and reads it back as a constant. So today: + - `def f(p: decimal = decimal.one) -> decimal` prints `1`; `from system import Decimal` / `= Decimal.one` prints `1`; `= Decimal.max_value` prints `79228162514264337593543950335`; through `type A = Decimal`, `= A.minus_one` prints `-1`; + - the same default runs at a lambda (`1`), a `@dataclass` field (`1`), a struct field (`1`) and a struct auto-property (`1`); + - the checker binds the read: `b: bool = decimal.one` is SPY0220 "Cannot assign type 'decimal'"; + - at an attribute argument it is CS0182 behind SPY0908 (C# takes no `decimal` attribute argument), so the kind is a constant at the default hosts and none at an attribute. + + Under D8 as written the four defaults become SPY0401: `worked` → refused with no ruling (contract §3), against D8's own predicate "no constant admitted today is refused" and the Adversarial Review's "D8 refuses nothing that runs". Nothing notices. The generator refines a field by `IsLiteral` alone (`ClrTypeMemberShape`), the `Field/static` kind has one hand-chosen member (`BitConverter.is_little_endian`, CS1736 today), and its row says must-refuse; with `Decimal.one` listed under the literal kind, `Axes_` answers "the checker's resolver answers Field/static for Decimal.one". No fixture, spec block or `.spy` file gives a parameter or field a `decimal` constant as its default (grep over `src` and `docs`: 0 hits), so A8's record and the gate stay green. Neither the Stdlib nor Core declares a `const decimal`, so a module's `IsConst` (also `field.IsLiteral`, `OverloadIndexBuilder.cs`) has no member of the shape today. +2. **A constant position's hosts are the classifier's own call sites, one hand-written program each; three kinds of host outside them are red** (Dimension 6, with a design row on D8; **re-opened** for the host axis: the log's 2nd-pass line says "reader census", and ruling 8 pinned hosts to it; **new** for the attribute target, which is the revision's own item 16; not deferrable). The census finds where the validator already asks. A position nobody asks about has no call to find, and a reader with two kinds of host has one program. + - **A delegate's parameter default has no reader.** `delegate D(x: int = H.x) -> int` with `x` a `@static` field is CS1736 behind SPY0908. So are `= math.pi`, `= five()`, `= [1]` and a string enum's member; `= y` with `y` a module variable, and a bare sibling in a class's own delegate, are CS0103. Controls: `= 5` and `= H.X` with `X` a `const` run (`6`). No validator method visits a `DelegateDef`; the emitter writes the default through `GenerateParameter` (`RoslynEmitter.TypeDeclarations.cs`, one of five `GenerateParameterDefault` call sites). The test's remark "the one constant position no classifier call judges: an enum member's value" is refuted. + - **An interface's signature-only method is not checked.** `interface I:` / `def m(self, p: int = H.x) -> int: ...` is CS1736; so are `= math.pi`, `= sys.maxsize` and a string enum's member. `p: bool = H.x` there is CS1736 and not SPY0220, and `= H.nosuch` is CS0117: the checker never visits this default. The other way, a bare sibling `const X` as that default is SPY0401, where a class's method runs it. The same method with a body, and an `@abstract` method of a class, are SPY0401 for `H.x`. D8 answers "per name the checker bound", and nothing is bound here, so the shape rule keeps admitting `H.x`. A10 holds the diagnostic count of one bare read and no verdict. + - **Attribute targets (item 16).** The cells attribute a method of a class. With `G.y` a `@static` field as the argument: a class, struct, interface, union, nested class, field, `@static` field, property, event, module `def` and `@static` method are CS0182 like the generated host. An enum, an interface's method and a local `def` run and print `1`: the emitter drops the attribute there (read from `emit csharp`: `[Mark(W = 5)]` is on the class and on none of the three). A union's attribute is not validated at all: `ConstantPositionValidator` visits eight of the ten AST records that declare `Decorators`, not `UnionDef` or `DecoratedStatement`. D8's sentence gives each target its scope (a class's attribute stands at module level, a member's in its type's body, a local `def`'s in its function), and only one of those scopes has a cell. + + The design rows: D8 does not say that a delegate's default is judged, that the checker checks a signature-only method's defaults, or which declarations' attributes it checks. An implementation that follows D8 to the letter leaves every program above as it is, and every S0b cell green. +3. **Ruling 6 says the plan lists #2487's remainder, and the revision cut the list** (Dimension 1, an owner ruling; **new**; a warning). Comment 7039834146 item 6: "The plan lists the remainder (rows written from the rules, the generator reading its verdict from the table, every rule id in `name-resolution.md`)". The Class trackers line now reads "#2487 stays open (owner)", and the Context clause that named the drift guard is gone too. The list is still in the comment the plan cites, so an implementer loses nothing they cannot find. Restoring it costs about 150 bytes the cap does not have; a pointer ("ruling 6") costs 3. Not corrected inline: which text gives way is the author's. Nothing else the revision cut is needed by an implementer (each cut clause is carried by A12, D9, T8, a mutation's anchor or a symbol name grep finds). +4. **The builtin-name spelling is on one kind** (Dimension 6; **new**; deferrable). `BuiltinName` is set on `Int32` alone, so only the literal kind is read as `int.max_value`; the axes fact asks for one such cell in the whole set. `def f(p: str = str.empty)` is CS1736 like its `String.empty` twin, so no verdict differs today. +5. **A lambda's default in a class-level initializer** (Dimension 4, D4; **new**; a warning). `class H:` / `const x: int = 5` / `@static` / `g: auto = lambda p: int = x: p` is SPY0200 with the method-body steer today. CPython 3.15.2 prints `5` for the twin (`g = staticmethod(lambda p=x: p)`): a default is evaluated in the class's scope, and a `def`'s default in the same class reads the member. D4 names "a lambda in an initializer" and does not say on which side its parameter default falls; A6's control holds the lambda's phrase and no default. + +Against the previous pass's four findings: 1 (the spelling of a constant position's read) is answered: the alias, bare-sibling and N2 cells exist and are red as measured then (CS0103, SPY0425, a silent `1`), with their mutations above. 2 (a module's functions) is answered by the `ModuleFunction` and `ModuleFunctionGroup` cells. 3 (two exclusions with no probe) is answered, and the declined method it uncovered is generated (item 15, below). 4 (the project route) is answered by A14, re-measured: with `consts.spy` beside `main.spy` under `sharpyc project`, an imported literal `const` and an imported class's `const` at a parameter default print `5 9` under all five importer forms; an imported computed `const` is SPY0401 under the three from-import forms and CS1736 behind SPY0908 through `consts.Q` and `c0.Q`. + +**settled** (an owner ruling decides it; not raised): a string enum's member, its `.value` and any `.name` are SPY0401 (ruling 10); `math.pi` as a default is SPY0401 and #2432 closes on that (ruling 4); the struct auto-property host must run (ruling 8); a literal field of a referenced type is admitted (ruling 7); a used self-reaching alias is out of P78 and D10's module-level judgement is deferred (ruling 9); #2487 stays open (ruling 6); spelling and placement are an axis derived as the typed-read set derives them, which has two placements (ruling 12); a module's functions, the two probes and the project control ride the revision (ruling 13). **declined:** none in the log. **churn:** none; no cure above undoes an answer a revision gave. + +### The two defaults of comment 7048618066 (not owner rulings) +- **Item 15, the declined method as its own kind: sound; it needs no word beyond ruling 12's baseline raise.** Re-measured: `Char.is_ascii_digit` read uncalled into an `object` slot runs in a function body (`True`) and at a `const` (`True`), and is CS1736 at a parameter default and CS0182 at an attribute argument. The checker types it `object` (`b: bool = …` is SPY0220), so it is a bound name D8 answers false for, and each cell turns an ICE into a diagnostic; nothing that runs is refused. Excluding it would leave the ICEs with no cell. Whether D8's member hook sees a read the bridge declined is not shown; the 42 rows are the catcher (A9 fails while they stand). `Array.resize` uncalled is CS8917 in a function body and at a `const`, as its exclusion says. +- **Item 16, one attribute target: not sound as a default.** It is the third part of finding 2: three targets drop the attribute, one is never validated, and each target stands in its own scope. It needs the axis closed or the owner's word. + +### The hand lists the revision names +- one host program per reader call site: an open axis (finding 2). +- attribute target: an open axis (finding 2, item 16). +- one or two members per kind: reasonable where the kind's fact decides the verdict, and each member is checked against discovery or the resolver. Refuted for `Field/static`, whose fact is not the one C# reads (finding 1). +- one int-valued declaration per own kind: can be left. The verdict reads the binding kind and the `const` fact, never the declared type; a `float` const at a lambda default (`1.5`), an enum-typed const at a `def` default (`5`) and a `str` const at an attribute argument (`1`) run. +- one outer binding per sibling form: can be left. D3 reads whether an outer binding holds the name, and the 8951 pool carries the outer kinds at its three constant-only positions. +- the builtin-name spelling (`int` only): a small open roster with its catcher (finding 4). +- the subclass receiver from outside only: can be left; the pool has the `Base` relation at its constant-only positions. +- placements Enclosing and Sibling closed by decision: consistent with ruling 12 as worded. +- the census's namespace (`System`): can be left; it is a reflection census with its own control, and the shape it holds at 0 needs a static whose type has no Sharpy spelling. +- a type that fails to load: can be left; no program names one. + +### Decisions that are the owner's (this pass asked nothing and offers no further pass) +1. **Finding 1.** (a) D8's rung-3 fact becomes what C# reads as a constant from metadata (`FieldInfo.IsLiteral`, or a `DecimalConstantAttribute`), not admitted at an attribute argument; one stage-0 commit adds the shape with `Decimal.one` (must-run at the default hosts, must-refuse at an attribute), and M9 gains "answer false for a decimal constant → `decimal.one` SPY0401". (b) The owner rules a `decimal` constant refused as a default: the Adversarial Review's by-direction list gains it, and the same cells are must-refuse. Recommended: (a); it is ruling 7's own answer for one more constant, and C# admits it. +2. **Finding 2.** (a) One stage-0 commit and a revision: the host axis is the image of the AST records that declare `Parameters` and `Decorators`, a `def`'s place refined as a `const`'s is; D8 says a delegate's default is judged, and that the checker checks a signature-only method's defaults and every declaration's attribute arguments; `allowlist_rows_outside_seed` rises by the measured red count, which needs the owner's word. (b) The owner rules the hosts closed as generated: the delegate, interface-signature and attribute-target programs go to #2432 as cells, D8's predicate is narrowed to the hosts named, and #2432 does not close on A9 and A14 alone. (c) A middle: D8 gains the three sentences and A9 a named hand control per host, with no stage-0 commit. Recommended: (a). Passes 2, 3 and 4 each found a host the census could not see. +3. **What follows the revision.** The cap and both extra passes are spent. A fifth pass runs only on the owner's own words; without one, `/implement-plan` needs the owner's `override:`. The four passes found seven open axes, then two, then one axis and one roster source, then one axis and one CLR fact. No pass refuted D1 to D7, D9 or D10. + +### Falsifiability +- A1 / M1, A2 / M2 (three), A3 / M3, A4 / M4 (and the census pin), A5 / M5 (four), A6 / M6 (two), A7 / M7 (with its control), A9 / M9 (eight), A10 / M10, A13 / M13 (three), A14 / M14: mutation named; exemption not subject; positive control yes; by-direction specified (A8). +- M9's and M14's anchors, read from this pass's run: a default through `math.pi` and through `math.sqrt`, and a struct auto-property's through `G.x`, are CS1736; an alias at an attribute argument is CS0103; a bare sibling `const` there is SPY0425; bare imported `PIPE` as a default is SPY0401; an imported computed `const` through `m.Q` is CS1736. +- D8 for a `decimal` constant: mutation MISSING — expected: answer false for it → `def f(p: decimal = decimal.one)` SPY0401; restored → `1` (finding 1). +- D8 at a delegate's default, a signature-only method's default and an attribute on another target: no cell and no hand control, so no mutation can be named (finding 2). +- M13's third mutation ends the test host with a stack overflow: its red is a dead process, not a failed assertion. +- A8 (the direction record) reads fixtures, spec blocks and `.spy` modules; a program none of them holds is outside it (finding 1's is one). +- A11: each example discriminates. A12: an absence assertion whose positive control is the staleness gates. +- Stage 0's facts and sweeps: mutations re-run above, each alone. + +### Deferred findings +- (not CONVERGED; the deferrable findings in the form a CONVERGED stamp would list them, and the owner's deferred row carried from the log) +- constant-kind × the builtin-name spelling ← the referenced types that have a builtin name — fix: `BuiltinName` on a `Decimal` and a `String` member, and `Owed` asks the spelling of every member that has one — proved by `Axes_EveryValueIsGeneratedOrExcluded` ("no cell reads … under builtin-name") and `ScopeMeaning_Sweep`. +- `EnumMemberHost`'s remark ← the emitter's five `GenerateParameterDefault` call sites — fix: the text, once finding 2 is decided — proved by the host axis's own assertion. +- D10's module-level judgement ← the pipeline order — fix: judge the target once every type and import is declared — proved by the `dotted` and `Later` must-run cells (owner, ruling 9). + +### Warnings +- Findings 3 and 5. +- The plan names no local fallback for the gate, no control run at the base for a red, and no verify cost or prober budget (CLAUDE.md carries the first two; Dimension 9's filing budget). +- A1's, A4's, A5's and A6's "which decision drains which rule", and each row's cite, are the author's reading; the ratchet's STALE and cite arms are the catcher. +- Cells outside this plan's contract, for the lead's ledger (the pass filed nothing): a bracket attribute on an enum, an interface's method or a local `def` is accepted and dropped (silent-wrong · program; no open tracker found; the spec's target list names methods and not enums). `case math.pi:` is #2771's, already open. + +### Missing Steps Added +- None added to the body (the cap). For the revision: D8's fact for a referenced constant, and its sentences on a delegate's default, a signature-only method's defaults and the attribute targets; the host axis in a stage-0 commit; ruling 6's list or its pointer. + +### Unchecked Claims +- That D8 as written drains all 661 #2432 rows, the alias-at-attribute CS0103 cells and the 42 declined-method rows among them: read against the rule table, not prototyped. The rows are the catcher. +- The 16 earlier-order cells of a static member under a same-named module `const` citing #2432 (re-counted: 16, all ICE): the cite is the author's inference; the ratchet's cite arm reports it. +- That A14's SPY0401 for `m.Q` follows from D8's text: today's CS1736 is measured, the cure is not. +- That the alias-enum and lambda-annotation defects are no constant position's verdict: their probes hold (both facts green); their classes were not traced. +- D2's pre-pass and first-read check drain the typed-read rows that cite #2423; D5's one resolver carries all 33 sites (the count is re-measured, 33 in nine files); D1's cold and warm export identity: designs with no prototype. +- "No snapshot moves" (A12): the regeneration after T1 and T4 proves or refutes it. +- A11's 22 declarations in five spec files: not re-counted. The 4,565 `.spy` files: re-counted, 4,565. +- Not run: a control at the base sha (product code at this tip is the base's); `check_spec_blocks.sh` (no spec or product path moved); the hand controls' own mutations; a whole-solution gate, locally or on CI, at this tip. From aa6d8446272b9dc856b52ce02eec770641957df3 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 21:59:57 +0000 Subject: [PATCH 18/22] test(conformance): P78 stage 0: decimal constants, lambda defaults MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stage 0 of plan-777361 (P78; contract §11) after /verify-plan pass 4 (NEEDS REVISION @ 73c785856). Test code and its data only; product code is e24aaf9f0's. The owner's word (#2423 comment 7049561049, 2026-11-20): - item 17, "Admit it (Recommended)". The option read: "D8's fact becomes what C# reads as a constant from metadata (a literal field or one carrying DecimalConstantAttribute), still not admitted at an attribute argument. One stage-0 commit adds the shape with its mutation. Nothing that runs today is refused." - item 19, "reads the member, but i think this lambda syntax is incorrect, i thought typed params on lambdas require a different syntax? or am i mistaken?". The ruling: the default reads the member. Both spellings of `docs/language_specification/lambdas.md` (the `lambda` keyword and the arrow) are generated. - item 20, "Fold 3; 4 if stage 0 moves (Recommended)". Stage 0 moves, so finding 4 (the builtin-name spelling) rides this commit. And #2423 comment 7050154806, item 22: item 18 is superseded. The hosts outside the classifier's call sites leave P78 for #2779's group; "P78's generated hosts stand as they are". No host is added here. What the sets gain - A referenced type's field is refined by what C# reads as a constant from metadata (finding 1): `ClrTypeMemberShape` answers Field/decimal-constant for a static init-only `decimal` field that carries `DecimalConstantAttribute`. New kind ClrTypeDecimalConstant (Decimal.one): must-run at every default host and `const` site this set generates (def, lambda, dataclass field, struct field, struct auto-property, six `const` sites), under all seven spellings; at an attribute argument SPY0425 is expected and an ICE is measured (CS0182 or CS0103 behind SPY0908; SPY0909): 14 known-red rows. A census of the Stdlib's and Core's exported types holds their `const decimal` count at 0, because discovery's `IsConst` is `IsLiteral` alone. - The builtin-name spelling on every kind whose type has one (finding 4): a member whose owner is in `PrimitiveCatalog` is read by that name or excluded with a probed reason. `decimal.one`; a second ClrTypeStaticField member, `str.empty` (91 cells, each an ICE as its `BitConverter` twin's: CS0133, CS1736, CS0182 or CS0103 behind SPY0908; SPY0909); `char` names no receiver in an expression (SPY0200), probed. The kinds whose members are `Math`'s have no builtin name. - A new set, lambda-default (finding 5): a class member read bare as the parameter default of a `def`, of a `lambda` and of an arrow lambda, the lambdas called where they stand in a class-level initializer. Per owner: the kinds and annotations the 8951 pool reads from a `def`'s default in its own class, every position its bare reads have (or a probed reason), both orders, with and without a module `const` of the name, and a literal-default control per owner and position. Rows: N1 at Earlier, N1+N3 below with no outer binding, N2 (SPY0619) below under one. A `def` is green but for N2's two cells; a lambda of either spelling is SPY0200 with the method-body steer, and under a module `const` it reads that binding (`12` for the member's `5`). CPython agrees with the model on all 35 twins. - Exclusions found while generating, each probed: a lambda stored in a field and called later has lost its default (SPY0908 CS7036 with a literal default); a lambda with a default in a property's default is SPY0908 CS0103 with a literal default (`__lambda_0`); a call in a constant-only position is SPY0401 by its shape. - The remark on `EnumMemberHost` said an enum member's value is the one constant position no classifier call judges. Refuted by pass 4: it is the one such position this set generates. A delegate's parameter default, a signature-only interface method's default, a bracket attribute on anything but a class's method and a union's attribute arguments are #2779's, by the owner's decision (item 22). Counts (measured on this tree; python = CPython 3.15.2) - pool 4682 -> 4963 cells (2342 must-run, 2621 must-refuse); python agreed 30/30 -> 65/65; constant-kind 2382 -> 2564 cells (red 770 -> 875); lambda-default 99 cells (red 82). - known-red rows 1383 -> 1570, every earlier row carried verbatim (numstat 187 / 0): #2432 661 -> 766 (+105 ice), #2423 555 -> 637 (+82: 40 false-refusal, 20 silent-wrong, 22 missing-refusal), #2417 150, #2147 17. - rule table 222 -> 227 rows, 52 rules; probes 26 -> 31, and 1 in a child process. - allowlist_rows_outside_seed 1955 -> 2142 (+187, the measured red count), by `scorecard_metrics.py --set-baseline allowlist_rows_outside_seed`; `--check`: OK (seed 2368 unchanged). Items 17, 19 and 20 above authorize the cells; the raise itself needs the owner's word in the PR body. The 8951 pool's CellBudget and seed are untouched. - ScopeMeaningDifferentialTests, NameResolutionDifferentialTests (8951, its budget unchanged), ClassBodyReadPositionMatrixTests, StaticInitializerOrderMatrixTests, ConstantPositionValidator* and CiFilterCoverage*, on this exact tree: 346 passed / 0 failed / 0 skipped (12.4 min, measured). `pytest build_tools/tests`: 2216 passed, 2 failed, both `test_check_review_line.py` "no merge base" (the clone is shallow; pass 4 measured the same two @ 73c785856). The whole-solution gate was not run. - `dotnet format whitespace sharpy.sln --verify-no-changes`: clean. Mutations, each ALONE from a copy, restored by copy, `cmp` identical (the seven facts that run no cell and the pool's RuleTable_ fact: 8 / 0 green before and after, unless said) - ClrTypeDecimalConstant taken off the SPY0425 row -> RuleTable_ red, ".../attribute/ClrTypeDecimalConstant/Decimal.one/import matches no row" (1 failed, 7 passed); restored -> green. - the decimal constant classified as a non-constant static in the table (its row deleted, the kind added to the three rows of the static kinds) -> ScopeMeaning_Sweep red, 28 failures: "SilentWrong read/constant-kind/ParameterDefault/def/ClrTypeDecimalConstant/ Decimal.one/import (MustRefuse, SPY0401): Sharpy Ran '1'", and the same at lambda, dataclass and struct, seven spellings each; restored -> green. - the decimal refinement dropped from `ClrTypeMemberShape` -> Axes_ red, "Decimal.one is listed under ClrTypeDecimalConstant, and the checker's resolver answers Field/static" and "the census of `System` sees no static value of shape Field/decimal-constant"; restored -> green. - the Stdlib/Core `const decimal` census pointed at `System.Private. CoreLib` (its positive control) -> Axes_ red, "`Decimal.Zero` is a `const decimal` of a referenced assembly's own type, which discovery records as no constant" (five members); restored -> green. - a passing cell listed known-red (`.../ParameterDefault/def/ ClrTypeDecimalConstant/Decimal.one/builtin-name Ice # #2432 ice`) -> ScopeMeaning_Sweep red, "listed as Ice, now Match: STALE, delete the row"; restored -> green. - `BuiltinName` taken off Decimal.one -> Axes_ red, "constant-kind x builtin name: Decimal.one is neither generated nor excluded"; restored -> green. - String.empty given the builtin name `int` -> Axes_ red, "`int` is no name the primitive catalog gives String"; restored -> green. - `char`'s exclusion deleted -> Axes_ red, "Char.is_ascii_digit is neither generated nor excluded"; restored -> green. - the builtin-name expression generated for Int32 alone -> Axes_ red, "no cell reads ClrTypeDecimalConstant Decimal.one under builtin-name" and the same for String.empty; restored -> green. - the five new probes handed a program that compiles -> Exclusions_ RestingOnTheCompiler_ red, five lines "... rests on SPY0200 / SPY0908 CS0103 / SPY0908 CS7036 / SPY0401, and the probe now gives [] stdout '1'"; restored -> green. - the row `MustRun N1+N3 ... route=lambda-default order=Later outer=None` deleted -> RuleTable_ red, "read/lambda-default/Def/ ClassLiteralConst/Annotated/ParameterDefault/Later matches no row"; restored -> green. - the arrow owner's text swapped for the `lambda` spelling -> Axes_ red, "is ArrowLambda's, and the parser finds [a `lambda`] with a parameter default in its program"; restored -> green. - literal-default controls generated for `def` alone -> Axes_ red, "Lambda at StaticInitializer has no cell with a literal default, which is what says the slot itself runs" (ten slots); restored -> green. - the `@static` property-default exclusion deleted -> Axes_ red, "a probe guards the reason '...', and no exclusion gives it"; restored -> green. - lambda-default cells generated at Earlier alone -> Axes_ red, "lambda-default x order: Later is neither generated nor excluded" and "has no cell at Later under a module binding of the name", and both RuleTable_ facts red, "no cell of any pool matches 'MustRefuse N2 family=Read route=lambda-default ...'" (3 failed, 5 passed); restored -> green. - the kinds of the set emptied (read from a position no reader has) -> Axes_ red, "the 8951 pool runs no bare read of a member from a `def`'s default in its own class, so the set has no kind and no control", with both RuleTable_ facts and Ratchet_ (4 failed, 4 passed); restored -> green. - the route's cite removed from `RouteIssues` -> Ratchet_ red (its accepted lambda-default row is refused; 1 failed, 7 passed); restored -> green. - not re-run: the 31 mutations in 0fe74e4c1's body. Not in this commit: the plan's text (the next commit); a cell for any host of #2779. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01LGMKZVcFYGqQRfHgd16DLa --- build_tools/scorecard-baseline.json | 2 +- .../ScopeMeaningDifferentialTests.Axes.cs | 191 ++++++++++++++++-- .../ScopeMeaningDifferentialTests.cs | 109 +++++++++- .../Conformance/name-resolution-rules.txt | 11 +- .../scope-meaning-differential-allowlist.txt | 187 +++++++++++++++++ 5 files changed, 478 insertions(+), 22 deletions(-) diff --git a/build_tools/scorecard-baseline.json b/build_tools/scorecard-baseline.json index 81b6b9c93..77f6cb001 100644 --- a/build_tools/scorecard-baseline.json +++ b/build_tools/scorecard-baseline.json @@ -1,6 +1,6 @@ { "procedure_bytes": 145560, "claude_md_bytes": 9304, - "allowlist_rows_outside_seed": 1955, + "allowlist_rows_outside_seed": 2142, "allowlist_rows_seed": 2368 } diff --git a/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Axes.cs b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Axes.cs index 77ef71a79..96703db65 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Axes.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Axes.cs @@ -2,6 +2,7 @@ using Sharpy.Compiler.Discovery; using Sharpy.Compiler.Discovery.Caching; using Sharpy.Compiler.Semantic; +using Sharpy.Compiler.Semantic.Registry; using Sharpy.Compiler.Semantic.Validation; using Sharpy.Compiler.Shared; using Xunit; @@ -30,9 +31,12 @@ namespace Sharpy.Compiler.Tests.Conformance; /// site that judges a const at every scope is refined by ScopeKind × TypeKind /// constant-kind × member kindwhat the compiler records for a member, per where the member /// lives: a referenced module's value (a census of discovery's FieldSignature.IsConst × IsGuarded over the -/// Stdlib), a referenced type's member (the subclasses of ClrMemberResolution, a field refined by -/// FieldInfo.IsLiteral), the program's own enum (EnumMemberAccessKind), and any other name of the program -/// () +/// Stdlib), a referenced type's member (the subclasses of ClrMemberResolution, a field refined by what C# reads as a +/// constant: FieldInfo.IsLiteral, or a DecimalConstantAttribute), the program's own enum +/// (EnumMemberAccessKind), and any other name of the program () +/// lambda-default × owner, × positionLambdaExpression.IsArrowSyntax with the def +/// control, and the positions at which the P77a pool runs a bare read of the member from its own type +/// () /// alias-target × siteScopeKind × TypeKind: the scope an alias's binder declares into /// alias-target × shapethe public properties of the alias's three AST records /// (TypeAlias, TypeAnnotation, FunctionType): each place a target can hold a type's name @@ -87,6 +91,11 @@ private static bool Refused(Harness.SharpyRun run, string code, string? cs = nul [AliasedIntEnumRead(EnumMemberAccessKind.IntName)] = new(IntEnum + "\ntype A = E0\ndef main() -> None:\n print(A.RED.name)\n", "SPY0908 CS1061", r => Refused(r, "SPY0908", "CS1061")), [InterfaceStaticIsRefused("field")] = new("interface H:\n @static\n x: int = 5\n def m(self) -> int: ...\ndef main() -> None:\n print(H.x)\n", "SPY0908 CS0120", r => Refused(r, "SPY0908", "CS0120")), [InterfaceStaticIsRefused("property")] = new("interface H:\n @static\n property x: int = 5\n def m(self) -> int: ...\ndef main() -> None:\n print(H.x)\n", "SPY0908 CS0120", r => Refused(r, "SPY0908", "CS0120")), + [CharNamesNoReceiver] = new("def main() -> None:\n x: object = char.is_ascii_digit\n print(1)\n", "SPY0200", r => Refused(r, "SPY0200")), + [AStoredLambdaLosesItsDefault] = new("class H:\n @static\n g: auto = lambda p1: int = 5: p1\ndef main() -> None:\n print(H.g())\n", "SPY0908 CS7036", r => Refused(r, "SPY0908", "CS7036")), + [ALambdaDefaultInAPropertyDefault(false)] = new("class H:\n property r: int = (lambda p1: int = 5: p1)()\ndef main() -> None:\n print(H().r)\n", "SPY0908 CS0103", r => Refused(r, "SPY0908", "CS0103")), + [ALambdaDefaultInAPropertyDefault(true)] = new("class H:\n @static\n property r: int = (lambda p1: int = 5: p1)()\ndef main() -> None:\n print(H.r)\n", "SPY0908 CS0103", r => Refused(r, "SPY0908", "CS0103")), + [ACallInAConstantOnlyPosition] = new("class H:\n def r(self, p0: int = (lambda p1: int = 5: p1)()) -> int:\n return p0\n" + TailMain, "SPY0401", r => Refused(r, "SPY0401")), [InterfaceStaticIsRefused("method, read uncalled", "#2111")] = new("interface H:\n @static\n def x() -> int:\n return 5\n def m(self) -> int: ...\ndef main() -> None:\n f: () -> int = H.x\n print(f())\n", "SPY0908 CS0120", r => Refused(r, "SPY0908", "CS0120")), }; @@ -356,6 +365,7 @@ internal sealed record TypedReader(BindingKind Kind, Harness.Spelling Spelling, ["init-overload"] = new Dictionary { [Harness.Order.Self] = ARecursion, [Harness.Order.Cycle] = ARecursion }, ["alias-target"] = new Dictionary(), ["constant-kind"] = new Dictionary { [Harness.Order.Self] = AReadOfItself, [Harness.Order.Cycle] = AReadOfItself }, + ["lambda-default"] = new Dictionary { [Harness.Order.Self] = AReadOfItself, [Harness.Order.Cycle] = AReadOfItself }, }; /// The target × use pairs with no cell, total over the two enums with the pairs a cell carries. @@ -596,8 +606,12 @@ internal static IEnumerable AllConstSites() internal static readonly IReadOnlyDictionary ExcludedAdmissionTables = new Dictionary(); - /// The one constant position no classifier call judges: an enum member's value. A table value added for it has no - /// reader here, which is red until this host moves under it. + /// A constant position no classifier call judges, and the one such position this set generates: an enum member's + /// value. A table value added for it has no reader here, which is red until this host moves under it. It is not the only + /// position without a classifier call (/verify-plan pass 4, finding 2): a delegate's parameter default, a + /// signature-only interface method's default, a bracket attribute on anything but a class's method, and a union's attribute + /// arguments have none either. Those hosts are #2779's group, out of plan-777361 by the owner's decision (#2423 comment + /// 7050154806, item 22): no host is generated for them here, and the census of call sites cannot see them. internal static readonly ConstantHost EnumMemberHost = new("enum-member", $"enum H:\n RED = {{e}}\n{Main} print(H.RED.value)", "SPY0401", ReadPosition.EnumMemberValue, IntOnly: true, NoInside: EnumBodyHoldsCases); @@ -691,7 +705,9 @@ internal sealed record TypeMemberBase(string Module, string TypeName, Type Owner /// The members of referenced types a constant position is handed, one or two per kind (a hand choice: each is /// checked against what the checker's resolver answers for it); every one is read under every - /// entry of its type, through an alias of the type, and by the type's builtin name where it has one. + /// entry of its type, through an alias of the type, and by the type's builtin name where it has one: + /// a type of the compiler's PrimitiveCatalog, read by one of the names the catalog gives it, or + /// says why the name is no receiver ( holds the three together). internal static readonly IReadOnlyDictionary TypeMembers = new Dictionary { [ScopeConstantKind.ClrTypeLiteralField] = new[] @@ -699,8 +715,13 @@ internal sealed record TypeMemberBase(string Module, string TypeName, Type Owner new TypeMemberBase("system", "Int32", typeof(int), "max_value", "int", "2147483647", BuiltinName: "int"), new TypeMemberBase("system", "Math", typeof(Math), "PI", "float", "3.141592653589793"), }, + [ScopeConstantKind.ClrTypeDecimalConstant] = new[] { new TypeMemberBase("system", "Decimal", typeof(decimal), "one", "decimal", "1", BuiltinName: "decimal") }, [ScopeConstantKind.ClrTypeEnumMember] = new[] { new TypeMemberBase("system", "DayOfWeek", typeof(DayOfWeek), "Monday", "{R}", "DayOfWeek.Monday") }, - [ScopeConstantKind.ClrTypeStaticField] = new[] { new TypeMemberBase("system", "BitConverter", typeof(BitConverter), "is_little_endian", "bool", "True") }, + [ScopeConstantKind.ClrTypeStaticField] = new[] + { + new TypeMemberBase("system", "BitConverter", typeof(BitConverter), "is_little_endian", "bool", "True"), + new TypeMemberBase("system", "String", typeof(string), "empty", "str", "True", "{0} == \"\"", BuiltinName: "str"), + }, [ScopeConstantKind.ClrTypeStaticProperty] = new[] { new TypeMemberBase("system", "Array", typeof(Array), "max_length", "int", "2147483591") }, [ScopeConstantKind.ClrTypeMethod] = new[] { new TypeMemberBase("system", "Math", typeof(Math), "sqrt", "(float) -> float", "5.0", "{0}(25.0)", Form: Harness.Form.Value) }, [ScopeConstantKind.ClrTypeDeclinedMethod] = new[] { new TypeMemberBase("system", "Char", typeof(char), "is_ascii_digit", "object", "True", "{0} is not None", Form: Harness.Form.Value) }, @@ -710,6 +731,14 @@ internal sealed record TypeMemberBase(string Module, string TypeName, Type Owner }, }; + private const string CharNamesNoReceiver = "`char` names a type in an annotation and nothing in an expression: `char.is_ascii_digit` is SPY0200, so a member of `Char` is read through the type's own name alone"; + + /// The primitive types whose builtin name is no receiver of a member read, each with its probe. + internal static readonly IReadOnlyDictionary ExcludedBuiltinReceivers = new Dictionary + { + [typeof(char)] = CharNamesNoReceiver, + }; + /// The enum reads, total over EnumMemberAccessKind (which half of which enum shape a .name / .value /// read takes) and the member itself per shape, which has no access kind. internal static readonly IReadOnlyDictionary EnumReadKinds = new Dictionary @@ -872,17 +901,21 @@ ConstantExpression Named(string spelling, string receiver, string? import, strin private const string LiteralFieldShape = "Field/literal"; private const string EnumFieldShape = "Field/enum"; + private const string DecimalConstantShape = "Field/decimal-constant"; private const string StaticFieldShape = "Field/static"; /// /// What the checker's resolver of a referenced type's member (ClrMemberTypeResolver) answers for a member read through /// the type, and the kind that is its image: the subclasses of ClrMemberResolution, by name, with a field refined by - /// the two facts reflection has and discovery does not (FieldInfo.IsLiteral; a literal of an enum type is the enum's - /// member). Total over those subclasses with . + /// the facts reflection has and discovery does not: what C# reads as a constant from metadata (FieldInfo.IsLiteral, + /// or a DecimalConstantAttribute on a static readonly field, which is how a const decimal is compiled: + /// ; the owner's ruling 17), and a literal of an enum type is the enum's member. Total over + /// those subclasses with . /// internal static readonly IReadOnlyDictionary ClrTypeMemberShapes = new Dictionary(StringComparer.Ordinal) { [LiteralFieldShape] = ScopeConstantKind.ClrTypeLiteralField, + [DecimalConstantShape] = ScopeConstantKind.ClrTypeDecimalConstant, [EnumFieldShape] = ScopeConstantKind.ClrTypeEnumMember, [StaticFieldShape] = ScopeConstantKind.ClrTypeStaticField, [nameof(ClrMemberResolution.Property)] = ScopeConstantKind.ClrTypeStaticProperty, @@ -902,7 +935,7 @@ ConstantExpression Named(string spelling, string receiver, string? import, strin /// The refinements of the two answers, which partitions the resolver's subclasses with. internal static readonly IReadOnlyDictionary RefinedClrTypeMemberShapes = new Dictionary(StringComparer.Ordinal) { - [nameof(ClrMemberResolution.Field)] = new[] { LiteralFieldShape, EnumFieldShape, StaticFieldShape }, + [nameof(ClrMemberResolution.Field)] = new[] { LiteralFieldShape, DecimalConstantShape, EnumFieldShape, StaticFieldShape }, [nameof(ClrMemberResolution.InconclusiveResult)] = new[] { DeclinedMethodShape, DeclinedValueShape, OppositeHalfShape }, [nameof(ClrMemberResolution.AbsentResult)] = new[] { GenericMethodShape, NoMemberShape }, }; @@ -948,9 +981,17 @@ internal static string ClrTypeMemberShape(Type owner, string member) if (resolution is not ClrMemberResolution.Field field) return resolution.GetType().Name; var info = owner.GetField(field.ClrName, BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy); - return info is not { IsLiteral: true } ? StaticFieldShape : owner.IsEnum ? EnumFieldShape : LiteralFieldShape; + return info is { IsLiteral: true } ? owner.IsEnum ? EnumFieldShape : LiteralFieldShape + : info != null && IsDecimalConstant(info) ? DecimalConstantShape + : StaticFieldShape; } + /// Whether C# reads a field that is no metadata literal as a constant: a const decimal is compiled to a + /// static readonly field carrying DecimalConstantAttribute, and the C# compiler reads it back as the constant. + internal static bool IsDecimalConstant(FieldInfo field) + => field is { IsStatic: true, IsInitOnly: true } && field.FieldType == typeof(decimal) + && field.CustomAttributes.Any(a => a.AttributeType == typeof(System.Runtime.CompilerServices.DecimalConstantAttribute)); + /// The kinds that are no member: closed by call 45 (a chain is admitted when each link is). internal static readonly IReadOnlySet ChainKinds = new HashSet { ScopeConstantKind.ComparisonChain, ScopeConstantKind.ChainWithNonConstantLink }; @@ -1149,6 +1190,75 @@ internal static IEnumerable OwnReadsOf(ConstantHost host) yield return new OwnRead(BindingKind.Builtin, null, Harness.Spelling.Bare, null, null, BindingKind.None, Harness.Form.Value, null, null, null, "abs", "(int) -> int", "{0}(-5)", "5", null, null); } + // ------------------------------------------------------------------------------------------- // + // lambda-default: owner × kind × annotation × position × order × outer + // ------------------------------------------------------------------------------------------- // + + /// An owner of a parameter default: whether it is a lambda and which spelling (LambdaExpression.IsArrowSyntax; + /// null for the def), and the expression that stands at the position, {d} the default. A def IS its + /// position (), so its text is the default alone. + internal sealed record DefaultOwner(bool? Arrow, string Text); + + /// The owners, total over ; the lambdas are total over IsArrowSyntax, and + /// reads the flag back from each cell's parsed source. + internal static readonly IReadOnlyDictionary DefaultOwners = new Dictionary + { + [ScopeDefaultOwner.Def] = new(null, "{d}"), + [ScopeDefaultOwner.Lambda] = new(false, "(lambda p1: int = {d}: p1)()"), + [ScopeDefaultOwner.ArrowLambda] = new(true, "((p1: int = {d}) -> p1)()"), + }; + + private const string AStoredLambdaLosesItsDefault = "stored in a field and called later (`g: auto = lambda p1: int = 5: p1`, then `H.g()`), a lambda has lost its default: the field's type is a function type, which carries none, and the call is SPY0908 CS7036 with a LITERAL default, so no cell could show what the default read"; + + /// How the lambda of a cell is used, closed: called where it stands, or stored and called later. The cell prints the + /// default's value, which only the first shows today. + internal static readonly IReadOnlyDictionary ExcludedLambdaUses = new Dictionary(StringComparer.Ordinal) + { + ["stored"] = AStoredLambdaLosesItsDefault, + }; + + /// The kinds a default reads by a bare name from its own class: READ from the typed-read set's readers, as the kinds + /// the P77a pool runs from a def's default there. A lambda's default is a constant position like a def's, so a + /// kind that is no constant has no cell that must run (its verdict there is the constant-kind set's). + internal static IReadOnlyList LambdaDefaultKinds + => TypedReaders.Where(r => r is { Spelling: Harness.Spelling.Bare, Inside: true, Position: ReadPosition.ParameterDefault }).Select(r => r.Kind).Distinct().ToList(); + + private const string ACallInAConstantOnlyPosition = "takes a compile-time constant, and a lambda called where it stands is a call: refused by its shape (SPY0401) before any name in it is read"; + + private static string ALambdaDefaultInAPropertyDefault(bool isStatic) + => $"in {(isStatic ? "a `@static`" : "an instance")} property's default, a lambda that gives a parameter a default is SPY0908 CS0103 with a LITERAL default (the emitted `__lambda_0` is declared nowhere): no cell there could run, whatever its default reads, and the defect is no name's verdict"; + + /// The positions of 's source that hold no lambda, each reason with its probe. + internal static readonly IReadOnlyDictionary ExcludedLambdaDefaultPositions = new Dictionary + { + [ReadPosition.ParameterDefault] = ACallInAConstantOnlyPosition, + [ReadPosition.DataclassFieldInitializer] = ACallInAConstantOnlyPosition, + [ReadPosition.StructFieldInitializer] = ACallInAConstantOnlyPosition, + [ReadPosition.StaticPropertyDefault] = ALambdaDefaultInAPropertyDefault(true), + [ReadPosition.InstancePropertyDefault] = ALambdaDefaultInAPropertyDefault(false), + }; + + /// The mark of a control cell: the owner's slot at a position with a literal default. + internal const string LiteralDefault = "literal-default"; + + /// The positions of a kind's bare read from its own type with nothing between the read and the type body, as the + /// P77a pool has them (): the class-level positions, since a bare read of a member runs nowhere else (N1). + internal static IEnumerable BareReadPositions(BindingKind kind) + => TypedReaders.Where(r => r.Kind == kind && r is { Spelling: Harness.Spelling.Bare, Inside: true, Nesting: Harness.Nesting.Direct }).Select(r => r.Position).Distinct().OrderBy(p => p); + + /// Where a lambda whose default reads a member of the kind stands: every class-level initializer the kind is read + /// from bare, so the axis is the image of under the pool's own rosters. + internal static IEnumerable LambdaDefaultPositions(BindingKind kind) + => BareReadPositions(kind).Where(p => !ExcludedLambdaDefaultPositions.ContainsKey(p)); + + /// The lambdas of a source that give a parameter a default, by the compiler's own parser: each one's IsArrowSyntax. + internal static List LambdasWithADefault(string source) + { + static IEnumerable Descendants(Sharpy.Compiler.Parser.Ast.Node node) => node.GetChildNodes().SelectMany(Descendants).Prepend(node); + var module = new Sharpy.Compiler.Parser.Parser(new Sharpy.Compiler.Lexer.Lexer(source).TokenizeAll()).ParseModule(); + return Descendants(module).OfType().Where(l => l.Parameters.Any(p => p.DefaultValue != null)).Select(l => l.IsArrowSyntax).ToList(); + } + // ------------------------------------------------------------------------------------------- // // alias-target: site × shape × target × use × order // ------------------------------------------------------------------------------------------- // @@ -1415,11 +1525,19 @@ IEnumerable Owed(ScopeConstantKind kind) problems.Add($"constant-kind × enum spelling: {kind} under {spelling} is generated and excluded"); } } + // A type the primitive catalog names is read by that name too: per member, the spelling or the reason the name is no receiver. + bool ReadByItsBuiltinName(Type? owner) => owner != null && PrimitiveCatalog.GetByClrType(owner) != null && !ExcludedBuiltinReceivers.ContainsKey(owner); + var typeMembers = TypeMembers.Values.SelectMany(v => v).ToList(); + Partition("constant-kind × builtin name", typeMembers.Where(m => PrimitiveCatalog.GetByClrType(m.Owner) != null).Select(m => $"{m.TypeName}.{m.Member}"), + typeMembers.Where(m => m.BuiltinName != null).Select(m => $"{m.TypeName}.{m.Member}"), typeMembers.Where(m => ExcludedBuiltinReceivers.ContainsKey(m.Owner)).Select(m => $"{m.TypeName}.{m.Member}")); + foreach (var m in typeMembers.Where(m => m.BuiltinName != null && PrimitiveCatalog.GetByName(m.BuiltinName)?.ClrType != m.Owner)) + problems.Add($"constant-kind × builtin name: `{m.BuiltinName}` is no name the primitive catalog gives {m.Owner.Name}, which {m.TypeName}.{m.Member} is read through"); foreach (var (kind, expressions) in ConstantExpressions) { foreach (var member in expressions.GroupBy(e => e.Label, StringComparer.Ordinal)) { - foreach (var spelling in Owed(kind).Where(o => !constantCells.Any(c => c.Cell.Key!.Part() == kind && Marks(c).Contains(member.Key) && Marks(c).Contains(o)))) + var owed = ReadByItsBuiltinName(member.First().Owner) ? Owed(kind).Append(BuiltinNameSpelling) : Owed(kind); + foreach (var spelling in owed.Where(o => !constantCells.Any(c => c.Cell.Key!.Part() == kind && Marks(c).Contains(member.Key) && Marks(c).Contains(o)))) problems.Add($"constant-kind × spelling: no cell reads {kind} {member.Key} under {spelling}"); } } @@ -1460,8 +1578,14 @@ IEnumerable Owed(ScopeConstantKind kind) } } // The census's own control: it sees the static values the generated kinds are the image of, so its 0 is a count. - foreach (var unseen in new[] { LiteralFieldShape, EnumFieldShape, StaticFieldShape, nameof(ClrMemberResolution.Property) }.Where(v => !censused.Contains(v))) + foreach (var unseen in new[] { LiteralFieldShape, DecimalConstantShape, EnumFieldShape, StaticFieldShape, nameof(ClrMemberResolution.Property) }.Where(v => !censused.Contains(v))) problems.Add($"constant-kind × type member: the census of `System` sees no static value of shape {unseen}, so it says nothing of the shape it holds at 0"); + // A referenced MODULE's field is a constant by discovery's `IsConst`, which is `FieldInfo.IsLiteral` alone: a `const decimal` + // there would be C#'s constant and discovery's static. No module declares one today (the census above is this scan's control: + // it finds `Decimal`'s); when one does, the shape is owed its kind (ruling 17). + foreach (var field in new[] { SharpyStdlibReference.Assembly, Sharpy.TestInfrastructure.SharpyCoreReference.Assembly }.SelectMany(a => a.GetExportedTypes()) + .SelectMany(t => t.GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly)).Where(IsDecimalConstant)) + problems.Add($"constant-kind × module member: `{field.DeclaringType!.Name}.{field.Name}` is a `const decimal` of a referenced assembly's own type, which discovery records as no constant: the shape is owed its kind"); foreach (var (kind, expressions) in ConstantExpressions) { foreach (var e in expressions) @@ -1501,6 +1625,46 @@ IEnumerable Owed(ScopeConstantKind kind) // init-overload Carried("init-overload", Enum.GetValues(), Part); + // lambda-default + var lambdaDefaults = Route("lambda-default").ToList(); + Carried("lambda-default", Enum.GetValues(), Part); + Partition("lambda-default × owner", Enum.GetValues(), DefaultOwners.Keys, Array.Empty()); + Partition("lambda-default × lambda spelling", new[] { false, true }, DefaultOwners.Values.Where(o => o.Arrow != null).Select(o => o.Arrow!.Value), Array.Empty()); + if (LambdaDefaultKinds.Count == 0) + problems.Add("lambda-default × kind: the 8951 pool runs no bare read of a member from a `def`'s default in its own class, so the set has no kind and no control"); + Carried("lambda-default", LambdaDefaultKinds, c => new[] { c.Cell.Target }); + Carried("lambda-default", Enum.GetValues(), Part); + foreach (var kind in LambdaDefaultKinds) + { + Partition($"lambda-default × position of {kind}", BareReadPositions(kind), + lambdaDefaults.Where(c => c.Cell.Target == kind && c.Cell.Key!.Part() != ScopeDefaultOwner.Def).Select(c => c.Cell.Position!.Value), ExcludedLambdaDefaultPositions.Keys); + } + foreach (var c in lambdaDefaults) + { + // What the cell's program holds, by the parser: a `def`'s cell no lambda, a lambda's cell the one lambda of its spelling. + var owner = c.Cell.Key!.Part()!.Value; + var lambdas = LambdasWithADefault(c.Cell.Source); + var owed = DefaultOwners[owner].Arrow is { } arrow ? new[] { arrow } : Array.Empty(); + if (!lambdas.SequenceEqual(owed)) + problems.Add($"lambda-default × owner: {c.Cell.Id} is {owner}'s, and the parser finds [{string.Join(", ", lambdas.Select(a => a ? "an arrow lambda" : "a `lambda`"))}] with a parameter default in its program"); + } + // A read's cell stands beside its control: the same owner at the same position with a literal default. + foreach (var slot in lambdaDefaults.Where(c => !Marks(c).Contains(LiteralDefault)).Select(c => (Owner: c.Cell.Key!.Part()!.Value, Position: c.Cell.Position!.Value)).Distinct()) + { + if (!lambdaDefaults.Any(c => Marks(c).Contains(LiteralDefault) && c.Cell.Key!.Part() == slot.Owner && c.Cell.Position == slot.Position)) + problems.Add($"lambda-default × control: {slot.Owner} at {slot.Position} has no cell with a literal default, which is what says the slot itself runs"); + } + // The class-body rule's two axes, as a bare sibling read has them: both orders, with and without a module binding of the name. + foreach (var sibling in lambdaDefaults.Where(c => !Marks(c).Contains(LiteralDefault)).GroupBy(c => string.Join("/", c.Cell.Key!.Parts.Where(p => p is not Harness.Order && !(p is string text && text.StartsWith("outer=", StringComparison.Ordinal)))))) + { + var seen = sibling.Select(c => (c.Cell.Key!.Part(), c.Cell.Outer != BindingKind.None)).ToHashSet(); + foreach (var order in new Harness.Order?[] { Harness.Order.Earlier, Harness.Order.Later }) + { + foreach (var bound in new[] { false, true }.Where(b => !seen.Contains((order, b)))) + problems.Add($"lambda-default × sibling: {sibling.Key} has no cell at {order} {(bound ? "under" : "without")} a module binding of the name"); + } + } + // alias-target Partition("alias-target × site", Enum.GetValues(), AliasSites.Keys, ExcludedAliasScopes.Keys); Partition("alias-target × type body", Enum.GetValues(), AliasTypeHosts.Keys, ExcludedAliasTypeHosts.Keys); @@ -1525,6 +1689,7 @@ IEnumerable Owed(ScopeConstantKind kind) .Concat(ExcludedTypedSpellings.Values).Concat(ExcludedTypedPositions.Values).Concat(ExcludedCalleeBinders.Values).Concat(ExcludedCalleeOuters.Values) .Concat(ExcludedAdmissionTables.Values).Concat(ExcludedModuleMemberShapes.Values).Concat(ExcludedModuleCollections.Values).Concat(ExcludedAliasScopes.Values).Concat(ExcludedAliasTypeHosts.Values) .Concat(ExcludedOwnSpellings.Values).Concat(ExcludedOwnPlacements.Values).Concat(ExcludedEnumSpellings.Values).Concat(ExcludedImportKinds.Values) + .Concat(ExcludedBuiltinReceivers.Values).Concat(ExcludedLambdaUses.Values).Concat(ExcludedLambdaDefaultPositions.Values) .Concat(AllConstantHosts().SelectMany(h => Enum.GetValues().Select(sp => OwnSpellingSkips(h.Host, sp, inside: true))).Where(r => r != null).Select(r => r!)) .Concat(ExcludedAliasShapeProperties.Values).Concat(ExcludedOrders.Values.SelectMany(o => o.Values)) .Concat(ExcludedConstScopes.Values).Concat(ExcludedConstTypeHosts.Values).Concat(ExcludedConstantReaders.Values).Concat(ExcludedClrTypeMemberShapes.Values) diff --git a/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs index 3469284ba..af7cac3b7 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs @@ -35,8 +35,9 @@ internal enum ScopeAnnotation /// a member of a referenced MODULE: the collection of discovery's ModuleOverloads that holds it, a field refined /// by FieldSignature.IsConst × IsGuarded and a function by its overload count /// (; ruling 13, comment 7046304965); -/// a member of a referenced TYPE: the subclasses of ClrMemberResolution, a field refined by -/// FieldInfo.IsLiteral and whether its type is an enum (); +/// a member of a referenced TYPE: the subclasses of ClrMemberResolution, a field refined by what C# reads as a +/// constant from metadata (FieldInfo.IsLiteral, or a DecimalConstantAttribute: the owner's ruling 17, #2423 +/// comment 7049561049) and whether its type is an enum (); /// a member of an enum the program declares: EnumMemberAccessKind and the member itself, per enum shape /// (); /// any other name the program declares: , refined by @@ -66,6 +67,11 @@ internal enum ScopeConstantKind /// A literal field of a referenced type (int.max_value, Math.PI): a C# constant. ClrTypeLiteralField, + /// A const decimal of a referenced type (decimal.one): in metadata a static readonly field + /// carrying DecimalConstantAttribute, which C# reads back as a constant wherever a decimal can be one: a + /// default and a const, never an attribute argument (ruling 17). + ClrTypeDecimalConstant, + /// A member of a referenced enum (DayOfWeek.Monday): a C# constant. ClrTypeEnumMember, @@ -140,14 +146,26 @@ internal enum ScopeOverloadCaller ModuleFunction, } +/// Whose parameter default reads a member of the class its declaration stands in: a method's (the control: a +/// def's default is evaluated in the class body, and reads the member today), a lambda's, an arrow lambda's. The +/// two lambdas are the image of LambdaExpression.IsArrowSyntax; a default has no fourth owner in a class body that +/// plan-777361 holds (a delegate's and a signature-only method's are #2779's). +internal enum ScopeDefaultOwner +{ + Def, + Lambda, + ArrowLambda, +} + /// /// Stage 0 of plan-777361 (P78; verification contract §11), the owner's rulings of 2026-11-20 (#2423 comments -/// 7030074628 item 1, 7039834146 item 5, 7042723494 items 7 to 9 and 7046304965 items 12 and 13): the cells of rules N1, N2, N4 and N7 that the P77a pool +/// 7030074628 item 1, 7039834146 item 5, 7042723494 items 7 to 9, 7046304965 items 12 and 13, 7049561049 items 17, 19 and 20, +/// and 7050154806 item 22): the cells of rules N1, N2, N4 and N7 that the P77a pool /// () has no program for, as a generated test type of their own. A cell is /// a , and its tag and rule are READ from the rule table (name-resolution-rules.txt, #2487): /// the generator writes the program, what it prints when it runs and the codes a refusal may carry, and never a verdict. /// -/// Six cell sets. Every axis is the image of a compiler enumeration read by reflection, a census of the compiler's own +/// Seven cell sets. Every axis is the image of a compiler enumeration read by reflection, a census of the compiler's own /// output, the P77a pool, or a set named closed; every value is generated or excluded with its reason /// (), and an exclusion that rests on what the compiler does today /// has a probe that goes red when it stops (). The @@ -160,10 +178,14 @@ internal enum ScopeOverloadCaller /// callee: a binder's name called under an outer binding of the name, binder ( and /// the parameter) × outer (); /// constant-kind (#2432): host (the call sites of ConstantDefaultClassifier.IsAdmitted, each with its -/// AdmissionTable, and the enum member's value) × × the read's spelling and the +/// AdmissionTable, and the enum member's value; the constant slots no classifier call judges besides are #2779's, by +/// the owner's decision: ) × × the read's spelling and the /// reader's placement (an import's forms, a type's alias, and for the program's own names Spelling × inside or outside /// the member's type, as the typed-read set's readers have them); /// init-overload: × order; +/// lambda-default (D4; ruling 19): × the class-level initializer that holds the +/// lambda (the positions at which the P77a pool runs a bare read of the member from its own type) × order × a module +/// binding of the name; /// alias-target: declaration site (ScopeKind × TypeKind) × target shape (the properties of the /// alias's AST records) × × × order. An alias that reaches /// itself has its unused cells, which must run, and no used one (#2769). @@ -539,6 +561,71 @@ private static IEnumerable InitOverloadCases() } } + // ------------------------------------------------------------------------------------------- // + // lambda-default: a lambda's parameter default at a type body's level is evaluated in the type body (D4; ruling 19) + // ------------------------------------------------------------------------------------------- // + + /// + /// A parameter default that reads a member of its own class by its bare name, per owner of the default + /// (). The owner's ruling 19 (#2423 comment 7049561049; unchanged by item 22 of 7050154806): a + /// lambda's default in a class-level initializer "reads the member", as a def's does, and the planning session reads + /// that as one rule for both lambda spellings. So the class-body rule decides the read (D3): the member where it stands + /// above the initializer or no module binding holds the name, N2's refusal at-or-after under one (SPY0619, which lands + /// with plan-777361's T8). The member's value is 5 and a module binding's 12, so a default that reads the wrong one prints + /// it. The lambda is called where it stands (), at each position + /// derives; each owner and position has its control, the same slot with a LITERAL + /// default, which runs today, so a red cell beside it is red for what its default reads. + /// + private static IEnumerable LambdaDefaultCases() + { + foreach (var (owner, o) in DefaultOwners.OrderBy(e => e.Key)) + { + foreach (var position in o.Arrow == null ? new[] { ReadPosition.ParameterDefault } : LambdaDefaultKinds.SelectMany(LambdaDefaultPositions).Distinct().OrderBy(p => p).ToArray()) + { + var placed = Harness.PlaceInClass(position, Harness.Nesting.Direct, o.Text.Replace("{d}", "5", StringComparison.Ordinal)); + var lines = new[] { Harness.HostHeader(position) }.Concat(placed.Members.Select(l => " " + l)); + yield return Draft(Key("read", "lambda-default", owner, position, LiteralDefault), Family.Read, Lines(lines) + Harness.MainPrinting(placed.Access, placed.Setup), "5", + Array.Empty(), twin: Harness.HostHeader(position) == "class H:", position: position); + } + } + foreach (var kind in LambdaDefaultKinds.OrderBy(k => k)) + { + var t = TypedReads[kind]; + foreach (var (owner, o) in DefaultOwners.OrderBy(e => e.Key)) + { + foreach (var position in o.Arrow == null ? new[] { ReadPosition.ParameterDefault } : LambdaDefaultPositions(kind).ToArray()) + { + foreach (var annotation in Enum.GetValues()) + { + var declaration = annotation == ScopeAnnotation.Annotated ? t.Annotated : t.Inferred; + if (declaration == null) + continue; + foreach (var order in new[] { Harness.Order.Earlier, Harness.Order.Later }) + { + foreach (var outer in new[] { BindingKind.None, SiblingOuter(callable: false) }) + { + var placed = Harness.PlaceInClass(position, Harness.Nesting.Direct, o.Text.Replace("{d}", t.Member, StringComparison.Ordinal)); + var member = declaration.Split('\n'); + var lines = new List(); + if (outer != BindingKind.None) + lines.Add("const x: int = 12"); + lines.Add(Harness.HostHeader(position)); + lines.AddRange((order == Harness.Order.Earlier ? member.Concat(placed.Members) : placed.Members.Concat(member)).Select(l => " " + l)); + bool refused = order == Harness.Order.Later && outer != BindingKind.None; + // Python evaluates a default where its `def` or `lambda` stands, top to bottom: it is the same program + // where the member stands above, in a plain class. + bool twin = order == Harness.Order.Earlier && Harness.HostHeader(position) == "class H:"; + yield return Draft(Key("read", "lambda-default", owner, kind, annotation, position, order, outer == BindingKind.None ? null : $"outer={outer}"), + Family.Read, Lines(lines) + Harness.MainPrinting(placed.Access, placed.Setup), "5", refused ? new[] { "SPY0619" } : Array.Empty(), twin, + target: kind, outer: outer, position: position, relation: DeclaringRelation.Self); + } + } + } + } + } + } + } + // ------------------------------------------------------------------------------------------- // // alias-target: an alias names a type that exists, used or not, wherever it is declared and whatever its shape // ------------------------------------------------------------------------------------------- // @@ -612,7 +699,8 @@ private static IEnumerable AliasTargetCases() // ------------------------------------------------------------------------------------------- // private static readonly Lazy> Drafts = new(() => - NoInitializerCases().Concat(TypedReadCases()).Concat(CalleeCases()).Concat(ConstantKindCases()).Concat(InitOverloadCases()).Concat(AliasTargetCases()).ToList()); + NoInitializerCases().Concat(TypedReadCases()).Concat(CalleeCases()).Concat(ConstantKindCases()).Concat(InitOverloadCases()).Concat(LambdaDefaultCases()) + .Concat(AliasTargetCases()).ToList()); /// The cells as generated, before the table is read: what counts a row's cells over. internal static IReadOnlyList DraftCells() => Drafts.Value.Select(c => c.Cell).ToList(); @@ -665,7 +753,7 @@ public void RuleTable_EveryCaseHasOneRow_AndTakesItsVerdictFromIt() // ------------------------------------------------------------------------------------------- // /// The issue whose fix turns a red cell of a route green: #2432 for a constant position's verdict, #2423 for the rest - /// (R-QI's cells, the untyped forward read, the callee lookup, the alias refusal: charter §3.20l). A typed read that is + /// (R-QI's cells, the untyped forward read, the callee lookup, a lambda's default, the alias refusal: charter §3.20l). A typed read that is /// red at the EARLIER order is no order defect, and it and its later twin are #2417's; an alias that reaches itself is /// #2769's; in a constant position, N2's cells are #2423's, as is a bare sibling read red at the later order alone, and a /// member that dies of an instance receiver is #2147's (). @@ -676,6 +764,7 @@ public void RuleTable_EveryCaseHasOneRow_AndTakesItsVerdictFromIt() ["callee"] = "#2423", ["constant-kind"] = "#2432", ["init-overload"] = "#2423", + ["lambda-default"] = "#2423", ["alias-target"] = "#2423", }; @@ -954,6 +1043,12 @@ Result Of(Case c, Harness.SharpyRun run, string? pythonFailure = null) Assert.Empty(RatchetFailures(refusedItself, Rows((itself, VerdictClass.FalseRefusal, "#2769 false-refusal")))); Assert.Contains("the route says '#2769", Assert.Single(RatchetFailures(refusedItself, Rows((itself, VerdictClass.FalseRefusal, "#2423 false-refusal"))))); + // A lambda's default that does not read the member is the class-body rule's cell (#2423), never a constant position's. + var lambdaDefault = pool.First(c => c.Cell.Key!.Route == "lambda-default" && c.Cell.Key.Part() == ScopeDefaultOwner.Lambda && c.Cell.Key.Part() == Harness.Order.Earlier); + Assert.Equal(SharpyTag.MustRun, lambdaDefault.Cell.Tag); + Assert.Empty(RatchetFailures(new[] { Of(lambdaDefault, Refused("SPY0200")) }, Rows((lambdaDefault, VerdictClass.FalseRefusal, "#2423 false-refusal")))); + Assert.Contains("the route says '#2423", Assert.Single(RatchetFailures(new[] { Of(lambdaDefault, Refused("SPY0200")) }, Rows((lambdaDefault, VerdictClass.FalseRefusal, "#2432 false-refusal"))))); + // A constant position's cell is #2432's, with three classes that are another tracker's whatever the position. static Harness.SharpyRun Ice(string cs) => new(false, null, false, false, "", "", new[] { "SPY0908" }, new[] { "SPY0908" }, cs); bool Constant(Case c) => c.Cell.Key!.Route == "constant-kind"; diff --git a/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt b/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt index 2ed58ccb2..8f6aefb0f 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt +++ b/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt @@ -226,10 +226,13 @@ MustRun N1 family=Read route=no-initializer initializer=Present,AccessorBodies MustRefuse N1-typed-read family=Read route=typed-read MustRun N1-innermost family=Local route=callee MustRun N4 family=Read route=constant-kind constantKind=ClrLiteralField,ClrTypeLiteralField,ClrTypeEnumMember,IntEnumMember,IntEnumValue,ComparisonChain +# A `const decimal` of a referenced type (the owner's ruling 17): what C# reads as a constant wherever a decimal can be one, +# which an attribute argument is not. +MustRun N4 family=Read route=constant-kind admission!=DecoratorArgument constantKind=ClrTypeDecimalConstant MustRun N4 family=Read route=constant-kind admission=ConstInitializer constantKind=StdlibModuleVariable,ClrStaticMember,ModuleFunction,ModuleFunctionGroup,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,ClrTypeDeclinedMethod,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink MustRun #1938 family=Read route=constant-kind mark=struct-auto-property constantKind=StdlibModuleVariable,ClrStaticMember,ModuleFunction,ModuleFunctionGroup,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,ClrTypeDeclinedMethod,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink MustRefuse SPY0401 family=Read route=constant-kind admission=ParameterDefault,LambdaParameterDefault,PerInstanceFieldDefault,- mark=def,lambda,dataclass,struct,enum-member constantKind=StdlibModuleVariable,ClrStaticMember,ModuleFunction,ModuleFunctionGroup,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,ClrTypeDeclinedMethod,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink -MustRefuse SPY0425 family=Read route=constant-kind admission=DecoratorArgument constantKind=StdlibModuleVariable,ClrStaticMember,ModuleFunction,ModuleFunctionGroup,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,ClrTypeDeclinedMethod,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink +MustRefuse SPY0425 family=Read route=constant-kind admission=DecoratorArgument constantKind=StdlibModuleVariable,ClrStaticMember,ModuleFunction,ModuleFunctionGroup,ClrTypeDecimalConstant,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,ClrTypeDeclinedMethod,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink MustRefuse kind:SPY0336 family=Read route=constant-kind constantKind=ClrTypeMethodGroup # A name of the program's own, under every spelling and from every placement but a bare sibling read: one answer (N7). MustRun N4 family=Read route=constant-kind constantKind=OwnMember target=ModuleLiteralConst,ClassLiteralConst mark!=bare-sibling @@ -257,6 +260,12 @@ MustRun #1938 family=Read route=constant-kind mark=struct-auto-property constant MustRefuse SPY0401 family=Read route=constant-kind admission=ParameterDefault,LambdaParameterDefault,PerInstanceFieldDefault,- mark=def,lambda,dataclass,struct,enum-member constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin mark=bare-sibling mark!=in-method order=Later outer=None MustRefuse SPY0425 family=Read route=constant-kind admission=DecoratorArgument constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin mark=bare-sibling mark!=in-method order=Later outer=None MustRun N1 family=Read route=init-overload +# A parameter default at a type body's level is evaluated in the type body, a lambda's as a `def`'s (D4; the owner's ruling 19): +# a bare name in it is a sibling read, which the class-body rule decides (D3). `order=-` is a slot's control, a literal default. +MustRun N4 family=Read route=lambda-default order=- +MustRun N1 family=Read route=lambda-default order=Earlier +MustRun N1+N3 family=Read route=lambda-default order=Later outer=None +MustRefuse N2 family=Read route=lambda-default order=Later outer!=None MustRefuse N1-alias-target family=Read route=alias-target aliasTarget=Missing MustRun N1 family=Read route=alias-target aliasTarget=Declared MustRun #2769 family=Read route=alias-target aliasTarget=Itself diff --git a/src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt b/src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt index 2edb16e29..dc1ae0d2f 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt +++ b/src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt @@ -123,6 +123,13 @@ read/constant-kind/ConstInitializer/block-const/ClrTypeStaticField/BitConverter. read/constant-kind/ConstInitializer/block-const/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice read/constant-kind/ConstInitializer/block-const/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice read/constant-kind/ConstInitializer/block-const/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/ClrTypeStaticField/String.empty/builtin-name Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/ClrTypeStaticField/String.empty/from-import Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/ClrTypeStaticField/String.empty/from-import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/ClrTypeStaticField/String.empty/import Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/ClrTypeStaticField/String.empty/import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/ClrTypeStaticField/String.empty/star-import Ice # #2432 ice +read/constant-kind/ConstInitializer/block-const/ClrTypeStaticField/String.empty/type-alias Ice # #2432 ice read/constant-kind/ConstInitializer/block-const/IntEnumName/name/type-name Ice # #2432 ice read/constant-kind/ConstInitializer/block-const/OwnMember/ClassComputedConst/Annotated/SelfDot/Self/in-method Ice # #2147 ice read/constant-kind/ConstInitializer/block-const/OwnMember/ClassComputedConst/Inferred/SelfDot/Self/in-method Ice # #2147 ice @@ -144,6 +151,13 @@ read/constant-kind/ConstInitializer/class-const/ClrTypeStaticField/BitConverter. read/constant-kind/ConstInitializer/class-const/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice read/constant-kind/ConstInitializer/class-const/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice read/constant-kind/ConstInitializer/class-const/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/ClrTypeStaticField/String.empty/builtin-name Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/ClrTypeStaticField/String.empty/from-import Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/ClrTypeStaticField/String.empty/from-import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/ClrTypeStaticField/String.empty/import Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/ClrTypeStaticField/String.empty/import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/ClrTypeStaticField/String.empty/star-import Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/ClrTypeStaticField/String.empty/type-alias Ice # #2432 ice read/constant-kind/ConstInitializer/class-const/IntEnumName/name/type-name Ice # #2432 ice read/constant-kind/ConstInitializer/class-const/OwnMember/ClassComputedConst/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling FalseRefusal # #2423 wrong-code read/constant-kind/ConstInitializer/class-const/OwnMember/ClassComputedConst/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling FalseRefusal # #2423 wrong-code @@ -174,6 +188,13 @@ read/constant-kind/ConstInitializer/interface-const/ClrTypeStaticField/BitConver read/constant-kind/ConstInitializer/interface-const/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice read/constant-kind/ConstInitializer/interface-const/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice read/constant-kind/ConstInitializer/interface-const/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/ClrTypeStaticField/String.empty/builtin-name Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/ClrTypeStaticField/String.empty/from-import Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/ClrTypeStaticField/String.empty/from-import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/ClrTypeStaticField/String.empty/import Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/ClrTypeStaticField/String.empty/import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/ClrTypeStaticField/String.empty/star-import Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/ClrTypeStaticField/String.empty/type-alias Ice # #2432 ice read/constant-kind/ConstInitializer/interface-const/IntEnumName/name/type-name Ice # #2432 ice read/constant-kind/ConstInitializer/interface-const/OwnMember/ClassComputedConst/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling FalseRefusal # #2423 wrong-code read/constant-kind/ConstInitializer/interface-const/OwnMember/ClassComputedConst/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling FalseRefusal # #2423 wrong-code @@ -193,6 +214,13 @@ read/constant-kind/ConstInitializer/local-const/ClrTypeStaticField/BitConverter. read/constant-kind/ConstInitializer/local-const/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice read/constant-kind/ConstInitializer/local-const/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice read/constant-kind/ConstInitializer/local-const/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/ClrTypeStaticField/String.empty/builtin-name Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/ClrTypeStaticField/String.empty/from-import Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/ClrTypeStaticField/String.empty/from-import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/ClrTypeStaticField/String.empty/import Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/ClrTypeStaticField/String.empty/import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/ClrTypeStaticField/String.empty/star-import Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/ClrTypeStaticField/String.empty/type-alias Ice # #2432 ice read/constant-kind/ConstInitializer/local-const/IntEnumName/name/type-name Ice # #2432 ice read/constant-kind/ConstInitializer/local-const/OwnMember/ClassComputedConst/Annotated/SelfDot/Self/in-method Ice # #2147 ice read/constant-kind/ConstInitializer/local-const/OwnMember/ClassComputedConst/Inferred/SelfDot/Self/in-method Ice # #2147 ice @@ -214,6 +242,13 @@ read/constant-kind/ConstInitializer/module-const/ClrTypeStaticField/BitConverter read/constant-kind/ConstInitializer/module-const/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice read/constant-kind/ConstInitializer/module-const/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice read/constant-kind/ConstInitializer/module-const/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/ClrTypeStaticField/String.empty/builtin-name Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/ClrTypeStaticField/String.empty/from-import Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/ClrTypeStaticField/String.empty/from-import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/ClrTypeStaticField/String.empty/import Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/ClrTypeStaticField/String.empty/import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/ClrTypeStaticField/String.empty/star-import Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/ClrTypeStaticField/String.empty/type-alias Ice # #2432 ice read/constant-kind/ConstInitializer/module-const/IntEnumName/name/type-name Ice # #2432 ice read/constant-kind/ConstInitializer/module-const/StdlibModuleVariable/math.pi/import Ice # #2432 ice read/constant-kind/ConstInitializer/module-const/StdlibModuleVariable/math.pi/import-as Ice # #2432 ice @@ -229,6 +264,13 @@ read/constant-kind/ConstInitializer/struct-const/ClrTypeStaticField/BitConverter read/constant-kind/ConstInitializer/struct-const/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice read/constant-kind/ConstInitializer/struct-const/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice read/constant-kind/ConstInitializer/struct-const/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/ClrTypeStaticField/String.empty/builtin-name Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/ClrTypeStaticField/String.empty/from-import Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/ClrTypeStaticField/String.empty/from-import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/ClrTypeStaticField/String.empty/import Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/ClrTypeStaticField/String.empty/import-as Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/ClrTypeStaticField/String.empty/star-import Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/ClrTypeStaticField/String.empty/type-alias Ice # #2432 ice read/constant-kind/ConstInitializer/struct-const/IntEnumName/name/type-name Ice # #2432 ice read/constant-kind/ConstInitializer/struct-const/OwnMember/ClassComputedConst/Annotated/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling FalseRefusal # #2423 wrong-code read/constant-kind/ConstInitializer/struct-const/OwnMember/ClassComputedConst/Inferred/Bare/Self/Later/outer=ModuleLiteralConst/bare-sibling FalseRefusal # #2423 wrong-code @@ -260,6 +302,13 @@ read/constant-kind/DecoratorArgument/attribute-keyword/ClrLiteralField/subproces read/constant-kind/DecoratorArgument/attribute-keyword/ClrLiteralField/subprocess.PIPE/star-import FalseRefusal # #2432 false-refusal read/constant-kind/DecoratorArgument/attribute-keyword/ClrStaticMember/sys.maxsize/import Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute-keyword/ClrStaticMember/sys.maxsize/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeDecimalConstant/Decimal.one/builtin-name Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeDecimalConstant/Decimal.one/from-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeDecimalConstant/Decimal.one/from-import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeDecimalConstant/Decimal.one/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeDecimalConstant/Decimal.one/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeDecimalConstant/Decimal.one/star-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeDecimalConstant/Decimal.one/type-alias Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/from-import Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/from-import-as Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/import Ice # #2432 ice @@ -297,6 +346,13 @@ read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticField/BitCon read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticField/String.empty/builtin-name Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticField/String.empty/from-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticField/String.empty/from-import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticField/String.empty/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticField/String.empty/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticField/String.empty/star-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticField/String.empty/type-alias Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticProperty/Array.max_length/from-import Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticProperty/Array.max_length/from-import-as Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute-keyword/ClrTypeStaticProperty/Array.max_length/import Ice # #2432 ice @@ -393,6 +449,13 @@ read/constant-kind/DecoratorArgument/attribute/ClrLiteralField/subprocess.PIPE/i read/constant-kind/DecoratorArgument/attribute/ClrLiteralField/subprocess.PIPE/star-import FalseRefusal # #2432 false-refusal read/constant-kind/DecoratorArgument/attribute/ClrStaticMember/sys.maxsize/import Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute/ClrStaticMember/sys.maxsize/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeDecimalConstant/Decimal.one/builtin-name Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeDecimalConstant/Decimal.one/from-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeDecimalConstant/Decimal.one/from-import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeDecimalConstant/Decimal.one/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeDecimalConstant/Decimal.one/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeDecimalConstant/Decimal.one/star-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeDecimalConstant/Decimal.one/type-alias Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/from-import Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/from-import-as Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute/ClrTypeDeclinedMethod/Value/Char.is_ascii_digit/import Ice # #2432 ice @@ -430,6 +493,13 @@ read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticField/BitConverter.i read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticField/String.empty/builtin-name Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticField/String.empty/from-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticField/String.empty/from-import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticField/String.empty/import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticField/String.empty/import-as Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticField/String.empty/star-import Ice # #2432 ice +read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticField/String.empty/type-alias Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticProperty/Array.max_length/from-import Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticProperty/Array.max_length/from-import-as Ice # #2432 ice read/constant-kind/DecoratorArgument/attribute/ClrTypeStaticProperty/Array.max_length/import Ice # #2432 ice @@ -536,6 +606,13 @@ read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticField/BitConverter read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticField/String.empty/builtin-name Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticField/String.empty/from-import Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticField/String.empty/from-import-as Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticField/String.empty/import Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticField/String.empty/import-as Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticField/String.empty/star-import Ice # #2432 ice +read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticField/String.empty/type-alias Ice # #2432 ice read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticProperty/Array.max_length/from-import Ice # #2432 ice read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticProperty/Array.max_length/from-import-as Ice # #2432 ice read/constant-kind/LambdaParameterDefault/lambda/ClrTypeStaticProperty/Array.max_length/import Ice # #2432 ice @@ -590,6 +667,13 @@ read/constant-kind/ParameterDefault/def/ClrTypeStaticField/BitConverter.is_littl read/constant-kind/ParameterDefault/def/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice read/constant-kind/ParameterDefault/def/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice read/constant-kind/ParameterDefault/def/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeStaticField/String.empty/builtin-name Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeStaticField/String.empty/from-import Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeStaticField/String.empty/from-import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeStaticField/String.empty/import Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeStaticField/String.empty/import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeStaticField/String.empty/star-import Ice # #2432 ice +read/constant-kind/ParameterDefault/def/ClrTypeStaticField/String.empty/type-alias Ice # #2432 ice read/constant-kind/ParameterDefault/def/ClrTypeStaticProperty/Array.max_length/from-import Ice # #2432 ice read/constant-kind/ParameterDefault/def/ClrTypeStaticProperty/Array.max_length/from-import-as Ice # #2432 ice read/constant-kind/ParameterDefault/def/ClrTypeStaticProperty/Array.max_length/import Ice # #2432 ice @@ -654,6 +738,13 @@ read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticField/BitC read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticField/String.empty/builtin-name Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticField/String.empty/from-import Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticField/String.empty/from-import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticField/String.empty/import Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticField/String.empty/import-as Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticField/String.empty/star-import Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticField/String.empty/type-alias Ice # #2432 ice read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticProperty/Array.max_length/from-import Ice # #2432 ice read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticProperty/Array.max_length/from-import-as Ice # #2432 ice read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticProperty/Array.max_length/import Ice # #2432 ice @@ -740,6 +831,13 @@ read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticField/BitConve read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticField/String.empty/builtin-name Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticField/String.empty/from-import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticField/String.empty/from-import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticField/String.empty/import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticField/String.empty/import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticField/String.empty/star-import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticField/String.empty/type-alias Ice # #2432 ice read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticProperty/Array.max_length/from-import Ice # #2432 ice read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticProperty/Array.max_length/from-import-as Ice # #2432 ice read/constant-kind/PerInstanceFieldDefault/dataclass/ClrTypeStaticProperty/Array.max_length/import Ice # #2432 ice @@ -807,6 +905,13 @@ read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticField/BitConverte read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticField/BitConverter.is_little_endian/import-as Ice # #2432 ice read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticField/BitConverter.is_little_endian/star-import Ice # #2432 ice read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticField/BitConverter.is_little_endian/type-alias Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticField/String.empty/builtin-name Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticField/String.empty/from-import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticField/String.empty/from-import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticField/String.empty/import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticField/String.empty/import-as Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticField/String.empty/star-import Ice # #2432 ice +read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticField/String.empty/type-alias Ice # #2432 ice read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticProperty/Array.max_length/from-import Ice # #2432 ice read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticProperty/Array.max_length/from-import-as Ice # #2432 ice read/constant-kind/PerInstanceFieldDefault/struct/ClrTypeStaticProperty/Array.max_length/import Ice # #2432 ice @@ -888,6 +993,88 @@ read/constant-kind/enum-member/StdlibModuleVariable/socket.AF_INET/import Ice # read/constant-kind/enum-member/StdlibModuleVariable/socket.AF_INET/import-as Ice # #2432 ice read/constant-kind/enum-member/StdlibModuleVariable/socket.AF_INET/star-import Ice # #2432 ice read/init-overload/InitDelegation/Later FalseRefusal # #2423 false-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Annotated/ConstInitializer/Earlier FalseRefusal # #2423 false-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Annotated/ConstInitializer/Earlier/outer=ModuleLiteralConst SilentWrong # #2423 silent-wrong +read/lambda-default/ArrowLambda/ClassLiteralConst/Annotated/ConstInitializer/Later FalseRefusal # #2423 false-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Annotated/ConstInitializer/Later/outer=ModuleLiteralConst SilentWrong # #2423 missing-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Annotated/DataclassInitFieldInitializer/Earlier FalseRefusal # #2423 false-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Annotated/DataclassInitFieldInitializer/Earlier/outer=ModuleLiteralConst SilentWrong # #2423 silent-wrong +read/lambda-default/ArrowLambda/ClassLiteralConst/Annotated/DataclassInitFieldInitializer/Later FalseRefusal # #2423 false-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Annotated/DataclassInitFieldInitializer/Later/outer=ModuleLiteralConst SilentWrong # #2423 missing-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Annotated/InstanceFieldInitializer/Earlier FalseRefusal # #2423 false-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Annotated/InstanceFieldInitializer/Earlier/outer=ModuleLiteralConst SilentWrong # #2423 silent-wrong +read/lambda-default/ArrowLambda/ClassLiteralConst/Annotated/InstanceFieldInitializer/Later FalseRefusal # #2423 false-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Annotated/InstanceFieldInitializer/Later/outer=ModuleLiteralConst SilentWrong # #2423 missing-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Annotated/StaticInitializer/Earlier FalseRefusal # #2423 false-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Annotated/StaticInitializer/Earlier/outer=ModuleLiteralConst SilentWrong # #2423 silent-wrong +read/lambda-default/ArrowLambda/ClassLiteralConst/Annotated/StaticInitializer/Later FalseRefusal # #2423 false-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Annotated/StaticInitializer/Later/outer=ModuleLiteralConst SilentWrong # #2423 missing-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Annotated/StructInitFieldInitializer/Earlier FalseRefusal # #2423 false-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Annotated/StructInitFieldInitializer/Earlier/outer=ModuleLiteralConst SilentWrong # #2423 silent-wrong +read/lambda-default/ArrowLambda/ClassLiteralConst/Annotated/StructInitFieldInitializer/Later FalseRefusal # #2423 false-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Annotated/StructInitFieldInitializer/Later/outer=ModuleLiteralConst SilentWrong # #2423 missing-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Inferred/ConstInitializer/Earlier FalseRefusal # #2423 false-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Inferred/ConstInitializer/Earlier/outer=ModuleLiteralConst SilentWrong # #2423 silent-wrong +read/lambda-default/ArrowLambda/ClassLiteralConst/Inferred/ConstInitializer/Later FalseRefusal # #2423 false-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Inferred/ConstInitializer/Later/outer=ModuleLiteralConst SilentWrong # #2423 missing-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Inferred/DataclassInitFieldInitializer/Earlier FalseRefusal # #2423 false-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Inferred/DataclassInitFieldInitializer/Earlier/outer=ModuleLiteralConst SilentWrong # #2423 silent-wrong +read/lambda-default/ArrowLambda/ClassLiteralConst/Inferred/DataclassInitFieldInitializer/Later FalseRefusal # #2423 false-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Inferred/DataclassInitFieldInitializer/Later/outer=ModuleLiteralConst SilentWrong # #2423 missing-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Inferred/InstanceFieldInitializer/Earlier FalseRefusal # #2423 false-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Inferred/InstanceFieldInitializer/Earlier/outer=ModuleLiteralConst SilentWrong # #2423 silent-wrong +read/lambda-default/ArrowLambda/ClassLiteralConst/Inferred/InstanceFieldInitializer/Later FalseRefusal # #2423 false-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Inferred/InstanceFieldInitializer/Later/outer=ModuleLiteralConst SilentWrong # #2423 missing-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Inferred/StaticInitializer/Earlier FalseRefusal # #2423 false-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Inferred/StaticInitializer/Earlier/outer=ModuleLiteralConst SilentWrong # #2423 silent-wrong +read/lambda-default/ArrowLambda/ClassLiteralConst/Inferred/StaticInitializer/Later FalseRefusal # #2423 false-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Inferred/StaticInitializer/Later/outer=ModuleLiteralConst SilentWrong # #2423 missing-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Inferred/StructInitFieldInitializer/Earlier FalseRefusal # #2423 false-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Inferred/StructInitFieldInitializer/Earlier/outer=ModuleLiteralConst SilentWrong # #2423 silent-wrong +read/lambda-default/ArrowLambda/ClassLiteralConst/Inferred/StructInitFieldInitializer/Later FalseRefusal # #2423 false-refusal +read/lambda-default/ArrowLambda/ClassLiteralConst/Inferred/StructInitFieldInitializer/Later/outer=ModuleLiteralConst SilentWrong # #2423 missing-refusal +read/lambda-default/Def/ClassLiteralConst/Annotated/ParameterDefault/Later/outer=ModuleLiteralConst SilentWrong # #2423 missing-refusal +read/lambda-default/Def/ClassLiteralConst/Inferred/ParameterDefault/Later/outer=ModuleLiteralConst SilentWrong # #2423 missing-refusal +read/lambda-default/Lambda/ClassLiteralConst/Annotated/ConstInitializer/Earlier FalseRefusal # #2423 false-refusal +read/lambda-default/Lambda/ClassLiteralConst/Annotated/ConstInitializer/Earlier/outer=ModuleLiteralConst SilentWrong # #2423 silent-wrong +read/lambda-default/Lambda/ClassLiteralConst/Annotated/ConstInitializer/Later FalseRefusal # #2423 false-refusal +read/lambda-default/Lambda/ClassLiteralConst/Annotated/ConstInitializer/Later/outer=ModuleLiteralConst SilentWrong # #2423 missing-refusal +read/lambda-default/Lambda/ClassLiteralConst/Annotated/DataclassInitFieldInitializer/Earlier FalseRefusal # #2423 false-refusal +read/lambda-default/Lambda/ClassLiteralConst/Annotated/DataclassInitFieldInitializer/Earlier/outer=ModuleLiteralConst SilentWrong # #2423 silent-wrong +read/lambda-default/Lambda/ClassLiteralConst/Annotated/DataclassInitFieldInitializer/Later FalseRefusal # #2423 false-refusal +read/lambda-default/Lambda/ClassLiteralConst/Annotated/DataclassInitFieldInitializer/Later/outer=ModuleLiteralConst SilentWrong # #2423 missing-refusal +read/lambda-default/Lambda/ClassLiteralConst/Annotated/InstanceFieldInitializer/Earlier FalseRefusal # #2423 false-refusal +read/lambda-default/Lambda/ClassLiteralConst/Annotated/InstanceFieldInitializer/Earlier/outer=ModuleLiteralConst SilentWrong # #2423 silent-wrong +read/lambda-default/Lambda/ClassLiteralConst/Annotated/InstanceFieldInitializer/Later FalseRefusal # #2423 false-refusal +read/lambda-default/Lambda/ClassLiteralConst/Annotated/InstanceFieldInitializer/Later/outer=ModuleLiteralConst SilentWrong # #2423 missing-refusal +read/lambda-default/Lambda/ClassLiteralConst/Annotated/StaticInitializer/Earlier FalseRefusal # #2423 false-refusal +read/lambda-default/Lambda/ClassLiteralConst/Annotated/StaticInitializer/Earlier/outer=ModuleLiteralConst SilentWrong # #2423 silent-wrong +read/lambda-default/Lambda/ClassLiteralConst/Annotated/StaticInitializer/Later FalseRefusal # #2423 false-refusal +read/lambda-default/Lambda/ClassLiteralConst/Annotated/StaticInitializer/Later/outer=ModuleLiteralConst SilentWrong # #2423 missing-refusal +read/lambda-default/Lambda/ClassLiteralConst/Annotated/StructInitFieldInitializer/Earlier FalseRefusal # #2423 false-refusal +read/lambda-default/Lambda/ClassLiteralConst/Annotated/StructInitFieldInitializer/Earlier/outer=ModuleLiteralConst SilentWrong # #2423 silent-wrong +read/lambda-default/Lambda/ClassLiteralConst/Annotated/StructInitFieldInitializer/Later FalseRefusal # #2423 false-refusal +read/lambda-default/Lambda/ClassLiteralConst/Annotated/StructInitFieldInitializer/Later/outer=ModuleLiteralConst SilentWrong # #2423 missing-refusal +read/lambda-default/Lambda/ClassLiteralConst/Inferred/ConstInitializer/Earlier FalseRefusal # #2423 false-refusal +read/lambda-default/Lambda/ClassLiteralConst/Inferred/ConstInitializer/Earlier/outer=ModuleLiteralConst SilentWrong # #2423 silent-wrong +read/lambda-default/Lambda/ClassLiteralConst/Inferred/ConstInitializer/Later FalseRefusal # #2423 false-refusal +read/lambda-default/Lambda/ClassLiteralConst/Inferred/ConstInitializer/Later/outer=ModuleLiteralConst SilentWrong # #2423 missing-refusal +read/lambda-default/Lambda/ClassLiteralConst/Inferred/DataclassInitFieldInitializer/Earlier FalseRefusal # #2423 false-refusal +read/lambda-default/Lambda/ClassLiteralConst/Inferred/DataclassInitFieldInitializer/Earlier/outer=ModuleLiteralConst SilentWrong # #2423 silent-wrong +read/lambda-default/Lambda/ClassLiteralConst/Inferred/DataclassInitFieldInitializer/Later FalseRefusal # #2423 false-refusal +read/lambda-default/Lambda/ClassLiteralConst/Inferred/DataclassInitFieldInitializer/Later/outer=ModuleLiteralConst SilentWrong # #2423 missing-refusal +read/lambda-default/Lambda/ClassLiteralConst/Inferred/InstanceFieldInitializer/Earlier FalseRefusal # #2423 false-refusal +read/lambda-default/Lambda/ClassLiteralConst/Inferred/InstanceFieldInitializer/Earlier/outer=ModuleLiteralConst SilentWrong # #2423 silent-wrong +read/lambda-default/Lambda/ClassLiteralConst/Inferred/InstanceFieldInitializer/Later FalseRefusal # #2423 false-refusal +read/lambda-default/Lambda/ClassLiteralConst/Inferred/InstanceFieldInitializer/Later/outer=ModuleLiteralConst SilentWrong # #2423 missing-refusal +read/lambda-default/Lambda/ClassLiteralConst/Inferred/StaticInitializer/Earlier FalseRefusal # #2423 false-refusal +read/lambda-default/Lambda/ClassLiteralConst/Inferred/StaticInitializer/Earlier/outer=ModuleLiteralConst SilentWrong # #2423 silent-wrong +read/lambda-default/Lambda/ClassLiteralConst/Inferred/StaticInitializer/Later FalseRefusal # #2423 false-refusal +read/lambda-default/Lambda/ClassLiteralConst/Inferred/StaticInitializer/Later/outer=ModuleLiteralConst SilentWrong # #2423 missing-refusal +read/lambda-default/Lambda/ClassLiteralConst/Inferred/StructInitFieldInitializer/Earlier FalseRefusal # #2423 false-refusal +read/lambda-default/Lambda/ClassLiteralConst/Inferred/StructInitFieldInitializer/Earlier/outer=ModuleLiteralConst SilentWrong # #2423 silent-wrong +read/lambda-default/Lambda/ClassLiteralConst/Inferred/StructInitFieldInitializer/Later FalseRefusal # #2423 false-refusal +read/lambda-default/Lambda/ClassLiteralConst/Inferred/StructInitFieldInitializer/Later/outer=ModuleLiteralConst SilentWrong # #2423 missing-refusal read/no-initializer/ModuleProperty/Absent/callable RuntimeThrow # #2423 runtime-throw read/no-initializer/ModuleProperty/Absent/class RuntimeThrow # #2423 runtime-throw read/no-initializer/ModuleProperty/Absent/enum SilentWrong # #2423 missing-refusal From 5e2156981f53666302379369005076ed0a9f76d7 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 22:00:32 +0000 Subject: [PATCH 19/22] process(plan): plan-777361 (P78) revised after pass 4 Answers /verify-plan pass 4 (NEEDS REVISION, Adequacy: CELL @ 73c785856) under the owner's rulings of 2026-11-20 (#2423 comments 7049561049, items 17, 19 and 20, and 7050154806, item 22). Stage 0 is aa6d84462. The plan is a DRAFT again: no pass has stamped this text, and no fifth pass is asked for (item 22; no `Extra verify pass 5` line). - Finding 1 (item 17): D8's rung-3 arm is a field C# reads as a constant, `FieldInfo.IsLiteral` or, except at an attribute argument, `DecimalConstantAttribute`; M9 gains "for a decimal constant -> `decimal.one` SPY0401". "D8 refuses nothing that runs" stands: `decimal.one` runs at every default host and `const` site stage 0 generates. - Finding 2 (item 22 supersedes 18): out of P78. Out of contract names a delegate's default, a signature-only interface method's default, attributes not on a class's method and a union's attribute arguments with #2779; the Generator row lists the host axis as closed by the owner's decision; #2432's close criterion claims the hosts S0b generates; D8's predicate is "in contract"; D8 gains no sentence for those hosts. - Finding 3 (item 20): the trackers line points at ruling 6 for #2487's remainder. - Finding 4 (item 20): answered in stage 0 (the builtin name on every member whose owner has one); counts follow. - Finding 5 (item 19): D4 says a lambda's parameter default, `lambda` or arrow, is not its body: in a class-level initializer D3 decides it, as a `def`'s. A6 and M6 gain the lambda-default cells; the by-direction list names the `12` a module binding gives today. Body 20,474 -> 20,473 bytes of 20,480 (`check_plan_refs.py`: RESULT: OK). Additions 1,154 bytes, paid by cuts: the `64` / `3` parenthetical and #2398's program in Current State; R-KV's reason in Scope; what the hand control holds (Standing harness); "A8 is the record."; the two row counts in Out of contract; A1's which-decision-drains-which; A8's list of codes; A11's "in five spec files"; A14's "(`m.Q`: CS1736 today)"; the `TypeChecker` and `NameResolver` partial names in T1, T2 and T7, `ClrTypeHelper.cs` in T10 and T8's table edit (D9 spells it); the "; Semantic" tag of D1 and D2; "rulings" and "literal" (one word each); the two Testing Strategy bullets "Beyond the generator" and "Outputs discriminate"; the descriptions in the 1st-, 2nd- and 3rd-pass revision-log lines (the deferred row is kept). The stamp lines and the Verification Summary are removed. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01LGMKZVcFYGqQRfHgd16DLa --- docs/process/plans/plan-777361.md | 188 +++++------------------------- 1 file changed, 31 insertions(+), 157 deletions(-) diff --git a/docs/process/plans/plan-777361.md b/docs/process/plans/plan-777361.md index 2c5bd78c8..d33dd9564 100644 --- a/docs/process/plans/plan-777361.md +++ b/docs/process/plans/plan-777361.md @@ -1,7 +1,4 @@ - - - - + # P78 — N1/N2/N4/N7: scope decides meaning @@ -11,11 +8,11 @@ Rules N1, N2, N4 and N7 of `docs/design/name-resolution.md` (charter §3.20l): # ## Current State -`sharpyc run` @ 19ffa7ad1 (code e24aaf9f0); python 3.15.2. The known-red rows are the state. By class: order and kind (under a module binding a later `@static` yields, `64`, and a later literal `const` outranks, `3`); untyped reads and bodies (#2398: `x()` on a parameter under a module `def x` prints `12`); constant positions (#2432); R-QI (module `x: T` reads `0`). +`sharpyc run` @ aa6d84462 (code e24aaf9f0); python 3.15.2. The known-red rows are the state. By class: order and kind; untyped reads and bodies (#2398); constant positions (#2432); R-QI (module `x: T` reads `0`). ## Scope -- **Group:** P78 (chores: none). #2432 stays in (R-KV): its rows sit on `TypeBodyMembership` and the interface/union cell #2398 shares. +- **Group:** P78 (chores: none). #2432 stays in (R-KV). - **Tier:** full (c: the seam is under `Semantic/`) — from charter §3.20l - **Alone:** no — verdicts, not layout; no snapshot moves (A12) - **Gates:** 1 — `/ci-gate` on the pushed tip, counts `@ sha (measured)` @@ -31,40 +28,40 @@ Rules N1, N2, N4 and N7 of `docs/design/name-resolution.md` (charter §3.20l): # - **Known member cells:** #2423, #2398, #2432; the folded #2415 (C08) and #2416 method-group cells; R-QI's cells (#2427, comment 6967863739). - **Sibling cells this plan must also cover:** none; see Generator. - **Lane / reach:** false-refusal + silent-wrong + ice · program; **fidelity-scope row:** "which programs run vs. are refused" and "value of an expression", both COMPARED. -- **Standing harness that should have caught it:** `NameResolutionDifferentialTests`; `ClassBodyReadPositionMatrixTests` is the hand control (R-KF) for steer text and diagnostic count per position × host. -- **Generator:** stage 0 (§2.1) @ 0fe74e4c1. `name-resolution-rules.txt` (S0a, #2487): one row per cell of both pools and a cell per row. `NameResolutionDifferentialTests`: 8951 cases, 2368 known-red rows. `ScopeMeaningDifferentialTests` (S0b): 4682 cases, 1383 known-red rows (555 / 661 / 150 / 17 cite #2423 / #2432 / #2417 / #2147), verdicts read from the rows. Each S0b axis is an image, every value generated or excluded with a reason, 27 of them probed, one in a child process (`Axes_EveryValueIsGeneratedOrExcluded`). Hand lists, each a decision: one host program per reader, one or two members per kind, one outer binding per sibling form, one value per declared type, the census's namespace (`System`). Closed by decision: the chain pair (call 45), the five other `Scope*` enums, one call site per callee cell (D5's census), a reader nested in or beside the member's type (the 8951 pool's). Excluded: the project route (A3, A14), message text, a self-reaching alias an annotation names (#2769), an interface's statics (#2383, #2111), an int enum's `.value` / `.name` through an alias, a lambda's dotted annotation. Green by D1–D7, D10 (A1, A2, A4–A7, A13), D8 (A9). -- **Owner rulings:** R-KD, R-KF, R-KG, R-KJ, R-KV, R-LJ, R-LO, R-PM, R-QE, R-QI (charter §4); #2432's call-43 and call-45 cells (§3.20l); owner 2026-11-20, #2423 comments 7030074628 (rulings 1–4), 7039834146 (5–6), 7042723494 (7–9), 7045166298 (10), 7046304965 (12–13). +- **Standing harness that should have caught it:** `NameResolutionDifferentialTests`; `ClassBodyReadPositionMatrixTests` is the hand control (R-KF; A6). +- **Generator:** stage 0 (§2.1) @ aa6d84462. `name-resolution-rules.txt` (S0a, #2487): one row per cell of both pools and a cell per row. `NameResolutionDifferentialTests`: 8951 cases, 2368 known-red rows. `ScopeMeaningDifferentialTests` (S0b): 4963 cases, 1570 known-red rows (637 / 766 / 150 / 17 cite #2423 / #2432 / #2417 / #2147), verdicts read from the rows. Each S0b axis is an image, every value generated or excluded with a reason, 32 of them probed, one in a child process (`Axes_EveryValueIsGeneratedOrExcluded`). Hand lists, each a decision: one host program per reader, one or two members per kind, one outer binding per sibling form, one value per declared type, one call per lambda spelling, the census's namespace (`System`). Closed by decision: the chain pair (call 45), the five other `Scope*` enums, one call site per callee cell (D5's census), a reader nested in or beside the member's type (the 8951 pool's), a constant position's hosts (owner, comment 7050154806). Excluded: the project route (A3, A14), message text, a self-reaching alias an annotation names (#2769), an interface's statics (#2383, #2111), an int enum's `.value` / `.name` through an alias, a lambda's dotted annotation, its default when stored or in a property default, `char` as a receiver. Green by D1–D7, D10 (A1, A2, A4–A7, A13), D8 (A9). +- **Owner rulings:** R-KD, R-KF, R-KG, R-KJ, R-KV, R-LJ, R-LO, R-PM, R-QE, R-QI (charter §4); #2432's call-43 and call-45 cells (§3.20l); owner 2026-11-20, #2423 comments 7030074628 (1–4), 7039834146 (5–6), 7042723494 (7–9), 7045166298 (10), 7046304965 (12–13), 7049561049 (17, 19–20), 7050154806 (22). ## Adversarial Review (pre-mortem) - **Alternative root cause:** "bodies are checked in textual order" — refuted: the same function reads a later `const`, `def` and class; only the variable's symbol is missing. Second cause: a symbol is untyped until its declaration is checked (D2). -- **Alternative layer:** scoping has no `.spy`, dunder or protocol spelling; D8's literal arm is rung 3. +- **Alternative layer:** scoping has no `.spy`, dunder or protocol spelling; D8's CLR arm is rung 3. - **How the fix could be inert:** D1 without D2 leaves CS0029; F2's yield above the N2 refusal keeps `64`; a callee site on its own lookup keeps `12`. -- **Before/after by direction:** newly refused and `worked`, each ruled: N2's cells whatever the member's kind or position, an attribute argument included (`64`, `3`; R-KD, R-KJ); a nested type's bare read of its enclosing type's `const` (`7`; R-KG); a class member read bare in a comprehension element of a `@static` initializer (`2`; N1); a module initializer under a later same-named declaration (`2`, python `7`; R-LJ); a declaration with no initializer (R-QI; none in 4,565 `.spy` files, 22 in five spec files: A11); an unused alias to a missing type (`1`; D10). Newly running: every order-only refusal, and bare imported `PIPE` as a default. D8 refuses nothing that runs. A8 is the record. +- **Before/after by direction:** newly refused and `worked`, each ruled: N2's cells whatever the member's kind or position, an attribute argument included (`64`, `3`; R-KD, R-KJ); a nested type's bare read of its enclosing type's `const` (`7`; R-KG); a class member read bare in a comprehension element of a `@static` initializer (`2`; N1); a module initializer under a later same-named declaration (`2`, python `7`; R-LJ); a declaration with no initializer (R-QI; none in 4,565 `.spy` files, 22 in five spec files: A11); an unused alias to a missing type (`1`; D10). Newly running: every order-only refusal, a lambda's default naming a member (`12` under a module binding; ruling 19), and bare imported `PIPE` as a default. D8 refuses nothing that runs. - **Blast radius:** the whole gate; Stdlib.Tests (module variables), cold/warm and `FrontEndParityTests` first. - **Generated artifacts touched:** none may move (A12); the oracle ledger follows T11. ## Design Decisions No rule below reads a builtin or type name; a rung applies only in D8. -- **D1 (module variables are declared first; Semantic).** `NameResolver.ResolveDeclaration` declares every module-level `VariableDeclaration`, annotated or `auto`, as it does a `const`; `TypeChecker.CheckVariableDeclaration` completes that symbol. A module `let` (SPY0340) and a second declaration of the name (#2125) keep today's verdicts (P21b). Predicates: no module-level `VariableSymbol` is created by `TypeChecker`; a variable's export is its declared symbol, cold and warm, so the identity-bridge arm of `ImportedStaticFacts.ImportedStorage` and `SemanticBinding`'s module-value map are deleted (its first arm stays). -- **D2 (a read is typed whatever the order; Semantic).** `CheckModule` resolves every declared type before it checks a body or an initializer: annotated module variables and module properties beside the consts, and each type's annotated members (fields, consts, properties, method signatures, union cases), nested types included. An unannotated module-level or type-level value is checked on its first read, in its own declaration's scope state, under an in-progress mark; a read that re-enters its own inference stays `Unknown` as today and adds no refusal (the cycle graph's SPY0278 is a ring's). Predicate: no read of a declared module-level or type-level name is `Unknown` because of where the declaration stands. +- **D1 (module variables are declared first).** `NameResolver.ResolveDeclaration` declares every module-level `VariableDeclaration`, annotated or `auto`, as it does a `const`; `TypeChecker.CheckVariableDeclaration` completes that symbol. A module `let` (SPY0340) and a second declaration of the name (#2125) keep today's verdicts (P21b). Predicates: no module-level `VariableSymbol` is created by `TypeChecker`; a variable's export is its declared symbol, cold and warm, so the identity-bridge arm of `ImportedStaticFacts.ImportedStorage` and `SemanticBinding`'s module-value map are deleted (its first arm stays). +- **D2 (a read is typed whatever the order).** `CheckModule` resolves every declared type before it checks a body or an initializer: annotated module variables and module properties beside the consts, and each type's annotated members (fields, consts, properties, method signatures, union cases), nested types included. An unannotated module-level or type-level value is checked on its first read, in its own declaration's scope state, under an in-progress mark; a read that re-enters its own inference stays `Unknown` as today and adds no refusal (the cycle graph's SPY0278 is a ring's). Predicate: no read of a declared module-level or type-level name is `Unknown` because of where the declaration stands. - **D3 (one class-body rule: N1, N2, N4, N7).** `TryResolveClassBodySiblingRead` decides a bare read of a member its type body declares by four facts: the member's level (type or instance), its order against the reader, whether a binding outside the body holds the name, and the position. Earlier: the member. At-or-after with an outer binding: SPY0619 in every position and for every member kind, instance included, judged before the kind refusal and SPY0401. At-or-after with none: the member, a forward read (N3); a self read is the cycle graph's. Outside N2 an instance member keeps its kind refusal and never yields, a parameter default keeps SPY0401 for a non-constant, an inherited member R1 (b). Deleted: F1's refusal, F2's yield, the `const` exemption in `IsDeclaredLater`, `ReportAmbiguousLaterConstReads`. Predicate: the verdict never reads `IsConstant`, the compile-time fact or the spelling. -- **D4 (bodies do not see class variables: N1, R-KG).** `Scope.ResolveName` crosses a type body from a nested type's body as from a function-like scope: no field, `const` or property of an enclosing type binds there bare. The crossing is variable-only, as today: a type, alias, type parameter or function still binds. `ClassifyClassBodyReadPosition` names three more positions — a nested type's body, a lambda in an initializer, a comprehension's body (all but its first iterable) — each with its phrase in the one SPY0200 steer. With an outer binding the read is that binding (R-Y), recorded through `SetModuleAccessCrossesClassMember` for an imported name as for a module variable. Predicate: every scope kind between a read and a type body is classified, with no default arm. +- **D4 (bodies do not see class variables: N1, R-KG).** `Scope.ResolveName` crosses a type body from a nested type's body as from a function-like scope: no field, `const` or property of an enclosing type binds there bare. The crossing is variable-only, as today: a type, alias, type parameter or function still binds. `ClassifyClassBodyReadPosition` names three more positions — a nested type's body, a lambda in an initializer, a comprehension's body (all but its first iterable) — each with its phrase in the one SPY0200 steer. A lambda's parameter default, `lambda` or arrow, is not its body: in a class-level initializer D3 decides it, as a `def`'s (ruling 19). With an outer binding the read is that binding (R-Y), recorded through `SetModuleAccessCrossesClassMember` for an imported name as for a module variable. Predicate: every scope kind between a read and a type body is classified, with no default arm. - **D5 (one callee resolver).** A bare callee resolves by the scope walk a bare read uses and dispatches on the symbol it bound, whatever an outer binding of the name is. The 33 direct `LookupFunctionOverloads` / `BuiltinRegistry.GetFunction` / `GetFunctionOverloads` sites in `TypeChecker*.cs` go behind it; a census test pins the remainder at the helper's own. A constructor's overload set is the whole body's. - **D6 (N2 at module level; R-LJ).** A read evaluated at load — a module-level or class-level initializer or default, never a function body — of a builtin name its module declares at or after the reader is SPY0619. An import its module redeclares stays SPY0204 at the declaration. - **D7 (R-QI).** A module variable, a `@static` field, and a module or `@static` auto-property with no initializer is SPY0620 at its declaration, whatever its type and host; the steer names `x: T = ` and `x: T | None = None`. Untouched: an instance field, a local `x: T`, a property with accessor bodies. -- **D8 (#2432; Semantic, Validation, CodeGen).** One answer per name the checker bound, for the identifier and member hooks, under every spelling (N7). True: a `const` whose fact is true; an int enum's member and its `.value`; and — rung 3: a referenced assembly's constant has no Sharpy symbol — a literal field of a referenced type or module (a module's by discovery's `IsConst`; a type's or enum's by `FieldInfo.IsLiteral`, through `ClrTypeHelper`). False: every other bound name (a `@static` member, own or inherited; a module variable, property or function; a string enum's member, any `.name`; a CLR static that is no literal). The shape rule keeps only what the checker did not bind. Every `IsAdmitted` call passes the answer: a `const` handed a non-constant is a computed constant, never C#'s `const`; a struct auto-property is a constructor parameter only for a constant (`MarkStructConstructorProperty`) and otherwise keeps its initializer and runs; the validator judges an enum member's value (a new `AdmissionTable` row), pushes interface and union hosts on `_enclosingTypes`, and refuses an attribute argument under SPY0425, each argument first checked by the checker as an expression in the scope its declaration stands in (a member's attribute in its type's body, so D3 and D4 decide its bare names) and printed by `GenerateAttributeArgumentExpression`'s ordinary read route. A `ComparisonChain` is admitted when each link is. Predicate: no expression reaches C# as a non-constant in a constant position, and no constant admitted today is refused. +- **D8 (#2432; Semantic, Validation, CodeGen).** One answer per name the checker bound, for the identifier and member hooks, under every spelling (N7). True: a `const` whose fact is true; an int enum's member and its `.value`; and — rung 3: a referenced assembly's constant has no Sharpy symbol — a field of a referenced type or module that C# reads as a constant (a module's by discovery's `IsConst`; a type's or enum's by `FieldInfo.IsLiteral` or, except at an attribute argument, `DecimalConstantAttribute`, through `ClrTypeHelper`). False: every other bound name (a `@static` member, own or inherited; a module variable, property or function; a string enum's member, any `.name`; a CLR static that is no such constant). The shape rule keeps only what the checker did not bind. Every `IsAdmitted` call passes the answer: a `const` handed a non-constant is a computed constant, never C#'s `const`; a struct auto-property is a constructor parameter only for a constant (`MarkStructConstructorProperty`) and otherwise keeps its initializer and runs; the validator judges an enum member's value (a new `AdmissionTable` row), pushes interface and union hosts on `_enclosingTypes`, and refuses an attribute argument under SPY0425, each argument first checked by the checker as an expression in the scope its declaration stands in (a member's attribute in its type's body, so D3 and D4 decide its bare names) and printed by `GenerateAttributeArgumentExpression`'s ordinary read route. A `ComparisonChain` is admitted when each link is. Predicate: in contract, no expression reaches C# as a non-constant in a constant position, and no constant admitted today is refused. - **D9 (codes).** SPY0619 (N2; the text carries both readings and the qualified spelling) and SPY0620 (R-QI); SPY0618 retires. T8 edits, in one commit, the table's rows, the `Expect*` arms that mirror them and `AdmittedRefusals`: D3's N2 cells leave `kind:instance-at-initializer` and `SPY0401`, N2 admits SPY0619 alone, N2-module SPY0619 and SPY0204, `kind:enum-member-constant` SPY0401, `N1-arity` names its code; S0b's R-QI cells, which admit none today, admit SPY0620. - **D10 (an alias names a type that exists; owner).** An alias whose target names a missing type — as the name itself, inside a wrapper, type argument or callable, dotted, or in a generic alias's body — is SPY0202 at the alias, at every site (module, type body, function, block), named or not: both binders resolve the target where the alias is declared, expanding none that reaches its own alias (#2769, unruled: unused, it still runs). Predicate: no declared alias's target names a missing type. -- **Out of contract:** a read above a same-scope local (P80); a store without `global` (P79); a walrus over `let` (P21b); `ALSO = RED` (#2069); a receiver read untyped at either order (#2417, S0b's 150 rows); `self.x` of a `const` (#2147, 17 rows); a self-reaching alias named by an annotation (#2769); the #2397 rows; `T !E` above its `E` (#2249); `from m import x` as a live alias (N6). +- **Out of contract:** a read above a same-scope local (P80); a store without `global` (P79); a walrus over `let` (P21b); `ALSO = RED` (#2069); a receiver read untyped at either order (#2417); `self.x` of a `const` (#2147); a self-reaching alias named by an annotation (#2769); the #2397 rows; `T !E` above its `E` (#2249); `from m import x` as a live alias (N6); a `delegate`'s default, a signature-only interface method's, attributes not on a class's method, a union's attribute arguments (#2779; ruling 22). ## Implementation ### Phase 1: Names are order-free and typed (N1) **Acceptance:** -- **A1.** #2423's module-level rows under N1, N1-nesting and N3 drain: a module variable's by D1, the untyped reads of a later type's member, module property, alias or union by D2 — **M1:** declare only annotated variables → the `auto` cells red +- **A1.** #2423's module-level rows under N1, N1-nesting and N3 drain (D1, D2) — **M1:** declare only annotated variables → the `auto` cells red - **A2.** S0b's typed-read rows citing #2423 drain: SPY0220 at both orders, under every spelling and reader position — **M2:** skip a type's members in the pre-pass → the annotated-member cells CS1503; drop the first-read check → the inferred ones; remove the in-progress mark → a ring of two `auto` lambdas (`1`) never ends - **A3.** `StaticStorageFactsRoundTripTests` and `ColdWarmBuildDifferentialTests` hold a variable's export equal to its declared symbol, cold and warm, per importer form — **M3:** create the symbol in `CheckVariableDeclaration` again → the cold cell red - **A4.** The N1-innermost rows and the module-level N1-type-error and N1-arity rows drain; S0b's callee cells print `1` under every outer binding and its later-`__init__` cell runs — **M4:** send one site back to `LookupFunctionOverloads` → red, and the census pin red @@ -72,8 +69,8 @@ No rule below reads a builtin or type name; a rung applies only in D8. #### Tasks -- **T1. Module variables (D1)** — `NameResolver.Declarations.cs`, `NameResolver.Members.cs`, `TypeChecker.Statements.cs`, `ProjectCompiler.Phases.cs`, `StaticStorageFacts.cs`. (A1, A3) -- **T2. Types before reads (D2)** — `TypeChecker.cs`, `TypeChecker.Statements.cs`, `TypeChecker.Definitions.cs`. (A1, A2) +- **T1. Module variables (D1)** — `NameResolver*.cs`, `TypeChecker.Statements.cs`, `ProjectCompiler.Phases.cs`, `StaticStorageFacts.cs`. (A1, A3) +- **T2. Types before reads (D2)** — `TypeChecker*.cs`. (A1, A2) - **T3. One callee resolver (D5)** — D5's 33 sites; the census in `DispatchSiteInventoryTests`. (A4) - **T12. Alias targets (D10)** — `ResolveTypeAliasDeclaration`, `RegisterScopedTypeAlias`, `TypeResolver.cs`. (A13) @@ -81,34 +78,34 @@ No rule below reads a builtin or type name; a rung applies only in D8. **Acceptance:** - **A5.** #2423's type-level and N2-module rows drain, C08's pin in `StaticInitializerOrderMatrixTests` moves to SPY0619, and no cell under N2 answers with another code — **M5:** restore F2's yield → `64`; restore the `const` exemption → `3`; report under SPY0200 → red; let a function body count for D6 → its controls red -- **A6.** The #2398 rows and #2423's R-Y, N1-methods and R-KG rows drain; the hand control, scope {own body, nested type at two depths, lambda in an initializer, comprehension body} × host {class, struct, interface, union}, holds one diagnostic with its position's phrase — **M6:** drop D4's crossing → SPY0909; give the lambda the method-body text → red +- **A6.** The #2398 rows and #2423's R-Y, N1-methods and R-KG rows drain, S0b's lambda-default rows with them; the hand control, scope {own body, nested type at two depths, lambda in an initializer, comprehension body} × host {class, struct, interface, union}, holds one diagnostic with its position's phrase — **M6:** drop D4's crossing → SPY0909; give the lambda the method-body text → red; judge a lambda's default as its body → SPY0200 - **A7.** S0b's R-QI cells are SPY0620 in every host and for every declared type; their controls run — **M7:** skip `@static` → red; include instance fields → the control red -- **A8.** Direction record: every fixture, spec block and `.spy` stdlib module newly refused, under any code (SPY0619, SPY0620, SPY0202, D4's SPY0200, D8's SPY0401 and SPY0425), with its prior behaviour; none `worked` outside the rulings above +- **A8.** Direction record: every fixture, spec block and `.spy` stdlib module newly refused, under any code, with its prior behaviour; none `worked` outside the rulings above #### Tasks - **T4. The class-body rule (D3)** — `TypeChecker.ClassScopeRule.cs`, `TypeBodyMembership.cs`. (A5) - **T5. Bodies and nested types (D4)** — `Scope.cs`, `SymbolTable.cs`, `TypeChecker.ClassScopeRule.cs`. (A6) - **T6. N2 at module level (D6)** — `TypeChecker.Expressions.cs`. (A5) -- **T7. No-initializer refusal (D7)** — `TypeChecker.Statements.cs`, `TypeChecker.Definitions.cs`. (A7) -- **T8. Codes (D9)** — `DiagnosticCodes.cs`, `DiagnosticExplanations.Semantic.cs`; `name-resolution-rules.txt` with `ExpectClass` and `AdmittedRefusals`; the codes `NoInitializerCases` admits. (A5, A7) +- **T7. No-initializer refusal (D7)** — `TypeChecker*.cs`. (A7) +- **T8. Codes (D9)** — `DiagnosticCodes.cs`, `DiagnosticExplanations.Semantic.cs`; D9's table edit. (A5, A7) - **T9. Hand control** — `ClassBodyReadPositionMatrixTests`: its copy of the contract becomes D3 and D4. (A6) ### Phase 3: Constant positions (#2432) **Acceptance:** -- **A9.** The #2432 rows of both allowlists drain, each S0b constant-kind cell as its row says, under every spelling and placement (a non-constant refused, computed or kept by its position; a referenced literal run everywhere) — **M9:** answer null for a bound non-constant → CS1736; answer false for a type's literal → `int.max_value` SPY0401; skip the enum row → CS0133; classify the struct property with no resolver → CS1736; admit every chain → `0 < 2 in [1, 2]` reaches C#; skip the attribute argument's check → CS0120; check it at module scope → a bare sibling `const` SPY0425; keep the attribute printer's member arm → CS0103 +- **A9.** The #2432 rows of both allowlists drain, each S0b constant-kind cell as its row says, under every spelling and placement (a non-constant refused, computed or kept by its position; a referenced literal run everywhere) — **M9:** answer null for a bound non-constant → CS1736; answer false for a type's literal → `int.max_value` SPY0401; for a decimal constant → `decimal.one` SPY0401; skip the enum row → CS0133; classify the struct property with no resolver → CS1736; admit every chain → `0 < 2 in [1, 2]` reaches C#; skip the attribute argument's check → CS0120; check it at module scope → a bare sibling `const` SPY0425; keep the attribute printer's member arm → CS0103 - **A10.** An interface or union parameter default draws one diagnostic — **M10:** drop either push → two -- **A14.** Per importer form, a two-file fixture reads an imported literal `const`, an imported class's and a computed one at a parameter default: `5 9`, then SPY0401 (`m.Q`: CS1736 today) — **M14:** answer false for an imported constant → SPY0401 +- **A14.** Per importer form, a two-file fixture reads an imported literal `const`, an imported class's and a computed one at a parameter default: `5 9`, then SPY0401 — **M14:** answer false for an imported constant → SPY0401 #### Tasks -- **T10. Constants (D8)** — `ConstantPositionValidator.cs`, `ConstantDefaultClassifier.cs`, `ConstEligibility.cs`, `CodeGenInfoComputer.cs`, `TypeChecker.Definitions.cs`, `ClrTypeHelper.cs`, `RoslynEmitter.TypeDeclarations.cs`. (A9, A10, A14) +- **T10. Constants (D8)** — `ConstantPositionValidator.cs`, `ConstantDefaultClassifier.cs`, `ConstEligibility.cs`, `CodeGenInfoComputer.cs`, `TypeChecker.Definitions.cs`, `RoslynEmitter.TypeDeclarations.cs`. (A9, A10, A14) ### Phase 4: Spec and record **Acceptance:** -- **A11.** `docs/language_specification/variable_scoping.md` is rewritten around N1–N7: each rule's example executed and printing something else with its rule off; an `error` block per refusal; the F1, F2, R-JJ and SPY0618 texts gone; touched files drained (R-BG). `variable_declaration.md` § Bare Declarations beside it states D7, and the 22 such declarations in five other spec files get a value or move into a body. `docs/deviations.yaml`: `class-body-bare-name-read` is N1 and N2's text. `docs/design/name-resolution.md`: the *Today* notes of N1, N2 and N4 go, and it and `docs/design/gap-discovery-contracts.md` name the table. #2426's other open items are fixed or marked pending with their issue. `check_spec_blocks.sh` green +- **A11.** `docs/language_specification/variable_scoping.md` is rewritten around N1–N7: each rule's example executed and printing something else with its rule off; an `error` block per refusal; the F1, F2, R-JJ and SPY0618 texts gone; touched files drained (R-BG). `variable_declaration.md` § Bare Declarations beside it states D7, and the 22 other declarations get a value or move into a body. `docs/deviations.yaml`: `class-body-bare-name-read` is N1 and N2's text. `docs/design/name-resolution.md`: the *Today* notes of N1, N2 and N4 go, and it and `docs/design/gap-discovery-contracts.md` name the table. #2426's other open items are fixed or marked pending with their issue. `check_spec_blocks.sh` green - **A12.** `regen: no diff` after T1 and T4, for spy-stdlib C#, spy-test C# and `.expected.cs`; `FrontEndParityTests` green - Allowlists drain, each row in the commit that turns it green: every #2423, #2398 and #2432 row of both; both scorecard baselines lowered with `--lower` @@ -119,147 +116,24 @@ No rule below reads a builtin or type name; a rung applies only in D8. ## Testing Strategy - Fixtures: one `.spy` + `.expected` per rule and one `.error` per refusal code and D4 phrase, each with its running control. -- Beyond the generator: host {interface, union}; the project route (A3, A14). -- Outputs discriminate: member and outer values differ. ## Issues to Close - #2423 — closed by T1–T9, T12; **close criterion:** A1–A8, A13 @ sha, 0 rows citing it in either allowlist - #2398 — closed by T5, T9, T10; **close criterion:** A6 and A10 @ sha -- #2432 — closed by T10; **close criterion:** A9 and A14 @ sha: the SPY0401 verdict (owner); the constants are #2768's +- #2432 — closed by T10; **close criterion:** A9 and A14 @ sha, on the hosts S0b generates: the SPY0401 verdict (owner); the constants are #2768's, the other hosts #2779's - #2426 — closed by T11; **close criterion:** A11 @ sha ## Class trackers this plan may post cells to - #2427 (the principle), #2457 (the harness's residue) -- #2486 — the rule tables; #2487 stays open (owner) -- #2397, #2417, #2069, #2147, #2249, #2383, #2768, #2769 — neighbours +- #2486 — the rule tables; #2487 stays open: ruling 6 lists its remainder +- #2397, #2417, #2069, #2147, #2249, #2383, #2768, #2769, #2779 — neighbours ## Revision log - @ 8bd4b49fc — revised before the first pass: stage 0, D10, #2432's close. -- @ a7fbd945d — revised after the 1st pass (NEEDS REVISION, Dimension 6): S0b's seven axes closed; D2 with no SPY0240 arm. -- @ 656991807 — revised after the 2nd pass (NEEDS REVISION, Dimension 6): stage 0's member-kind axis and reader census; D8 per bound name (findings 1–3); 4, 6 and D2's mark folded. Deferred (owner): D10's module-level judgement ← the pipeline order — fix: judge the target once every type and import is declared — proved by the `dotted` and `Later` must-run cells. -- @ 56dbb009f — revised after the 3rd pass (NEEDS REVISION, Dimension 6): stage 0: a constant position's spelling and placement, a module's functions, a declined method, a probe per compiler-resting exclusion; D8: an attribute argument's scope; A14 (findings 1–4). - -## Verification Summary - -**Result:** NEEDS REVISION (Dimension 4, a design row on D8, and Dimension 6). This is the fourth pass, the extra one the owner asked for (#2423 comment 7046359997), so the open findings go to the owner (R-LW). -**Adequacy:** CELL -**Verified on:** 2026-11-20 @ 73c785856 (product code == e24aaf9f0; stage 0 @ 0fe74e4c1; the solution, Debug `sharpyc` and the test binaries rebuilt at this tree; python = CPython 3.15.2, `.venv/bin/python3`) -**Plan file:** `docs/process/plans/plan-777361.md` (committed in §4 at every result, NEEDS REVISION included) - -### Paraphrase -- **Changes:** a module-level or class-level name gets one meaning, one type and one legality verdict whatever its binding kind, order, spelling and reading position. Name resolution declares every module variable up front, annotated or `auto`; the checker completes that symbol and creates none, and a variable's export is that symbol cold and warm, so two bridging maps are deleted (D1). `CheckModule` resolves every declared type (module variables and properties, each type's annotated members, nested types) before any body or initializer; an unannotated value is checked at its first read under an in-progress mark, and a read that re-enters its own inference stays untyped and adds no refusal (D2). One class-body rule decides a bare sibling read from the member's level, its order against the reader, an outer binding of the name and the position: earlier is the member; at-or-after under an outer binding is the new SPY0619 for every kind and position, judged before the kind refusal and SPY0401; at-or-after with none is a forward read; F1, F2, the `const` exemption and the later-const report go (D3). A nested type's body, a lambda in an initializer and a comprehension's body stop seeing an enclosing type's variables bare, each with its phrase in SPY0200; types, aliases and functions still bind; under an outer binding the read is that binding (D4). A bare callee resolves by the walk a bare read uses; 33 direct lookup sites go behind one resolver with a census pin (D5). A load-time read of a builtin name its module declares at or after the reader is SPY0619 (D6). A module variable, a `@static` field and a module or `@static` auto-property with no initializer is the new SPY0620 (D7). A constant position gets one answer per name the checker bound: true for a `const` whose fact is true, an int enum's member and its `.value`, and a literal field of a referenced type or module; false for every other bound name. Every classifier call passes that answer: a `const` handed a non-constant is computed, a struct auto-property keeps a non-constant initializer and runs, the validator judges an enum member's value, pushes interface and union hosts, and refuses an attribute argument under SPY0425 once the checker has checked it in the scope its declaration stands in; the attribute printer takes the ordinary read route; a chain is admitted link by link (D8). SPY0618 retires and one commit re-labels the table and the generator's arms (D9). An alias whose target names a missing type is SPY0202 at the alias at every site and shape, used or not; a target that reaches its own alias is not expanded (D10). The spec is rewritten around N1–N7; a row drains in the commit that turns it green; #2487 stays open. · **Today:** by the plan, the known-red rows are the state: order and kind decide (a later `@static` yields, `64`; a later literal `const` outranks, `3`), a forward read is untyped and a callee keeps its own lookup (`x()` on a parameter under a module `def x` prints `12`), a constant position reaches C#, and a module `x: T` reads `0`. Instruments: an 8951-case pool with 2368 known-red rows and a 4682-case generated type with 1383. · **Could not paraphrase:** none. Two sentences leave a reading open and are raised below: D8's "a type's or enum's by `FieldInfo.IsLiteral`" beside its predicate "no constant admitted today is refused" (finding 1), and D4's "a lambda in an initializer", which does not say whether the lambda's parameter default is part of it (finding 5). - -### Corrections Made -- The DRAFT marker is replaced by this pass's stamp. Nothing else was changed: the body is 20,473 of 20,480 bytes, and every finding below grows it or is the author's or the owner's. The `Extra verify pass 4` line was already in `## Scope` and matches the owner's words in comment 7046359997 letter for letter. - -### Stage 0 checks (contract §11) -- **Path check:** `git merge-base origin/dev 0fe74e4c1` = e24aaf9f0 (`origin/dev` is now 11b0e95aa). `git diff --name-only e24aaf9f0..0fe74e4c1 -- ':!docs/process/plans/'` lists `build_tools/scorecard-baseline.json` and 14 files under `src/Sharpy.Compiler.Tests/Conformance/`. Not seeded. No product path differs from e24aaf9f0. PASS. -- **Green @ 73c785856 (measured):** the two generated types, 241 passed / 0 failed / 0 skipped (11.3 min). After the last restore, the two types with `ClassBodyReadPositionMatrixTests`, `StaticInitializerOrderMatrixTests`, `ConstantPositionValidator*` and `CiFilterCoverageConformanceTests`: 346 / 0 / 0 (11.1 min). `ScopeMeaning_Sweep`, from its own report: pool 4682 (2139 must-run, 2543 must-refuse), python agreed 30/30, red 1383, allowlist 1383; no-initializer 318 / red 72, typed-read 1308 / 430, callee 120 / 40, constant-kind 2382 / 770, init-overload 8 / 1, alias-target 546 / 70; cites #2147 17, #2417 150, #2423 555, #2432 661. `ClrTypeDeclinedMethod`: 78 cells, 42 red. The 8951 pool ran 8951 cells with 2368 red (1167 silent-wrong, 928 ice, 273 false-refusal), allowlist 2368, `CellBudget` 8951. Rule table: 222 rows, 52 rules. `scorecard_metrics.py --check`: OK (outside seed 1955, seed 2368). `pytest build_tools/tests`: 2216 passed, 2 failed, both `test_check_review_line.py::test_real_lines_on_real_history` with "no merge base" (the clone is shallow). -- **The 829 rows of the previous stage-0 commit:** 619 are in the file verbatim. The other 210, all constant-kind, were re-keyed, and each has a successor row with the same class and cite (153 by id prefix, 57 by the label the new id spells differently). The programs were not compared by source. -- **The enumeration and the totality assertions, as read.** A cell's tag and rule come from its one row of `name-resolution-rules.txt`. `Axes_EveryValueIsGeneratedOrExcluded` partitions with no default arm. In the constant-kind set its sources are: the call-site census of `ConstantDefaultClassifier.IsAdmitted` (hosts) and `AdmissionTable`; `ScopeKind` and `TypeKind` for a `const`; the properties of `ModuleOverloads` and the shapes a Stdlib census finds under them; the subclasses of `ClrMemberResolution`, three of them refined by what reflection finds; `EnumMemberAccessKind`; `BindingKind`; the pool's `Form`, `Spelling` and `DeclaringRelation`; `ImportBindingForm`, `ImportKind` and the star flag. Per host it asks for a cell or a reason for every (kind, spelling, placement) that `OwnSpellings` derives from the typed-read set's readers, and for every referenced member under every spelling. A bare sibling needs both orders, with and without a module binding. 26 probes run in process and one in a child process. -- **Mutations re-run, each ALONE, from a `cp` copy, restored by copy, confirmed by `cmp`, then touched** (the seven facts that run no cell and the pool's `RuleTable_` fact, unless said): - - totality: the constant-position N2 row deleted from the table → `RuleTable_EveryCaseHasOneRow_…` red, "matches no row" for its cells, and `Ratchet_` red (2 failed, 6 passed); - - a passing case listed known-red (`read/constant-kind/ParameterDefault/def/OwnMember/ClassLiteralConst/Annotated/Alias Ice # #2432 ice`) → `ScopeMeaning_Sweep` red, "listed as Ice, now Match: STALE, delete the row" (1 failure; the sweep alone, 5.4 min); - - one member loses one spelling (`math.pi`, from-import; the control that stayed green in pass 3) → `Axes_` red, "no cell reads StdlibModuleVariable math.pi under from-import" (1 failed, 7 passed); - - own reads not generated under `Alias` → `Axes_` red, "own spelling: Alias is neither generated nor excluded" and the per-host lines (1 failed); - - the N2 cite rule removed from `ProposedCite`, on the committed text → `Ratchet_` red (1 failed); - - the crash probe handed a program that compiles → `Exclusions_RestingOnACompilerCrash_…` red (1 failed); - - a probe of this pass, never committed: `Decimal.one` listed under `ClrTypeLiteralField` → `Axes_` red, "the checker's resolver answers Field/static for Decimal.one" (finding 1); - - not re-run: the other 25 of the 31 mutations in 0fe74e4c1's body; - - all restored → the 346 / 0 / 0 run above; `git status --short` empty. - -### Adequacy -- **Contract:** named — one answer per name for every binding kind, order, spelling and reading position; a refusal under one code where python's reading differs; a constant position refuses a non-constant itself. -- **Axes:** open: constant-kind × host ← the declarations that hold a constant slot, which the classifier's own call sites are not: the AST records that declare `Parameters` (`FunctionDef`, `LambdaExpression`, `DelegateDef`, `PropertyDef`, `EventDef`) and `Decorators` (ten records), with a `def`'s place refined by `ScopeKind` × `TypeKind` × body-or-signature, as `ConstSites` already refines a `const`'s (finding 2). Open: constant-kind × a referenced type's field ← what C# reads as a constant from metadata, which is `FieldInfo.IsLiteral` or a `DecimalConstantAttribute` (finding 1). Closed, each with its assertion and that assertion's mutation: the member's spelling and placement, a referenced module's member collections, the program's own enum and names, the tables, and the axes of the other five sets. The 8951 pool's rosters are P77a's and were not re-graded. -- **Cure:** seam + sweep — silent wrong behaviour, a position missing a shared check, SPY0908 as a net. -- **Harness:** named + allowlist delta (2368 seed rows; 1383 rows of the new type). -- **Layer:** every decision rung-justified. D8's one rung-3 arm has no lower rung (a referenced assembly's constant has no Sharpy source, dunder or protocol spelling); finding 1 is about which CLR fact that arm reads, not its rung. No rule reads a builtin or type name. - -### Scope & convergence -- **Group:** one (P78; chores none; #2432 in by R-KV) · **Alone:** no — required? no · **Gates:** 1 -- **Generator:** existing `NameResolutionDifferentialTests` + stage 0 @ 0fe74e4c1, mutations re-run. Hand controls named: the project route (A3, A14; A14's programs re-measured, below), steer text and count per position × host. -- **Trackers named:** #2427, #2457, #2486, #2397, #2417, #2069, #2147, #2249, #2383, #2768, #2769 · **Fidelity rows:** named. -- **Convergence (contract §12):** the previous pass was NEEDS REVISION on Dimension 6 (the log's 3rd-pass line), so the rule was applied. Finding 1 changes a `## Design Decisions` predicate, or needs a ruling for a `worked` → refused change: not deferrable. Finding 2 is values missing from a hand-listed axis, with no catcher, and its cure adds text to D8: not deferrable. NEEDS REVISION stands. Finding 4 is deferrable; findings 3 and 5 are warnings. - -### Findings -Each carries its label against the previous pass (620dfff80). Programs are `sharpyc run` @ 73c785856 (product code e24aaf9f0), each beside a control. - -1. **D8 refuses a constant that runs today: a `decimal` constant of a referenced type** (Dimension 4, a design row on D8, with Dimension 6 on the type-member axis; **re-opened**: the log's 2nd-pass line answers pass 2's finding 1 with "D8 per bound name", and ruling 7 admitted "a literal field"; not deferrable). D8 answers true for a type's field "by `FieldInfo.IsLiteral`" and false for "a CLR static that is no literal". C# compiles `const decimal` to a `static readonly` field carrying `DecimalConstantAttribute`, which is no literal in metadata, and reads it back as a constant. So today: - - `def f(p: decimal = decimal.one) -> decimal` prints `1`; `from system import Decimal` / `= Decimal.one` prints `1`; `= Decimal.max_value` prints `79228162514264337593543950335`; through `type A = Decimal`, `= A.minus_one` prints `-1`; - - the same default runs at a lambda (`1`), a `@dataclass` field (`1`), a struct field (`1`) and a struct auto-property (`1`); - - the checker binds the read: `b: bool = decimal.one` is SPY0220 "Cannot assign type 'decimal'"; - - at an attribute argument it is CS0182 behind SPY0908 (C# takes no `decimal` attribute argument), so the kind is a constant at the default hosts and none at an attribute. - - Under D8 as written the four defaults become SPY0401: `worked` → refused with no ruling (contract §3), against D8's own predicate "no constant admitted today is refused" and the Adversarial Review's "D8 refuses nothing that runs". Nothing notices. The generator refines a field by `IsLiteral` alone (`ClrTypeMemberShape`), the `Field/static` kind has one hand-chosen member (`BitConverter.is_little_endian`, CS1736 today), and its row says must-refuse; with `Decimal.one` listed under the literal kind, `Axes_` answers "the checker's resolver answers Field/static for Decimal.one". No fixture, spec block or `.spy` file gives a parameter or field a `decimal` constant as its default (grep over `src` and `docs`: 0 hits), so A8's record and the gate stay green. Neither the Stdlib nor Core declares a `const decimal`, so a module's `IsConst` (also `field.IsLiteral`, `OverloadIndexBuilder.cs`) has no member of the shape today. -2. **A constant position's hosts are the classifier's own call sites, one hand-written program each; three kinds of host outside them are red** (Dimension 6, with a design row on D8; **re-opened** for the host axis: the log's 2nd-pass line says "reader census", and ruling 8 pinned hosts to it; **new** for the attribute target, which is the revision's own item 16; not deferrable). The census finds where the validator already asks. A position nobody asks about has no call to find, and a reader with two kinds of host has one program. - - **A delegate's parameter default has no reader.** `delegate D(x: int = H.x) -> int` with `x` a `@static` field is CS1736 behind SPY0908. So are `= math.pi`, `= five()`, `= [1]` and a string enum's member; `= y` with `y` a module variable, and a bare sibling in a class's own delegate, are CS0103. Controls: `= 5` and `= H.X` with `X` a `const` run (`6`). No validator method visits a `DelegateDef`; the emitter writes the default through `GenerateParameter` (`RoslynEmitter.TypeDeclarations.cs`, one of five `GenerateParameterDefault` call sites). The test's remark "the one constant position no classifier call judges: an enum member's value" is refuted. - - **An interface's signature-only method is not checked.** `interface I:` / `def m(self, p: int = H.x) -> int: ...` is CS1736; so are `= math.pi`, `= sys.maxsize` and a string enum's member. `p: bool = H.x` there is CS1736 and not SPY0220, and `= H.nosuch` is CS0117: the checker never visits this default. The other way, a bare sibling `const X` as that default is SPY0401, where a class's method runs it. The same method with a body, and an `@abstract` method of a class, are SPY0401 for `H.x`. D8 answers "per name the checker bound", and nothing is bound here, so the shape rule keeps admitting `H.x`. A10 holds the diagnostic count of one bare read and no verdict. - - **Attribute targets (item 16).** The cells attribute a method of a class. With `G.y` a `@static` field as the argument: a class, struct, interface, union, nested class, field, `@static` field, property, event, module `def` and `@static` method are CS0182 like the generated host. An enum, an interface's method and a local `def` run and print `1`: the emitter drops the attribute there (read from `emit csharp`: `[Mark(W = 5)]` is on the class and on none of the three). A union's attribute is not validated at all: `ConstantPositionValidator` visits eight of the ten AST records that declare `Decorators`, not `UnionDef` or `DecoratedStatement`. D8's sentence gives each target its scope (a class's attribute stands at module level, a member's in its type's body, a local `def`'s in its function), and only one of those scopes has a cell. - - The design rows: D8 does not say that a delegate's default is judged, that the checker checks a signature-only method's defaults, or which declarations' attributes it checks. An implementation that follows D8 to the letter leaves every program above as it is, and every S0b cell green. -3. **Ruling 6 says the plan lists #2487's remainder, and the revision cut the list** (Dimension 1, an owner ruling; **new**; a warning). Comment 7039834146 item 6: "The plan lists the remainder (rows written from the rules, the generator reading its verdict from the table, every rule id in `name-resolution.md`)". The Class trackers line now reads "#2487 stays open (owner)", and the Context clause that named the drift guard is gone too. The list is still in the comment the plan cites, so an implementer loses nothing they cannot find. Restoring it costs about 150 bytes the cap does not have; a pointer ("ruling 6") costs 3. Not corrected inline: which text gives way is the author's. Nothing else the revision cut is needed by an implementer (each cut clause is carried by A12, D9, T8, a mutation's anchor or a symbol name grep finds). -4. **The builtin-name spelling is on one kind** (Dimension 6; **new**; deferrable). `BuiltinName` is set on `Int32` alone, so only the literal kind is read as `int.max_value`; the axes fact asks for one such cell in the whole set. `def f(p: str = str.empty)` is CS1736 like its `String.empty` twin, so no verdict differs today. -5. **A lambda's default in a class-level initializer** (Dimension 4, D4; **new**; a warning). `class H:` / `const x: int = 5` / `@static` / `g: auto = lambda p: int = x: p` is SPY0200 with the method-body steer today. CPython 3.15.2 prints `5` for the twin (`g = staticmethod(lambda p=x: p)`): a default is evaluated in the class's scope, and a `def`'s default in the same class reads the member. D4 names "a lambda in an initializer" and does not say on which side its parameter default falls; A6's control holds the lambda's phrase and no default. - -Against the previous pass's four findings: 1 (the spelling of a constant position's read) is answered: the alias, bare-sibling and N2 cells exist and are red as measured then (CS0103, SPY0425, a silent `1`), with their mutations above. 2 (a module's functions) is answered by the `ModuleFunction` and `ModuleFunctionGroup` cells. 3 (two exclusions with no probe) is answered, and the declined method it uncovered is generated (item 15, below). 4 (the project route) is answered by A14, re-measured: with `consts.spy` beside `main.spy` under `sharpyc project`, an imported literal `const` and an imported class's `const` at a parameter default print `5 9` under all five importer forms; an imported computed `const` is SPY0401 under the three from-import forms and CS1736 behind SPY0908 through `consts.Q` and `c0.Q`. - -**settled** (an owner ruling decides it; not raised): a string enum's member, its `.value` and any `.name` are SPY0401 (ruling 10); `math.pi` as a default is SPY0401 and #2432 closes on that (ruling 4); the struct auto-property host must run (ruling 8); a literal field of a referenced type is admitted (ruling 7); a used self-reaching alias is out of P78 and D10's module-level judgement is deferred (ruling 9); #2487 stays open (ruling 6); spelling and placement are an axis derived as the typed-read set derives them, which has two placements (ruling 12); a module's functions, the two probes and the project control ride the revision (ruling 13). **declined:** none in the log. **churn:** none; no cure above undoes an answer a revision gave. - -### The two defaults of comment 7048618066 (not owner rulings) -- **Item 15, the declined method as its own kind: sound; it needs no word beyond ruling 12's baseline raise.** Re-measured: `Char.is_ascii_digit` read uncalled into an `object` slot runs in a function body (`True`) and at a `const` (`True`), and is CS1736 at a parameter default and CS0182 at an attribute argument. The checker types it `object` (`b: bool = …` is SPY0220), so it is a bound name D8 answers false for, and each cell turns an ICE into a diagnostic; nothing that runs is refused. Excluding it would leave the ICEs with no cell. Whether D8's member hook sees a read the bridge declined is not shown; the 42 rows are the catcher (A9 fails while they stand). `Array.resize` uncalled is CS8917 in a function body and at a `const`, as its exclusion says. -- **Item 16, one attribute target: not sound as a default.** It is the third part of finding 2: three targets drop the attribute, one is never validated, and each target stands in its own scope. It needs the axis closed or the owner's word. - -### The hand lists the revision names -- one host program per reader call site: an open axis (finding 2). -- attribute target: an open axis (finding 2, item 16). -- one or two members per kind: reasonable where the kind's fact decides the verdict, and each member is checked against discovery or the resolver. Refuted for `Field/static`, whose fact is not the one C# reads (finding 1). -- one int-valued declaration per own kind: can be left. The verdict reads the binding kind and the `const` fact, never the declared type; a `float` const at a lambda default (`1.5`), an enum-typed const at a `def` default (`5`) and a `str` const at an attribute argument (`1`) run. -- one outer binding per sibling form: can be left. D3 reads whether an outer binding holds the name, and the 8951 pool carries the outer kinds at its three constant-only positions. -- the builtin-name spelling (`int` only): a small open roster with its catcher (finding 4). -- the subclass receiver from outside only: can be left; the pool has the `Base` relation at its constant-only positions. -- placements Enclosing and Sibling closed by decision: consistent with ruling 12 as worded. -- the census's namespace (`System`): can be left; it is a reflection census with its own control, and the shape it holds at 0 needs a static whose type has no Sharpy spelling. -- a type that fails to load: can be left; no program names one. - -### Decisions that are the owner's (this pass asked nothing and offers no further pass) -1. **Finding 1.** (a) D8's rung-3 fact becomes what C# reads as a constant from metadata (`FieldInfo.IsLiteral`, or a `DecimalConstantAttribute`), not admitted at an attribute argument; one stage-0 commit adds the shape with `Decimal.one` (must-run at the default hosts, must-refuse at an attribute), and M9 gains "answer false for a decimal constant → `decimal.one` SPY0401". (b) The owner rules a `decimal` constant refused as a default: the Adversarial Review's by-direction list gains it, and the same cells are must-refuse. Recommended: (a); it is ruling 7's own answer for one more constant, and C# admits it. -2. **Finding 2.** (a) One stage-0 commit and a revision: the host axis is the image of the AST records that declare `Parameters` and `Decorators`, a `def`'s place refined as a `const`'s is; D8 says a delegate's default is judged, and that the checker checks a signature-only method's defaults and every declaration's attribute arguments; `allowlist_rows_outside_seed` rises by the measured red count, which needs the owner's word. (b) The owner rules the hosts closed as generated: the delegate, interface-signature and attribute-target programs go to #2432 as cells, D8's predicate is narrowed to the hosts named, and #2432 does not close on A9 and A14 alone. (c) A middle: D8 gains the three sentences and A9 a named hand control per host, with no stage-0 commit. Recommended: (a). Passes 2, 3 and 4 each found a host the census could not see. -3. **What follows the revision.** The cap and both extra passes are spent. A fifth pass runs only on the owner's own words; without one, `/implement-plan` needs the owner's `override:`. The four passes found seven open axes, then two, then one axis and one roster source, then one axis and one CLR fact. No pass refuted D1 to D7, D9 or D10. - -### Falsifiability -- A1 / M1, A2 / M2 (three), A3 / M3, A4 / M4 (and the census pin), A5 / M5 (four), A6 / M6 (two), A7 / M7 (with its control), A9 / M9 (eight), A10 / M10, A13 / M13 (three), A14 / M14: mutation named; exemption not subject; positive control yes; by-direction specified (A8). -- M9's and M14's anchors, read from this pass's run: a default through `math.pi` and through `math.sqrt`, and a struct auto-property's through `G.x`, are CS1736; an alias at an attribute argument is CS0103; a bare sibling `const` there is SPY0425; bare imported `PIPE` as a default is SPY0401; an imported computed `const` through `m.Q` is CS1736. -- D8 for a `decimal` constant: mutation MISSING — expected: answer false for it → `def f(p: decimal = decimal.one)` SPY0401; restored → `1` (finding 1). -- D8 at a delegate's default, a signature-only method's default and an attribute on another target: no cell and no hand control, so no mutation can be named (finding 2). -- M13's third mutation ends the test host with a stack overflow: its red is a dead process, not a failed assertion. -- A8 (the direction record) reads fixtures, spec blocks and `.spy` modules; a program none of them holds is outside it (finding 1's is one). -- A11: each example discriminates. A12: an absence assertion whose positive control is the staleness gates. -- Stage 0's facts and sweeps: mutations re-run above, each alone. - -### Deferred findings -- (not CONVERGED; the deferrable findings in the form a CONVERGED stamp would list them, and the owner's deferred row carried from the log) -- constant-kind × the builtin-name spelling ← the referenced types that have a builtin name — fix: `BuiltinName` on a `Decimal` and a `String` member, and `Owed` asks the spelling of every member that has one — proved by `Axes_EveryValueIsGeneratedOrExcluded` ("no cell reads … under builtin-name") and `ScopeMeaning_Sweep`. -- `EnumMemberHost`'s remark ← the emitter's five `GenerateParameterDefault` call sites — fix: the text, once finding 2 is decided — proved by the host axis's own assertion. -- D10's module-level judgement ← the pipeline order — fix: judge the target once every type and import is declared — proved by the `dotted` and `Later` must-run cells (owner, ruling 9). - -### Warnings -- Findings 3 and 5. -- The plan names no local fallback for the gate, no control run at the base for a red, and no verify cost or prober budget (CLAUDE.md carries the first two; Dimension 9's filing budget). -- A1's, A4's, A5's and A6's "which decision drains which rule", and each row's cite, are the author's reading; the ratchet's STALE and cite arms are the catcher. -- Cells outside this plan's contract, for the lead's ledger (the pass filed nothing): a bracket attribute on an enum, an interface's method or a local `def` is accepted and dropped (silent-wrong · program; no open tracker found; the spec's target list names methods and not enums). `case math.pi:` is #2771's, already open. - -### Missing Steps Added -- None added to the body (the cap). For the revision: D8's fact for a referenced constant, and its sentences on a delegate's default, a signature-only method's defaults and the attribute targets; the host axis in a stage-0 commit; ruling 6's list or its pointer. - -### Unchecked Claims -- That D8 as written drains all 661 #2432 rows, the alias-at-attribute CS0103 cells and the 42 declined-method rows among them: read against the rule table, not prototyped. The rows are the catcher. -- The 16 earlier-order cells of a static member under a same-named module `const` citing #2432 (re-counted: 16, all ICE): the cite is the author's inference; the ratchet's cite arm reports it. -- That A14's SPY0401 for `m.Q` follows from D8's text: today's CS1736 is measured, the cure is not. -- That the alias-enum and lambda-annotation defects are no constant position's verdict: their probes hold (both facts green); their classes were not traced. -- D2's pre-pass and first-read check drain the typed-read rows that cite #2423; D5's one resolver carries all 33 sites (the count is re-measured, 33 in nine files); D1's cold and warm export identity: designs with no prototype. -- "No snapshot moves" (A12): the regeneration after T1 and T4 proves or refutes it. -- A11's 22 declarations in five spec files: not re-counted. The 4,565 `.spy` files: re-counted, 4,565. -- Not run: a control at the base sha (product code at this tip is the base's); `check_spec_blocks.sh` (no spec or product path moved); the hand controls' own mutations; a whole-solution gate, locally or on CI, at this tip. +- @ a7fbd945d — revised after the 1st pass (NEEDS REVISION, Dimension 6): S0b's seven axes; D2. +- @ 656991807 — revised after the 2nd pass (NEEDS REVISION, Dimension 6): member kinds, the reader census; D8 per bound name. Deferred (owner): D10's module-level judgement ← the pipeline order — fix: judge the target once every type and import is declared — proved by the `dotted` and `Later` must-run cells. +- @ 56dbb009f — revised after the 3rd pass (NEEDS REVISION, Dimension 6): stage 0: spelling and placement, module functions, probes; D8's attribute scope; A14. +- @ 73c785856 — revised after the 4th pass (NEEDS REVISION, Dimension 4 and 6): stage 0 with D8's decimal constant and D4's lambda default; builtin names; ruling 6 (findings 1, 3–5). Finding 2 left the plan by the owner's decision (#2423 comment 7050154806): #2779. From abec1a341bffe607c2f55af42d83686e80889da4 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Nov 2026 00:20:05 +0000 Subject: [PATCH 20/22] test(conformance): P78 stage 0: fixes after the independent review The fix round for the independent review of PR #2767's test code @ 5e2156981, under the owner's rulings 26, 28 and 29 (#2423 comment 7052893050). Item 26: "Repair the two checks so they can fail (with mutation records), require every must-refuse cell to name a code, correct each false exclusion reason to what is true with a probe, and post the hidden red programs as cells on their trackers. No new generated cells and no baseline raise". No cell is added: the pool is 4963 cases before and after. Checks that could not fail - F2. The typed-read derivation asked for a Spelling before it asked where the reader stands, so UnplacedTypedReaders was always empty. Measured on the old code: 137 must-run reads of the 8951 pool from a third type (Base 92, Other 30, Enclosing 15) and 6 through `G[int].x` were dropped unseen. Relation is now asked first; each placement and the generic receiver is counted, excluded with its reason and probed, and both directions are held (a placement with no reason; a reason the pool no longer reads from). - F7. A host was a string part, and "struct" is also a declared type's label, so the host axis was held by the label. Removing the 121 cells whose fifth key part is `struct` left AxisProblems at 0 on the old code. The host is now a typed part (DeclarationHost), the declared type its own Carried check, and the product kind x host x type is checked. - F6. A must-refuse cell that names no code is a totality failure. The 72 red R-QI cells name SPY0620, the plan's code (D7, D9). Exclusion reasons (each corrected to what `sharpyc run` does, each with probes; the excluded values are not generated, by item 26) - F1. Callee binders: `case x:`, `case _ as x:` and `out let x` bind a function value that prints 1 when called, and SPY0908 CS1955 under a module `x: int = 12` (#2423's class). `except E as x` with `__call__` prints 1 either way. - F8. Interface host: a `@static` value member is SPY0908 CS0120 with and without its initializer, an instance field's read through the interface is SPY0203 (#2383's class), and an instance `property x: T` runs and prints 5. - F10. The lambda host's two reasons are true of the `lambda` spelling alone. The arrow spelling takes a function-typed and a dotted annotation: `(p: () -> int = five) -> p` is SPY0401, `(p: (float) -> float = math.sqrt) -> p` is SPY0908 CS1736 (#2432's class), the dotted enum default runs. - F2's placements: a typed read from a subclass, an unrelated type and through `G[int].x` is SPY0220 above the member's type and SPY0908 CS1503 below it (#2423, D2's class); from a nested type an annotated member is SPY0220 and an inferred one CS1503 at both orders (#2417's). Rulings 28 and 29 - F4 (item 28). The string-enum default cells stay must-refuse SPY0401; the row's comment cites ruling 10, item 28 and #2772 and says it is an interim against function_default_parameters.md. The spec is unchanged. - F5 (item 29: "You rule that a function target type selects a CLR overload. The 42 cells become must-run, red today citing #2277, and the baseline rises by 42."). The 42 cells are `const K: (int) -> int` and a struct's `property p: (int) -> int` reading `Math.abs`; each was checked to have that shape. The 18 default cells (def, dataclass, struct) stay must-refuse and green under SPY0401's row; the 12 attribute-argument cells keep `kind:SPY0336` (no function type at the slot). allowlist_rows_outside_seed 2142 -> 2184 (+42, measured), set with `scorecard_metrics.py --set-baseline`. - F3 was declined by the planning session: the rows only gain a note that SPY0619 is the code P78 introduces. Lower findings - The escaped-name exclusion cited #1325 (closed). The reason no longer cites it and has a probe (escaped and plain missing target: SPY0202). - An exclusion whose reason names a diagnostic code or an issue must have a probe (the reverse of the orphan check). None is exempt. - The sweep requires the pinned oracle's minor (3.15), as the other differentials do. - Not done: the attribute hosts' constant `1`, the child compile's `dotnet` from PATH, the single-shape probes of three parse refusals (true today), the 8951 pool's own findings (P77a's ratchets), and check_allowlist_severity.py / gap-discovery-contracts.md (outside this round's files). Counts @ this commit (measured): pool 4963 (2384 must-run, 2579 must-refuse); known-red 1612 = 637 / 766 / 150 / 17 / 42 citing #2423 / #2432 / #2417 / #2147 / #2277; 39 exclusion reasons probed in process (59 programs) and one in a child process. Mutation records (each alone: break -> red, restore -> green; the 8 facts that run no sweep, 8/8 green on the restored tree) - F2a remove the Base exclusion -> Axes_ red: "Base is neither generated nor excluded, and the 8951 pool spells 92 must-run reads from it" and 10 unplaced reads. The old code had no exclusion and was green. - F2b the derivation skips relation Other -> Axes_ red: "Other is excluded as a placement the 8951 pool reads from, and that pool spells no must-run read from it". - F2c remove the GenericReceiver exclusion -> Axes_ red: 6 reads, "the label 'GenericReceiver' is neither generated nor excluded". - F7a the reviewer's mutation (drop the 121 cells) -> Axes_ red, 49 lines: "no-initializer: no cell carries struct", then each kind x type in a struct. Old code: 0 problems (control run). - F7b struct-host cells only -> red (49 lines). F7c declared-type-struct cells only -> red (9 lines). F7d one kind x host x type triple -> red: "no cell declares StaticProperty of type tuple in a struct". - F6 the R-QI cells name no code -> RuleTable_ red: each cell, "its row says must-refuse under R-QI, and the generator names no code its refusal may carry". - F1a binder probe without the module binding -> Exclusions_ red x3 (expected SPY0908 CS1955, runs and prints 1). F1b `one` returns 2 -> red x3 (control prints 2). F1c `__call__` returns 2 -> red x2. - F8a member read through the class -> red x2 (SPY0203 expected, CS0535). F8b a class for the interface -> red (prints 5). F8c the property implemented with 6 -> red. - F10a/F10b arrow defaults made constants -> red (CS1736 / SPY0401 expected, prints 1). F10c the dotted type under `lambda` -> red (SPY0103). F10d the `lambda` slot given a plain type -> red. - F2d/F2e third-placement orders swapped -> red x3 each (SPY0220 <-> CS1503). F2f the nested reader's slot made `int` -> red x4. - L1 the escaped alias left unused -> red (prints 1). L2 delete the probe of an exclusion that names a code -> Axes_ red: "names a diagnostic code or an issue ... and no probe holds it". - F5a the cite rule keyed on another code -> Ratchet_ red. F5b the group off the N4 row -> RuleTable_ red ("matches no row"). F5c the SPY0336 row without its admission -> RuleTable_ red ("matches rows L248, L250") and Ratchet_ red. - Sweep: with the rules of this commit and the allowlist of 5e2156981, ScopeMeaning_Sweep is red with 42 failures, the 42 #2277 rows; with the rows, green. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01LGMKZVcFYGqQRfHgd16DLa --- build_tools/scorecard-baseline.json | 2 +- .../ScopeMeaningDifferentialTests.Axes.cs | 295 +++++++++++++++--- .../ScopeMeaningDifferentialTests.cs | 49 ++- .../Conformance/name-resolution-rules.txt | 26 +- .../scope-meaning-differential-allowlist.txt | 46 ++- 5 files changed, 360 insertions(+), 58 deletions(-) diff --git a/build_tools/scorecard-baseline.json b/build_tools/scorecard-baseline.json index 77f6cb001..7a232a157 100644 --- a/build_tools/scorecard-baseline.json +++ b/build_tools/scorecard-baseline.json @@ -1,6 +1,6 @@ { "procedure_bytes": 145560, "claude_md_bytes": 9304, - "allowlist_rows_outside_seed": 2142, + "allowlist_rows_outside_seed": 2184, "allowlist_rows_seed": 2368 } diff --git a/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Axes.cs b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Axes.cs index 96703db65..39e7f1799 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Axes.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.Axes.cs @@ -1,4 +1,5 @@ using System.Reflection; +using System.Text.RegularExpressions; using Sharpy.Compiler.Discovery; using Sharpy.Compiler.Discovery.Caching; using Sharpy.Compiler.Semantic; @@ -49,34 +50,73 @@ public sealed partial class ScopeMeaningDifferentialTests // ------------------------------------------------------------------------------------------- // /// A program and what the compiler does with it today. An exclusion whose reason is one of these keys is true - /// only while the probe holds: when the behaviour changes the probe is red, and the value is generated or re-reasoned. - internal sealed record BehaviourProbe(string Source, string Expected, Func Holds, bool Stdlib = false); + /// only while the probe holds: when the behaviour changes the probe is red, and the value is generated or re-reasoned. + /// A reason that says more than one thing of the compiler names the others in , each held the same way. + internal sealed record BehaviourProbe(string Source, string Expected, Func Holds, bool Stdlib = false, BehaviourProbe[]? Also = null) + { + /// This probe and every other program its reason rests on. + public IEnumerable All => (Also ?? Array.Empty()).Prepend(this); + } private static bool Refused(Harness.SharpyRun run, string code, string? cs = null) => run.ErrorCodes.Contains(code) && (cs == null || run.CsCode == cs); + /// The program compiled, ran and printed . + private static bool Printed(Harness.SharpyRun run, string stdout) + => run is { Success: true, ExitCode: 0, TimedOut: false } && run.ErrorCodes.Count == 0 && Harness.Normalize(run.Stdout) == stdout; + + private static BehaviourProbe Prints(string source, string stdout, BehaviourProbe[]? Also = null) => new(source, $"a run that prints '{stdout}'", r => Printed(r, stdout), Also: Also); + + /// What the review of PR #2767's test code found excluded under a false reason, and the owner then ruled on (#2423 + /// comment 7052893050, item 26): the reason is corrected and probed, and no cell is generated. + private const string ByItem26 = "not generated, by the owner's decision (#2423 comment 7052893050, item 26: the fix round after the independent review adds no cell)"; + private const string TailMain = "def main() -> None:\n print(1)\n"; private const string ModuleLetRefused = "a module `let` is refused at every order (SPY0340, P21b)"; - private const string MatchSubjectIsNoValue = "`match one:` / `case x:` over a function value is SPY0908 CS8119 with no outer binding of the name: no callee verdict to compare"; - private const string InterfaceStaticIsNoStatic = "an interface's `@static` value member is SPY0908 CS0120 WITH its initializer (#2383's class): the host has no running control"; + private const string InAnInterfaceEachKindIsOut = "in an interface each declaration kind is out for its own reason. A `@static` value member is SPY0908 CS0120 with its initializer and without (#2383's class), so it has no running control there. An instance field declares no member a read finds: `h.x` through the interface is SPY0203 with its initializer and without (#2383's class too). An instance `property x: T` is a signature an implementing class fills, and it runs (`class C(H): property x: int = 5` prints `5`): that control, of a kind R-QI leaves alone, is " + ByItem26 + ", and no tracker holds it, since it is green"; private const string EnumBodyHoldsCases = "an enum body holds `NAME = value` cases and nothing else (SPY0101 / SPY0103)"; private const string UnionBodyHoldsCases = "a union body holds cases and methods and nothing else (SPY0104)"; internal static readonly IReadOnlyDictionary BehaviourProbes = new Dictionary(StringComparer.Ordinal) { [ModuleLetRefused] = new("let x = 5\n" + TailMain, "SPY0340", r => Refused(r, "SPY0340")), - [MatchSubjectIsNoValue] = new("def one() -> int:\n return 1\ndef main() -> None:\n match one:\n case x:\n print(x())\n", - "SPY0908 CS8119", r => Refused(r, "SPY0908", "CS8119")), - [InterfaceStaticIsNoStatic] = new("interface H:\n @static\n x: int = 5\ndef main() -> None:\n print(H.x)\n", "SPY0908 CS0120", r => Refused(r, "SPY0908", "CS0120")), + [InAnInterfaceEachKindIsOut] = new("interface H:\n @static\n x: int = 5\ndef main() -> None:\n print(H.x)\n", "SPY0908 CS0120", r => Refused(r, "SPY0908", "CS0120"), Also: new BehaviourProbe[] + { + new("interface H:\n @static\n x: int\n def m(self) -> int: ...\ndef main() -> None:\n print(H.x)\n", "SPY0908 CS0120", r => Refused(r, "SPY0908", "CS0120")), + new("interface H:\n @static\n property x: int = 5\n def m(self) -> int: ...\ndef main() -> None:\n print(H.x)\n", "SPY0908 CS0120", r => Refused(r, "SPY0908", "CS0120")), + new("interface H:\n @static\n property x: int\n def m(self) -> int: ...\ndef main() -> None:\n print(H.x)\n", "SPY0908 CS0120", r => Refused(r, "SPY0908", "CS0120")), + new(InterfaceMember("x: int = 5", "x: int = 5"), "SPY0203", r => Refused(r, "SPY0203")), + new(InterfaceMember("x: int", "x: int = 5"), "SPY0203", r => Refused(r, "SPY0203")), + Prints(InterfaceMember("property x: int", "property x: int = 5"), "5"), + }), + [ACalleeBinderIsOut(LocalTarget.MatchCapture)] = CalleeBinderProbe("f: () -> int = one\n match f:\n case x:\n print(x())"), + [ACalleeBinderIsOut(LocalTarget.AsPatternCapture)] = CalleeBinderProbe("f: () -> int = one\n match f:\n case _ as x:\n print(x())"), + [ACalleeBinderIsOut(LocalTarget.OutLet)] = CalleeBinderProbe("give(out let x)\n print(x())", "type F = () -> int\ndef give(f: out F) -> None:\n f = one\n"), + [AnExceptionIsCalled] = Prints("x: int = 12\n" + CallableException, "1", Also: new[] { Prints(CallableException, "1") }), + [AThirdPlacement(DeclaringRelation.Base)] = ThirdPlacementProbe("class B:\n @static\n x: int = 5\n", "class H(B):\n @static\n r: int = nb(B.x)\n"), + [AThirdPlacement(DeclaringRelation.Other)] = ThirdPlacementProbe("class B:\n @static\n x: int = 5\n", "class H:\n @static\n r: int = nb(B.x)\n"), + [AGenericReceiver] = ThirdPlacementProbe("class G[T]:\n @static\n x: int = 5\n", "def r() -> int:\n return nb(G[int].x)\n"), + [AThirdPlacement(DeclaringRelation.Enclosing)] = new(NestedReader(memberAbove: false, "x: int = 5"), "SPY0220", r => Refused(r, "SPY0220"), Also: new BehaviourProbe[] + { + new(NestedReader(memberAbove: true, "x: int = 5"), "SPY0220", r => Refused(r, "SPY0220")), + new(NestedReader(memberAbove: false, "x: auto = 5"), "SPY0908 CS1503", r => Refused(r, "SPY0908", "CS1503")), + new(NestedReader(memberAbove: true, "x: auto = 5"), "SPY0908 CS1503", r => Refused(r, "SPY0908", "CS1503")), + }), [EnumBodyHoldsCases] = new("enum H:\n type K0 = int\n RED = 1\n" + TailMain, "SPY0103", r => Refused(r, "SPY0103") || Refused(r, "SPY0101")), [UnionBodyHoldsCases] = new("union H:\n type K0 = int\n case A()\n" + TailMain, "SPY0104", r => Refused(r, "SPY0104")), [NeedsItsValue] = new("const x: int\ndef main() -> None:\n let y: int\n print(1)\n", "SPY0104", r => r.ErrorCodes.Count(c => c == "SPY0104") == 2), [DelegateHasNoBody] = new("delegate D(x: int) -> int:\n type K0 = int\n" + TailMain, "SPY0100", r => Refused(r, "SPY0100")), [EnumBodyHoldsNoConst] = new("enum H:\n const K: int = 1\n RED = 1\n" + TailMain, "SPY0101", r => Refused(r, "SPY0101")), [UnionBodyHoldsNoConst] = new("union H:\n const K: int = 1\n case A()\n" + TailMain, "SPY0104", r => Refused(r, "SPY0104")), - [LambdaTakesNoCallableSlot] = new("def five() -> int:\n return 5\ndef main() -> None:\n f = lambda p: () -> int = five: p\n print(1)\n", "SPY0103", r => Refused(r, "SPY0103")), + [LambdaTakesNoCallableSlot] = new("def five() -> int:\n return 5\ndef main() -> None:\n f = lambda p: () -> int = five: p\n print(1)\n", "SPY0103", r => Refused(r, "SPY0103"), Also: new BehaviourProbe[] + { + new("def five() -> int:\n return 5\ndef main() -> None:\n f = (p: () -> int = five) -> p\n print(1)\n", "SPY0401", r => Refused(r, "SPY0401")), + new("import math\ndef main() -> None:\n f = (p: (float) -> float = math.sqrt) -> p\n print(1)\n", "SPY0908 CS1736", r => Refused(r, "SPY0908", "CS1736"), Stdlib: true), + }), [AnIntEnum] = new("enum H:\n RED = 1.5\n" + TailMain, "SPY0253", r => Refused(r, "SPY0253")), + [AnEscapedNameIsMissingAsItsPlainOne] = new("type K0 = `nosuch`\ndef f(k: K0) -> int:\n return 1\n" + TailMain, "SPY0202", r => Refused(r, "SPY0202"), + Also: new BehaviourProbe[] { new("type K0 = nosuch\ndef f(k: K0) -> int:\n return 1\n" + TailMain, "SPY0202", r => Refused(r, "SPY0202")) }), [NamesAType] = new("class G:\n class x:\n v: int = 5\ndef f(p: int = G.x) -> int:\n return p\n" + TailMain, "SPY0220", r => Refused(r, "SPY0220")), [NoSuchMember] = new("def f(p: int = int.nosuch) -> int:\n return p\n" + TailMain, "SPY0203", r => Refused(r, "SPY0203")), [ACallByShape] = new("def five() -> int:\n return 5\ndef f(p: int = five()) -> int:\n return p\n" + TailMain, "SPY0401", r => Refused(r, "SPY0401")), @@ -86,7 +126,10 @@ private static bool Refused(Harness.SharpyRun run, string code, string? cs = nul [ASiblingCaseIsNoName] = new("enum H:\n RED = 5\n BLUE = RED\ndef main() -> None:\n print(H.BLUE.value)\n", "SPY0200", r => Refused(r, "SPY0200")), [NoSelfAtATypeBody] = new("class H:\n const x: int = 5\n const K: int = self.x\ndef main() -> None:\n print(H.K)\n", "SPY0200", r => Refused(r, "SPY0200")), [AGenericMethodThroughItsType] = new("from system import Array\ndef main() -> None:\n x: object = Array.resize\n print(1)\n", "SPY0908 CS8917", r => Refused(r, "SPY0908", "CS8917")), - [LambdaTakesOneNameForAType] = new("import system\ndef main() -> None:\n f = lambda p: system.DayOfWeek: p\n print(1)\n", "SPY0103", r => Refused(r, "SPY0103")), + [LambdaTakesOneNameForAType] = new("import system\ndef main() -> None:\n f = lambda p: system.DayOfWeek: p\n print(1)\n", "SPY0103", r => Refused(r, "SPY0103"), Also: new[] + { + Prints("import system\ndef main() -> None:\n f = (p: system.DayOfWeek = system.DayOfWeek.Monday) -> p\n print(f())\n", "DayOfWeek.Monday"), + }), [AliasedIntEnumRead(EnumMemberAccessKind.IntValue)] = new(IntEnum + "\ntype A = E0\ndef main() -> None:\n print(A.RED.value)\n", "SPY0908 CS1061", r => Refused(r, "SPY0908", "CS1061")), [AliasedIntEnumRead(EnumMemberAccessKind.IntName)] = new(IntEnum + "\ntype A = E0\ndef main() -> None:\n print(A.RED.name)\n", "SPY0908 CS1061", r => Refused(r, "SPY0908", "CS1061")), [InterfaceStaticIsRefused("field")] = new("interface H:\n @static\n x: int = 5\n def m(self) -> int: ...\ndef main() -> None:\n print(H.x)\n", "SPY0908 CS0120", r => Refused(r, "SPY0908", "CS0120")), @@ -166,22 +209,38 @@ internal sealed record Declared(string Text, bool InType, string Read, string? A [BindingKind.None] = "no binding", }; - /// The hosts of a member declaration, total over TypeKind with : the - /// keyword that opens the host's body. - internal static readonly IReadOnlyDictionary DeclarationHosts = new Dictionary + /// A host of a member declaration as a TYPED part of a cell's key: its kind and the keyword that opens its body, + /// which is how the id spells it. Typed, because the keywords class and struct are also the labels of two + /// declared types (): as text, a cell of either carried both, and the coverage check below could not + /// tell a host from a type (the review of PR #2767, F7). + internal sealed record DeclarationHost(TypeKind Kind, string Keyword) + { + public override string ToString() => Keyword; + } + + /// The hosts of a member declaration, total over TypeKind with . + internal static readonly IReadOnlyDictionary DeclarationHosts = new Dictionary { - [TypeKind.Class] = new[] { "class" }, - [TypeKind.Struct] = new[] { "struct" }, + [TypeKind.Class] = new[] { new DeclarationHost(TypeKind.Class, "class") }, + [TypeKind.Struct] = new[] { new DeclarationHost(TypeKind.Struct, "struct") }, }; + /// The host of a no-initializer cell, or null for a declaration outside every type. + internal static DeclarationHost? HostOf(NameCell cell) => cell.Key!.Parts.OfType().FirstOrDefault(); + internal static readonly IReadOnlyDictionary ExcludedDeclarationHosts = new Dictionary { - [TypeKind.Interface] = InterfaceStaticIsNoStatic, + [TypeKind.Interface] = InAnInterfaceEachKindIsOut, [TypeKind.Enum] = EnumBodyHoldsCases, [TypeKind.Union] = UnionBodyHoldsCases, [TypeKind.Delegate] = DelegateHasNoBody, }; + /// An interface that declares , a class that implements it with + /// , and a read of the member through the interface. + private static string InterfaceMember(string declared, string implemented) + => $"interface H:\n {declared}\n def m(self) -> int: ...\nclass C(H):\n {implemented}\n def m(self) -> int:\n return 1\ndef main() -> None:\n h: H = C()\n print(h.x)\n"; + /// A declared type: its label in a cell's id, its spelling, a value of it, how main shows that value as /// 5 ({0} the read), the declarations it needs, and whether the value is one a constant position admits /// (a literal, an enum member, a collection literal at a field: AdmissionTable.PerInstanceFieldDefault). @@ -297,6 +356,59 @@ internal sealed record Typed(string Annotated, string? Inferred, MemberLevel Lev [ReadPosition.BaseList] = "holds a type's name: no value is read there", }; + /// + /// The reason a reader in a THIRD type has no typed-read cell (the review of PR #2767, F2: 137 must-run reads of the 8951 + /// pool stood in such a type and were dropped unseen, by a filter that asked for a spelling and an order before it asked + /// where the reader stood). The reads run in that pool; whether they are TYPED is what no cell here holds, and each + /// placement's probes are the programs that say what they are today. A switch and no table, as . + /// + private const string TheOrdersClass = ": D2's class, which the generated placements hold red (#2423, which holds the program as a cell)"; + + private static string AThirdPlacement(DeclaringRelation placement) + { + const string BelowIsUntyped = "Handed to a `bool` slot, an annotated member's read is SPY0220 where the member stands above, and SPY0908 CS1503 where "; + (string where, string today) = placement switch + { + DeclaringRelation.Base => ("in a subclass of the member's type (`class H(B)` reads `B.x`, `H.x` or `self.x`)", BelowIsUntyped + "the base stands below its subclass" + TheOrdersClass), + DeclaringRelation.Other => ("in a type unrelated to the member's (`class H` reads `B.x`)", BelowIsUntyped + "the member's type stands below the reader's" + TheOrdersClass), + DeclaringRelation.Enclosing => ("in a type nested in the member's (`class I` in `H` reads `H.x`)", + "Handed to a `bool` slot, an annotated member's read is SPY0220 above and below the nested type, and an inferred one's (`x: auto = 5`) is SPY0908 CS1503 at both, as it is from every generated placement (#2417's class, which the generated rows hold)"), + _ => throw new ArgumentOutOfRangeException(nameof(placement), placement, "the member's own type, or a placement the 8951 pool does not spell"), + }; + return $"the reader stands {where}: the 8951 pool runs the read from there, and this set places the reader of a type's member in that type or outside every type. {today}. The placement is {ByItem26}"; + } + + /// The probe of a read this set has no reader for: the reader above the member's type (untyped today) and below it (typed). + private static BehaviourProbe ThirdPlacementProbe(string member, string reader) + => new($"{Probe}\n{reader}{member}{TailMain}", "SPY0908 CS1503", r => Refused(r, "SPY0908", "CS1503"), + Also: new BehaviourProbe[] { new($"{Probe}\n{member}{reader}{TailMain}", "SPY0220", r => Refused(r, "SPY0220")) }); + + private static string NestedReader(bool memberAbove, string member) + { + string declared = $" @static\n {member}\n"; + const string Nested = " class I:\n @static\n r: int = nb(H.x)\n"; + return $"{Probe}\nclass H:\n{(memberAbove ? declared + Nested : Nested + declared)}{TailMain}"; + } + + /// The placements of a reader against the member's type with no typed-read cell: each one the 8951 pool spells a + /// must-run read from (), and no other. + internal static readonly IReadOnlyDictionary ExcludedTypedPlacements = new Dictionary + { + [DeclaringRelation.Base] = AThirdPlacement(DeclaringRelation.Base), + [DeclaringRelation.Other] = AThirdPlacement(DeclaringRelation.Other), + [DeclaringRelation.Enclosing] = AThirdPlacement(DeclaringRelation.Enclosing), + }; + + private const string AGenericReceiver = "the member is read through its generic type's constructed name (`G[int].x`), which the 8951 pool spells by a label of its own and no `Spelling`; a typed-read kind is declared in a type with no type parameter. Handed to a `bool` slot, an annotated member's read is SPY0220 where the type stands above its reader, and SPY0908 CS1503 where it stands below" + TheOrdersClass + ". The receiver is " + ByItem26; + + /// The reads the 8951 pool spells by a label of its own, with no Spelling, and no typed-read cell: keyed by + /// the label, each one the pool spells a must-run read under (), and no other. Found by + /// re-measuring the review's F2: six reads, dropped by the same filter as the third placements. + internal static readonly IReadOnlyDictionary ExcludedTypedReceivers = new Dictionary(StringComparer.Ordinal) + { + ["GenericReceiver"] = AGenericReceiver, + }; + /// A reader of a kind: under which spelling, from which position and nesting, and whether it sits INSIDE the member's own type. internal sealed record TypedReader(BindingKind Kind, Harness.Spelling Spelling, ReadPosition Position, Harness.Nesting Nesting, bool Inside); @@ -319,26 +431,49 @@ internal sealed record TypedReader(BindingKind Kind, Harness.Spelling Spelling, /// when that pool spells a read of it that must run, declared before its reader, with no outer binding, in a class or at /// module level (its sub-generators' routes are that pool's own axes). So the two axes are the images of Spelling and /// under the pool's own rosters, and a position, nesting or spelling the pool gains for a kind is a - /// typed-read cell with no edit here. The pool places such a reader in the member's own type or outside every type; a third - /// placement has no host here and is , which the axes fact holds empty. One reader the pool - /// does not spell is added: an instance member read through its type's name is read off a constructed instance + /// typed-read cell with no edit here. A reader stands in the member's own type or outside every type. The pool also reads from + /// a third type (a subclass, an unrelated type, a nested one), under labels of its own that carry no Spelling and no + /// order, so WHERE the reader stands is asked first: such a read is counted per placement + /// (), each placement is excluded with its reason (), + /// and a read from a placement with none is , which the axes fact holds empty. A read from + /// the two placements this set has that carries no Spelling is held the same way, by its label + /// (). One reader + /// the pool does not spell is added: an instance member read through its type's name is read off a constructed instance /// (H().x, A().x), from wherever the pool reads a @static field through that name from outside its type. /// - private static readonly Lazy<(IReadOnlyList Readers, IReadOnlyList Unplaced)> DerivedTypedReaders = new(() => + private static readonly Lazy<(IReadOnlyList Readers, IReadOnlyList Unplaced, IReadOnlyDictionary Third, IReadOnlyDictionary Labelled)> DerivedTypedReaders = new(() => { var readers = new HashSet(); var unplaced = new List(); + var third = new SortedDictionary(); + var labelled = new SortedDictionary(StringComparer.Ordinal); foreach (var c in Harness.GeneratedCells()) { + // A read of a typed-read kind that must run, with no outer binding, at a position this set reads from, among the + // pool's unrouted cells. if (c.Family != Family.Read || c.Tag != SharpyTag.MustRun || c.Outer != BindingKind.None || c.Position is not { } position - || c.Key is not { Route: null } key || key.Part() is not { } spelling - || key.Part() != Harness.Order.Earlier || !TypedReads.ContainsKey(c.Target) - || ExcludedTypedSpellings.ContainsKey(spelling) || ExcludedTypedPositions.ContainsKey(position)) + || c.Key is not { Route: null } key || !TypedReads.ContainsKey(c.Target) || ExcludedTypedPositions.ContainsKey(position)) + continue; + if (c.Relation is { } placement && placement != DeclaringRelation.Self) + { + third[placement] = third.GetValueOrDefault(placement) + 1; + if (!ExcludedTypedPlacements.ContainsKey(placement)) + unplaced.Add($"{c.Id} (relation {placement})"); + continue; + } + if (key.Part() is not { } spelling) + { + // Spelled by a label of the pool's own: counted and owed its reason, as a third placement is. + string label = string.Join("+", key.Marks); + labelled[label] = labelled.GetValueOrDefault(label) + 1; + if (!ExcludedTypedReceivers.ContainsKey(label)) + unplaced.Add($"{c.Id} (spelled by the label '{label}', which is no Spelling)"); continue; - if (c.Relation is not (null or DeclaringRelation.Self)) - unplaced.Add($"{c.Id} (relation {c.Relation})"); - else - readers.Add(new TypedReader(c.Target, spelling, position, key.Part() ?? Harness.Nesting.Direct, c.Relation == DeclaringRelation.Self)); + } + // The order is this set's own axis: a reader the pool runs above its member is generated at both orders. + if (key.Part() != Harness.Order.Earlier || ExcludedTypedSpellings.ContainsKey(spelling)) + continue; + readers.Add(new TypedReader(c.Target, spelling, position, key.Part() ?? Harness.Nesting.Direct, c.Relation == DeclaringRelation.Self)); } var instances = TypedReads.Where(t => t.Value.Level == MemberLevel.Instance).Select(t => t.Key).ToList(); foreach (var r in readers.Where(r => r is { Kind: BindingKind.StaticField, Inside: false, Spelling: Harness.Spelling.Qualified or Harness.Spelling.Alias }).ToList()) @@ -346,14 +481,22 @@ internal sealed record TypedReader(BindingKind Kind, Harness.Spelling Spelling, foreach (var instance in instances) readers.Add(r with { Kind = instance }); } - return (readers.OrderBy(r => r.Kind).ThenBy(r => r.Spelling).ThenBy(r => r.Position).ThenBy(r => r.Nesting).ThenBy(r => r.Inside).ToList(), unplaced); + return (readers.OrderBy(r => r.Kind).ThenBy(r => r.Spelling).ThenBy(r => r.Position).ThenBy(r => r.Nesting).ThenBy(r => r.Inside).ToList(), unplaced, third, labelled); }); internal static IReadOnlyList TypedReaders => DerivedTypedReaders.Value.Readers; - /// The pool's spelled reads whose reader sits neither in the member's type nor outside every type. + /// The pool's must-run reads this set has no reader for and no reason against: the reader stands in a third type + /// under a placement with no exclusion, or the read is spelled by a label with none. internal static IReadOnlyList UnplacedTypedReaders => DerivedTypedReaders.Value.Unplaced; + /// How many must-run reads the pool spells from each third placement: what an exclusion of one rests on. + internal static IReadOnlyDictionary TypedThirdPlacements => DerivedTypedReaders.Value.Third; + + /// How many must-run reads the pool spells under each label that is no Spelling, from the member's own type + /// or outside every type. + internal static IReadOnlyDictionary TypedLabelledReads => DerivedTypedReaders.Value.Labelled; + private const string AReadOfItself = "a declaration that reads itself, directly or through a ring, is N3-cycle's: refused or thrown whatever its slot's type (the 8951 pool's Self and Cycle cells)"; private const string ARecursion = "a constructor that calls itself is a recursion, not an order of two declarations"; private const string OverflowsTheCompiler = "#2769: named by an annotation, an alias whose target reaches the alias overflows the compiler's stack (`TypeResolver.ExpandTypeAlias`), and a process that dies leaves no verdict a cell can read (its probe compiles in a child process). The class is unruled and out of P78 (owner, #2423 comment 7042723494 item 9), so only the UNUSED alias has cells, and they keep running"; @@ -392,12 +535,39 @@ internal sealed record TypedReader(BindingKind Kind, Harness.Spelling Spelling, [LocalTarget.WithAs] = new[] { "with CM() as {n}:", " print({n}())" }, }; + /// The reason of a binder that could carry a callee cell and has none (the review of PR #2767, F1: the earlier + /// reasons said these bind nothing a call calls, which a typed subject refutes). Each rests on two programs. A switch and no + /// table: the probes' keys are built from it before any later field of this file is. + private static string ACalleeBinderIsOut(LocalTarget binder) + { + string binds = binder switch + { + LocalTarget.MatchCapture => "`case x:` over a function-typed local (`f: () -> int = one`, `match f:`)", + LocalTarget.AsPatternCapture => "`case _ as x:` over a function-typed local (`f: () -> int = one`, `match f:`)", + LocalTarget.OutLet => "`give(out let x)`, its parameter typed through an alias (`type F = () -> int`, `def give(f: out F)`)", + _ => throw new ArgumentOutOfRangeException(nameof(binder), binder, "a generated binder, or one with a reason of its own"), + }; + return $"{binds} binds a function value: called, the name prints `1` with no outer binding, and under a module `x: int = 12` the call is SPY0908 CS1955, the callee lookup's class the generated binders hold red (#2423, which holds the program as a cell). The binder is {ByItem26}"; + } + + private const string AnExceptionIsCalled = "`except E as x:` binds an exception, and one whose class declares `__call__` is called: `x()` prints `1` with and without a module `x: int = 12`. The binder is " + ByItem26 + ", and no tracker holds the program, since it is green"; + + private const string CallableException = "class E(Exception):\n def __call__(self) -> int:\n return 1\ndef main() -> None:\n try:\n raise E()\n except E as x:\n print(x())\n"; + + /// The probe of : the binder's statements in main under a module + /// x: int = 12 (the red program), and the same with no outer binding (its control, which runs). + private static BehaviourProbe CalleeBinderProbe(string statements, string declarations = "") + { + string program = $"{One}\n{declarations}{Main} {statements}\n"; + return new("x: int = 12\n" + program, "SPY0908 CS1955", r => Refused(r, "SPY0908", "CS1955"), Also: new[] { Prints(program, "1") }); + } + internal static readonly IReadOnlyDictionary ExcludedCalleeBinders = new Dictionary { - [LocalTarget.ExceptAs] = "binds an exception, which no call calls", - [LocalTarget.MatchCapture] = MatchSubjectIsNoValue, - [LocalTarget.AsPatternCapture] = MatchSubjectIsNoValue, - [LocalTarget.OutLet] = "binds an out argument: a function-typed out parameter is #2154's class", + [LocalTarget.ExceptAs] = AnExceptionIsCalled, + [LocalTarget.MatchCapture] = ACalleeBinderIsOut(LocalTarget.MatchCapture), + [LocalTarget.AsPatternCapture] = ACalleeBinderIsOut(LocalTarget.AsPatternCapture), + [LocalTarget.OutLet] = ACalleeBinderIsOut(LocalTarget.OutLet), }; /// Where an outer binding of the name sits against the binder: at module level (or nowhere, or the global scope), @@ -625,8 +795,10 @@ internal static IEnumerable AllConstSites() .Append((Table: null, Host: EnumMemberHost)); } - private const string LambdaTakesNoCallableSlot = "a lambda parameter's annotation cannot be a function type and take a default: `lambda p: () -> int = five: p` is SPY0103"; - private const string LambdaTakesOneNameForAType = "a lambda parameter's annotation is one name: a type spelled through its module (`lambda p: system.DayOfWeek: p`) is SPY0103 with no default at all, so the slot cannot be declared there and the parse error is no constant position's verdict; the same type under a from-import is generated"; + // The lambda host is the `lambda` spelling (`ConstantReaders`), and both reasons are true of that spelling alone (the review + // of PR #2767, F10): the arrow spelling takes both slots, and the constant-kind set has no arrow-lambda host. + private const string LambdaTakesNoCallableSlot = "the host's lambda is the `lambda` spelling, whose parameter annotation cannot be a function type and take a default: `lambda p: () -> int = five: p` is SPY0103. The arrow spelling takes one: `(p: () -> int = five) -> p` is SPY0401, the refusal the position owes, and `(p: (float) -> float = math.sqrt) -> p` is SPY0908 CS1736, the defect the `def` host's cell holds red for the same member (#2432, which holds the program as a cell). An arrow-lambda host is " + ByItem26; + private const string LambdaTakesOneNameForAType = "the host's lambda is the `lambda` spelling, whose parameter annotation is one name: a type spelled through its module (`lambda p: system.DayOfWeek: p`) is SPY0103 with no default at all, so the slot cannot be declared there and the parse error is no constant position's verdict; the same type under a from-import is generated. The arrow spelling takes the dotted type and runs (`(p: system.DayOfWeek = system.DayOfWeek.Monday) -> p` prints `DayOfWeek.Monday`): an arrow-lambda host is " + ByItem26 + ", and no tracker holds that program, since it is green"; private const string AnIntEnum = "the host is an int enum, whose member's value is an int: a `str` value declares a string enum, another host, and any other type is SPY0253"; /// Why a host has no cell for a slot of , or null when it has one. @@ -725,6 +897,9 @@ internal sealed record TypeMemberBase(string Module, string TypeName, Type Owner [ScopeConstantKind.ClrTypeStaticProperty] = new[] { new TypeMemberBase("system", "Array", typeof(Array), "max_length", "int", "2147483591") }, [ScopeConstantKind.ClrTypeMethod] = new[] { new TypeMemberBase("system", "Math", typeof(Math), "sqrt", "(float) -> float", "5.0", "{0}(25.0)", Form: Harness.Form.Value) }, [ScopeConstantKind.ClrTypeDeclinedMethod] = new[] { new TypeMemberBase("system", "Char", typeof(char), "is_ascii_digit", "object", "True", "{0} is not None", Form: Harness.Form.Value) }, + // The slot's function type selects the overload (the owner's ruling 29, #2423 comment 7052893050), so the read is a + // function value like `Math.sqrt`. SPY0336 is what every read of the group answers today (#2277), and it stays the + // answer where no function type stands at the slot: an attribute argument. [ScopeConstantKind.ClrTypeMethodGroup] = new[] { new TypeMemberBase("system", "Math", typeof(Math), "abs", "(int) -> int", "5", "{0}(-5)", new[] { "SPY0336" }, Harness.Form.Value), @@ -1331,6 +1506,7 @@ internal sealed record AliasShape(string Label, string Target, bool Generic = fa }; private const string TheAliasItself = "the alias's own name and where it stands: not its target"; + private const string AnEscapedNameIsMissingAsItsPlainOne = "the escape picks the namespace a spelling is looked up in (a type of the program over a builtin of the same spelling): a missing name is missing in both, so an escaped target has its plain one's verdict (named by an annotation, ``type K0 = `nosuch` `` is SPY0202 as `type K0 = nosuch` is)"; private const string SourceLocation = "a source location"; private const string UnparserFact = "a syntax fact for the unparser and the structural comparer (the record's own remark): resolution does not read it"; @@ -1342,7 +1518,7 @@ internal sealed record AliasShape(string Label, string Target, bool Generic = fa [$"TypeAlias.{nameof(AstTypeAlias.NameColumnEnd)}"] = TheAliasItself, [$"TypeAlias.{nameof(AstTypeAlias.IsNameBacktickEscaped)}"] = TheAliasItself, [$"TypeAlias.{nameof(AstTypeAlias.FunctionType)}"] = "refined by FunctionType's own properties", - [$"TypeAnnotation.{nameof(AstTypeAnnotation.IsNameBacktickEscaped)}"] = "the escape picks the namespace a spelling is looked up in: a missing name is missing in both, and the escaped lookup is #1325's", + [$"TypeAnnotation.{nameof(AstTypeAnnotation.IsNameBacktickEscaped)}"] = AnEscapedNameIsMissingAsItsPlainOne, [$"TypeAnnotation.{nameof(AstTypeAnnotation.BacktickEscapedParts)}"] = UnparserFact, [$"TypeAnnotation.{nameof(AstTypeAnnotation.IsResult)}"] = "computed from ErrorType, which is a shape", [$"TypeAnnotation.{nameof(AstTypeAnnotation.TupleElementNamesBacktickEscaped)}"] = UnparserFact, @@ -1399,7 +1575,22 @@ void Carried(string route, IEnumerable owed, Func> re ValueTypes.Keys, ExcludedValueTypes.Keys); Carried("no-initializer", Declarations.Keys, c => new[] { c.Cell.Target }); Carried("no-initializer", Enum.GetValues(), Part); - Carried("no-initializer", DeclarationHosts.Values.SelectMany(h => h).Concat(ValueTypes.Values.SelectMany(v => v).Select(v => v.Label)), Marks); + // The host is read from its typed part and the declared type from its label: two axes, so a pool that loses every cell of + // one host, or of one declared type, is red. Then the product: every kind a type declares, in every host, with every type. + Carried("no-initializer", DeclarationHosts.Values.SelectMany(h => h), c => HostOf(c.Cell) is { } host ? new[] { host } : Array.Empty()); + var typeLabels = ValueTypes.Values.SelectMany(v => v).Select(v => v.Label).ToList(); + Carried("no-initializer", typeLabels, Marks); + foreach (var misplaced in DeclarationHosts.Where(h => h.Value.Any(host => host.Kind != h.Key)).Select(h => h.Key)) + problems.Add($"no-initializer × host: a host listed under {misplaced} carries another kind"); + var declared = Route("no-initializer").Select(c => (c.Cell.Target, Host: HostOf(c.Cell), Marks: Marks(c).ToHashSet(StringComparer.Ordinal))).ToList(); + foreach (var kind in Declarations.Where(d => d.Value.InType).Select(d => d.Key)) + { + foreach (var host in DeclarationHosts.Values.SelectMany(h => h)) + { + foreach (var label in typeLabels.Where(l => !declared.Any(d => d.Target == kind && d.Host == host && d.Marks.Contains(l)))) + problems.Add($"no-initializer: no cell declares {kind} of type {label} in a {host}"); + } + } // typed-read Partition("typed-read × kind", Enum.GetValues(), TypedReads.Keys, ExcludedTypedReads.Keys); @@ -1409,6 +1600,15 @@ void Carried(string route, IEnumerable owed, Func> re Carried("typed-read", Enum.GetValues(), Part); foreach (var unplaced in UnplacedTypedReaders.Take(10)) problems.Add($"typed-read: the 8951 pool spells a read this set has no reader host for: {unplaced}"); + foreach (var placement in TypedThirdPlacements.Keys.Where(p => !ExcludedTypedPlacements.ContainsKey(p))) + problems.Add($"typed-read × reader placement: {placement} is neither generated nor excluded, and the 8951 pool spells {TypedThirdPlacements[placement]} must-run reads from it"); + // The other direction: an exclusion says the pool reads from the placement, so one the pool no longer spells holds nothing. + foreach (var stale in ExcludedTypedPlacements.Keys.Where(p => !TypedThirdPlacements.ContainsKey(p))) + problems.Add($"typed-read × reader placement: {stale} is excluded as a placement the 8951 pool reads from, and that pool spells no must-run read from it"); + foreach (var label in TypedLabelledReads.Keys.Where(l => !ExcludedTypedReceivers.ContainsKey(l))) + problems.Add($"typed-read × receiver: the label '{label}' is neither generated nor excluded, and the 8951 pool spells {TypedLabelledReads[label]} must-run reads under it"); + foreach (var stale in ExcludedTypedReceivers.Keys.Where(l => !TypedLabelledReads.ContainsKey(l))) + problems.Add($"typed-read × receiver: the label '{stale}' is excluded as one the 8951 pool reads under, and that pool spells no must-run read under it"); foreach (var (route, excluded) in ExcludedOrders) Partition($"{route} × order", Enum.GetValues(), Route(route).SelectMany(Part), excluded.Keys); foreach (var later in Route("typed-read").Where(c => c.Cell.Key!.Part() == Harness.Order.Later)) @@ -1684,9 +1884,10 @@ IEnumerable Owed(ScopeConstantKind kind) if (!binders.SequenceEqual(AliasBinderSites.OrderBy(k => k, StringComparer.Ordinal))) problems.Add($"alias-target × site: the binder census holds [{string.Join("; ", binders)}], and the sites were placed for [{string.Join("; ", AliasBinderSites)}]"); - // An exclusion that rests on the compiler names its probe, and a probe has its exclusion. + // A probe has its exclusion, and an exclusion that rests on the compiler has its probe. What rests on the compiler is read + // from the reason's own text: one that names a diagnostic code or cites an issue says what a program does today. var reasons = ExcludedDeclarations.Values.Concat(ExcludedDeclarationHosts.Values).Concat(ExcludedValueTypes.Values).Concat(ExcludedTypedReads.Values) - .Concat(ExcludedTypedSpellings.Values).Concat(ExcludedTypedPositions.Values).Concat(ExcludedCalleeBinders.Values).Concat(ExcludedCalleeOuters.Values) + .Concat(ExcludedTypedSpellings.Values).Concat(ExcludedTypedPositions.Values).Concat(ExcludedTypedPlacements.Values).Concat(ExcludedTypedReceivers.Values).Concat(ExcludedCalleeBinders.Values).Concat(ExcludedCalleeOuters.Values) .Concat(ExcludedAdmissionTables.Values).Concat(ExcludedModuleMemberShapes.Values).Concat(ExcludedModuleCollections.Values).Concat(ExcludedAliasScopes.Values).Concat(ExcludedAliasTypeHosts.Values) .Concat(ExcludedOwnSpellings.Values).Concat(ExcludedOwnPlacements.Values).Concat(ExcludedEnumSpellings.Values).Concat(ExcludedImportKinds.Values) .Concat(ExcludedBuiltinReceivers.Values).Concat(ExcludedLambdaUses.Values).Concat(ExcludedLambdaDefaultPositions.Values) @@ -1700,6 +1901,8 @@ IEnumerable Owed(ScopeConstantKind kind) .ToHashSet(StringComparer.Ordinal); foreach (var orphan in BehaviourProbes.Keys.Concat(CrashProbes.Keys).Where(k => !reasons.Contains(k))) problems.Add($"a probe guards the reason '{orphan}', and no exclusion gives it"); + foreach (var unprobed in reasons.Where(r => NamesWhatTheCompilerDoes.IsMatch(r) && !BehaviourProbes.ContainsKey(r) && !CrashProbes.ContainsKey(r)).OrderBy(r => r, StringComparer.Ordinal)) + problems.Add($"the exclusion '{unprobed}' names a diagnostic code or an issue, so it rests on what the compiler does today, and no probe holds it"); foreach (var twice in BehaviourProbes.Keys.Where(CrashProbes.ContainsKey)) problems.Add($"the reason '{twice}' has a probe in this process and one in a child process: it rests on one behaviour"); foreach (var blank in reasons.Where(string.IsNullOrWhiteSpace)) @@ -1707,6 +1910,9 @@ IEnumerable Owed(ScopeConstantKind kind) return problems; } + /// What marks a reason as resting on the compiler: a diagnostic code (Sharpy's or C#'s) or an issue's number. + private static readonly Regex NamesWhatTheCompilerDoes = new(@"\b(?:SPY|CS)\d{4}\b|#\d{3,}"); + /// The binder sites the alias sites were placed for ('s summary). internal static readonly string[] AliasBinderSites = { @@ -1747,13 +1953,16 @@ public void Exclusions_RestingOnACompilerCrash_GoRedWhenItStops() public void Exclusions_RestingOnTheCompiler_GoRedWhenItChanges() { var problems = new List(); - foreach (var (reason, probe) in BehaviourProbes.OrderBy(e => e.Key, StringComparer.Ordinal)) + foreach (var (reason, probes) in BehaviourProbes.OrderBy(e => e.Key, StringComparer.Ordinal)) { - var run = RunSharpy(probe.Source, probe.Stdlib, SharpyExecTimeoutMs); - if (!probe.Holds(run)) + foreach (var probe in probes.All) { - problems.Add($"'{reason}' rests on {probe.Expected}, and the probe now gives [{string.Join(",", run.ErrorCodes.Distinct())}{(run.CsCode != null ? " " + run.CsCode : "")}]" - + $"{(run.ErrorCodes.Count == 0 ? $" stdout '{Harness.Normalize(run.Stdout)}'" : "")}: generate the value, or give the exclusion its new reason"); + var run = RunSharpy(probe.Source, probe.Stdlib, SharpyExecTimeoutMs); + if (!probe.Holds(run)) + { + problems.Add($"'{reason}' rests on {probe.Expected}, and the probe now gives [{string.Join(",", run.ErrorCodes.Distinct())}{(run.CsCode != null ? " " + run.CsCode : "")}]" + + $"{(run.ErrorCodes.Count == 0 ? $" stdout '{Harness.Normalize(run.Stdout)}'" : "")}: generate the value, or give the exclusion its new reason"); + } } } Assert.True(problems.Count == 0, string.Join("\n", problems)); diff --git a/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs index af7cac3b7..0c2b5d0d9 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/ScopeMeaningDifferentialTests.cs @@ -9,6 +9,7 @@ using Xunit; using Xunit.Abstractions; using Harness = Sharpy.Compiler.Tests.Conformance.NameResolutionDifferentialTests; +using TypeKind = Sharpy.Compiler.Semantic.TypeKind; namespace Sharpy.Compiler.Tests.Conformance; @@ -88,7 +89,9 @@ internal enum ScopeConstantKind /// parameter: Char.is_ascii_digit), read uncalled: the checker types it object, and the value is no constant. ClrTypeDeclinedMethod, - /// A static method group of a referenced type, read uncalled: no value at all (SPY0336). + /// A static method group of a referenced type, read uncalled. Where the slot has a function type, that type + /// selects the overload and the read is a function value, no constant (the owner's ruling 29, #2423 comment 7052893050; + /// SPY0336 today: #2277). Where it has none (an attribute argument) the group is no value at all (SPY0336). ClrTypeMethodGroup, /// A member of an int enum of the program: a C# constant. @@ -247,11 +250,14 @@ private static Case Draft(CellKey key, Family family, string source, string? mod // no-initializer (R-QI) // ------------------------------------------------------------------------------------------- // + /// The code R-QI's refusal carries: plan-777361's D7 and D9 introduce it with the refusal itself. + internal const string NoInitializerRefusal = "SPY0620"; + private static IEnumerable NoInitializerCases() { foreach (var (kind, d) in Declarations.OrderBy(e => e.Key)) { - foreach (var host in d.InType ? DeclarationHosts.Values.SelectMany(h => h).ToArray() : new string?[] { null }) + foreach (var host in d.InType ? DeclarationHosts.OrderBy(h => h.Key).SelectMany(h => h.Value).ToArray() : new DeclarationHost?[] { null }) { foreach (var type in ValueTypes.OrderBy(e => e.Key.Name, StringComparer.Ordinal).SelectMany(e => e.Value)) { @@ -261,7 +267,7 @@ private static IEnumerable NoInitializerCases() continue; // A struct's instance field initializer is a constant position (the 8951 pool's StructFieldInitializer): // a declared type whose value is no constant has no initializer to write there. - if (initializer == ScopeInitializer.Present && kind == BindingKind.InstanceField && host == "struct" && !type.Constant) + if (initializer == ScopeInitializer.Present && kind == BindingKind.InstanceField && host?.Kind == TypeKind.Struct && !type.Constant) continue; string F(string text) => text.Replace("{T}", type.Spelling, StringComparison.Ordinal).Replace("{L}", type.Literal, StringComparison.Ordinal); string decl = initializer switch @@ -287,7 +293,7 @@ private static IEnumerable NoInitializerCases() { if (d.InType) { - lines.Add($"{host} H:"); + lines.Add($"{host!.Keyword} H:"); lines.Add(Indent(decl)); if (initializer == ScopeInitializer.Absent && d.Stored != null) lines.AddRange(d.Stored.Select(s => Indent(F(s)))); @@ -298,10 +304,12 @@ private static IEnumerable NoInitializerCases() lines.Add(print); } // Read where R-QI refuses; the kinds it leaves alone store first, so every cell that runs prints the stored value. - bool twin = d.Twin && type.Twin && host is null or "class" + bool twin = d.Twin && type.Twin && host is null or { Kind: TypeKind.Class } && (initializer == ScopeInitializer.Present || (initializer == ScopeInitializer.Absent && d.Stored != null)); + // R-QI's refusal is SPY0620, the code plan-777361 introduces for it (D7, D9): no compiler says it yet, so a + // cell that must be refused is red until then, and a refusal under any other code is another rule's. yield return Draft(Key("read", "no-initializer", kind, initializer, host, type.Label), Family.Read, Lines(lines), "5", - Array.Empty(), twin, target: kind); + new[] { NoInitializerRefusal }, twin, target: kind); } } } @@ -734,6 +742,10 @@ internal static List TotalityFailures(IReadOnlyList pool) failures.Add($"{c.Cell.Id}: its row says must-run and the generator gives it nothing to print"); if (c.Twin && c.Cell.Tag != SharpyTag.MustRun) failures.Add($"{c.Cell.Id}: a twin is python running the same program, and the cell does not run"); + // A must-refuse cell that admits no code can only ever be judged a false refusal: no refusal could turn it green, + // and nothing would say which refusal is the rule's (the review of PR #2767, F6). + if (c.Cell.Tag == SharpyTag.MustRefuse && c.Cell.SeedRefusalCodes is not { Count: > 0 }) + failures.Add($"{c.Cell.Id}: its row says must-refuse under {c.Cell.Rule}, and the generator names no code its refusal may carry"); if (c.Cell.Id.Any(char.IsWhiteSpace)) failures.Add($"'{c.Cell.Id}': an id is one word, since an allowlist row is ` # `"); } @@ -755,8 +767,9 @@ public void RuleTable_EveryCaseHasOneRow_AndTakesItsVerdictFromIt() /// The issue whose fix turns a red cell of a route green: #2432 for a constant position's verdict, #2423 for the rest /// (R-QI's cells, the untyped forward read, the callee lookup, a lambda's default, the alias refusal: charter §3.20l). A typed read that is /// red at the EARLIER order is no order defect, and it and its later twin are #2417's; an alias that reaches itself is - /// #2769's; in a constant position, N2's cells are #2423's, as is a bare sibling read red at the later order alone, and a - /// member that dies of an instance receiver is #2147's (). + /// #2769's; in a constant position, N2's cells are #2423's, as is a bare sibling read red at the later order alone, a + /// member that dies of an instance receiver is #2147's, and a method group refused where its slot's function type selects + /// an overload is #2277's (). internal static readonly IReadOnlyDictionary RouteIssues = new Dictionary(StringComparer.Ordinal) { ["no-initializer"] = "#2423", @@ -786,6 +799,14 @@ public void RuleTable_EveryCaseHasOneRow_AndTakesItsVerdictFromIt() /// The C# error that is #2147's symptom. internal const string StaticThroughInstanceCs = "CS0176"; + /// The class of an overloaded method group of a referenced type read where a function type stands at the slot + /// (#2277; the owner's ruling 29, #2423 comment 7052893050): the slot's type selects the overload and the read must run, + /// and today the checker refuses every read of the group. No constant position's fix cures it. + internal const string OverloadByTargetType = "#2277"; + + /// The refusal that is #2277's symptom there. + internal const string MethodGroupRefusal = "SPY0336"; + internal sealed record Result(Case Case, Harness.SharpyRun Run, SharpyKind Kind, VerdictClass Class, bool WrongCode, string? PythonFailure); /// The harness's table, and one more red: a must-refuse cell refused under a code it does not admit. @@ -830,6 +851,9 @@ internal static string ProposedCite(Result r, IReadOnlySet redIds) issue = ClassBodyRule; if (r.Case.Cell.Key.Route == "constant-kind" && r.Case.Cell.Key.Part() == Harness.Spelling.SelfDot && r.Run.CsCode == StaticThroughInstanceCs) issue = StaticThroughInstance; + // A method group that must run and is refused as a group: no overload was selected, whatever the position. + if (r.Case.Cell.Key.Part() == ScopeConstantKind.ClrTypeMethodGroup && r.Case.Cell.Tag == SharpyTag.MustRun && r.Run.ErrorCodes.Contains(MethodGroupRefusal)) + issue = OverloadByTargetType; string lane = r.WrongCode ? "wrong-code" : r.Class switch { VerdictClass.Ice => "ice", @@ -896,7 +920,8 @@ private Harness.SharpyRun RunSharpy(string source, bool needsStdlib, int timeout [SkippableFact] public void ScopeMeaning_Sweep() { - var oracle = PythonBatchOracle.Over(PythonInterpreter.RequireOrSkip(minMinor: 12)); + // The oracle is the pinned CPython (`.python-version`, 3.15): an older minor is no verdict, so it skips where it would answer. + var oracle = PythonBatchOracle.Over(PythonInterpreter.RequireOrSkip(minMinor: 15)); var wall = Stopwatch.StartNew(); var pool = GeneratedCases(); var failures = TotalityFailures(pool); @@ -1067,6 +1092,12 @@ Result Of(Case c, Harness.SharpyRun run, string? pythonFailure = null) Assert.Empty(RatchetFailures(new[] { Of(throughSelf, Ice(StaticThroughInstanceCs)) }, Rows((throughSelf, VerdictClass.Ice, "#2147 ice")))); Assert.Contains("the route says '#2147", Assert.Single(RatchetFailures(new[] { Of(throughSelf, Ice(StaticThroughInstanceCs)) }, Rows((throughSelf, VerdictClass.Ice, "#2432 ice"))))); Assert.Contains("the route says '#2432", Assert.Single(RatchetFailures(new[] { Of(throughSelf, Ice("CS1736")) }, Rows((throughSelf, VerdictClass.Ice, "#2147 ice"))))); + // A method group that must run (a function type stands at its slot) and is refused as a group is #2277's; red any other + // way it is the position's own. + var group = pool.First(c => Constant(c) && c.Cell.Tag == SharpyTag.MustRun && c.Cell.Key!.Part() == ScopeConstantKind.ClrTypeMethodGroup); + Assert.Empty(RatchetFailures(new[] { Of(group, Refused(MethodGroupRefusal)) }, Rows((group, VerdictClass.FalseRefusal, "#2277 false-refusal")))); + Assert.Contains("the route says '#2277", Assert.Single(RatchetFailures(new[] { Of(group, Refused(MethodGroupRefusal)) }, Rows((group, VerdictClass.FalseRefusal, "#2432 false-refusal"))))); + Assert.Contains("the route says '#2432", Assert.Single(RatchetFailures(new[] { Of(group, Ice("CS1736")) }, Rows((group, VerdictClass.Ice, "#2277 ice"))))); // A bare sibling read red BELOW its member alone is the class-body rule's order (#2423); red above it too, no order // cures it and it is the position's own (#2432). var below = pool.First(c => Constant(c) && c.Cell.Tag == SharpyTag.MustRun && c.Cell.Rule != "N2" && SiblingAboveTwinId(c.Cell) != null); diff --git a/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt b/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt index 8f6aefb0f..e6e136f3d 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt +++ b/src/Sharpy.Compiler.Tests/Conformance/name-resolution-rules.txt @@ -130,6 +130,10 @@ MustRefuse SPY0401 family=Read route=- relation!=- spelling!=Bare target=StaticF MustRefuse SPY0401 family=Read route=- relation!=- spelling=Bare target=StaticField,StaticProperty,StaticMethod,ClassComputedConst,NestedType outer=None position=@ConstantOnly order!=- MustRefuse SPY0401 family=Read route=- relation=- spelling=Bare target!=ModuleLet,ModuleLiteralConst,ModuleEnum outer=None position=@ConstantOnly MustRefuse SPY0401 family=Read route=- relation=Base spelling=Bare target=ClassLiteralConst outer!=None position=@ConstantOnly order!=Earlier +# Among the cells of the next row is a bare sibling read at-or-after its reader under an outer binding, in a constant-only +# position: N2's program. This pool answers it with SPY0401 today. N2's own code, SPY0619, is the one plan-777361 (P78) +# introduces (D3, D9), and the ScopeMeaning rows below already expect it for the same program: the two readings meet at the +# commit that makes the compiler say SPY0619, where this row's N2 cells are retagged (D9, T8). MustRefuse SPY0401 family=Read route=- target!=@Instance,ClassLiteralConst outer!=None position=@ConstantOnly MustRefuse kind:SPY0212 family=Read route=- relation=- readForm!=Call target!=@ValueForm,InstanceMethod outer=@Module,@TypeLevelMember,@Named position!=@ConstantOnly,ModuleInitializer order!=Earlier mark=int MustRefuse kind:SPY0212 family=Read route=- spelling!=Qualified readForm=- target=@NonWritableByMeaning outer=@Module,@TypeLevelMember,@Named position!=@Initializer order=Earlier mark=int mark!=arity-mismatch @@ -220,6 +224,8 @@ MustRun P52 family=TypeMember route=class,dataclass,enum,interface,struct,union # --- `const` initializer is then a computed constant (N4), a struct's auto-property keeps its initializer (#1938), an # --- attribute argument refuses under its own code, and every other position refuses under SPY0401. A name that is no # --- value there refuses under its kind's own code. An alias that reaches itself is unruled (#2769): unused, it runs. --- +# R-QI's refusal carries SPY0620, a code plan-777361 (P78) introduces (D7, D9): no compiler says it today, so these cells name +# it and wait on it; a refusal under any other code is another rule's. MustRefuse R-QI family=Read route=no-initializer initializer=Absent target=ModuleVar,ModuleProperty,StaticField,StaticProperty MustRun N1 family=Read route=no-initializer initializer=Absent target=InstanceField,InstanceProperty,LocalVar MustRun N1 family=Read route=no-initializer initializer=Present,AccessorBodies @@ -229,11 +235,19 @@ MustRun N4 family=Read route=constant-kind constantKind=ClrLiteralField,ClrTypeL # A `const decimal` of a referenced type (the owner's ruling 17): what C# reads as a constant wherever a decimal can be one, # which an attribute argument is not. MustRun N4 family=Read route=constant-kind admission!=DecoratorArgument constantKind=ClrTypeDecimalConstant -MustRun N4 family=Read route=constant-kind admission=ConstInitializer constantKind=StdlibModuleVariable,ClrStaticMember,ModuleFunction,ModuleFunctionGroup,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,ClrTypeDeclinedMethod,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink -MustRun #1938 family=Read route=constant-kind mark=struct-auto-property constantKind=StdlibModuleVariable,ClrStaticMember,ModuleFunction,ModuleFunctionGroup,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,ClrTypeDeclinedMethod,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink -MustRefuse SPY0401 family=Read route=constant-kind admission=ParameterDefault,LambdaParameterDefault,PerInstanceFieldDefault,- mark=def,lambda,dataclass,struct,enum-member constantKind=StdlibModuleVariable,ClrStaticMember,ModuleFunction,ModuleFunctionGroup,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,ClrTypeDeclinedMethod,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink +# An overloaded method group of a referenced type (`Math.abs`) is in the rows below by the owner's ruling 29 (#2423 comment +# 7052893050): a function target type selects a CLR overload, so where the slot has one the read is a function value like any +# other. It must run at a `const` and a struct's auto-property (refused today under SPY0336: known-red, #2277) and is no +# constant at a default (SPY0401, or today's SPY0336). An attribute argument has no function type at its slot: the last row. +MustRun N4 family=Read route=constant-kind admission=ConstInitializer constantKind=StdlibModuleVariable,ClrStaticMember,ModuleFunction,ModuleFunctionGroup,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,ClrTypeDeclinedMethod,ClrTypeMethodGroup,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink +MustRun #1938 family=Read route=constant-kind mark=struct-auto-property constantKind=StdlibModuleVariable,ClrStaticMember,ModuleFunction,ModuleFunctionGroup,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,ClrTypeDeclinedMethod,ClrTypeMethodGroup,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink +# A string enum's member, its `.value` and any enum's `.name` are refused at a default by the owner's ruling 10 (#2423 comment +# 7045166298), kept as an INTERIM by item 28 (comment 7052893050): it contradicts +# docs/language_specification/function_default_parameters.md, whose allowed defaults list `HttpMethod.GET` (a string enum's +# member), until #2772 makes the default run as the spec says. The spec's text is not changed. +MustRefuse SPY0401 family=Read route=constant-kind admission=ParameterDefault,LambdaParameterDefault,PerInstanceFieldDefault,- mark=def,lambda,dataclass,struct,enum-member constantKind=StdlibModuleVariable,ClrStaticMember,ModuleFunction,ModuleFunctionGroup,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,ClrTypeDeclinedMethod,ClrTypeMethodGroup,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink MustRefuse SPY0425 family=Read route=constant-kind admission=DecoratorArgument constantKind=StdlibModuleVariable,ClrStaticMember,ModuleFunction,ModuleFunctionGroup,ClrTypeDecimalConstant,ClrTypeStaticField,ClrTypeStaticProperty,ClrTypeMethod,ClrTypeDeclinedMethod,IntEnumName,StringEnumMember,StringEnumValue,StringEnumName,ChainWithNonConstantLink -MustRefuse kind:SPY0336 family=Read route=constant-kind constantKind=ClrTypeMethodGroup +MustRefuse kind:SPY0336 family=Read route=constant-kind admission=DecoratorArgument constantKind=ClrTypeMethodGroup # A name of the program's own, under every spelling and from every placement but a bare sibling read: one answer (N7). MustRun N4 family=Read route=constant-kind constantKind=OwnMember target=ModuleLiteralConst,ClassLiteralConst mark!=bare-sibling MustRun N4 family=Read route=constant-kind admission=ConstInitializer constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin mark!=bare-sibling @@ -248,6 +262,9 @@ MustRefuse SPY0401 family=Read route=constant-kind admission=LambdaParameterDefa # binding of the name, and N2's refusal at-or-after under one. Where it is the member, the constant position then answers. MustRefuse N1-methods family=Read route=constant-kind constantKind=OwnMember mark=bare-sibling mark=in-method outer=None MustRun R-Y family=Read route=constant-kind constantKind=OwnMember mark=bare-sibling mark=in-method outer!=None +# N2's refusal is SPY0619, the code plan-777361 (P78) introduces (D3, D9): no compiler says it today, so the next row's cells +# name it and wait on it by design. The P77a pool's row for the same program (above, `MustRefuse SPY0401 … position=@ConstantOnly`) +# is green on SPY0401 until then. MustRefuse N2 family=Read route=constant-kind constantKind=OwnMember mark=bare-sibling mark!=in-method order=Later outer!=None MustRun N1 family=Read route=constant-kind constantKind=OwnMember target=ModuleLiteralConst,ClassLiteralConst mark=bare-sibling mark!=in-method order=Earlier MustRun N4 family=Read route=constant-kind admission=ConstInitializer constantKind=OwnMember target=ModuleVar,ModuleComputedConst,ModuleProperty,ModuleDef,StaticField,StaticProperty,StaticMethod,ClassComputedConst,Builtin mark=bare-sibling mark!=in-method order=Earlier @@ -265,6 +282,7 @@ MustRun N1 family=Read route=init-overload MustRun N4 family=Read route=lambda-default order=- MustRun N1 family=Read route=lambda-default order=Earlier MustRun N1+N3 family=Read route=lambda-default order=Later outer=None +# SPY0619 here too: the code lands with plan-777361 (D9). MustRefuse N2 family=Read route=lambda-default order=Later outer!=None MustRefuse N1-alias-target family=Read route=alias-target aliasTarget=Missing MustRun N1 family=Read route=alias-target aliasTarget=Declared diff --git a/src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt b/src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt index dc1ae0d2f..b562b696b 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt +++ b/src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt @@ -4,7 +4,9 @@ # that is red at the EARLIER order too, which no order cures and is #2417's with its later twin; an alias whose # target reaches the alias itself, which is #2769's; and, in a constant position, N2's refusal and a bare sibling read # that is red BELOW its member alone, which are the class-body rule's (#2423), and a member read through `self` that -# dies of CS0176, which is #2147's. A row whose cell passes fails the test until it is deleted. +# dies of CS0176, which is #2147's; and a method group of a referenced type that must run, because a function type stands at +# its slot (the owner's ruling 29, #2423 comment 7052893050), and is refused as a group (SPY0336), which is #2277's. +# A row whose cell passes fails the test until it is deleted. # `wrong-code` is a must-refuse cell refused under a code its cell does not admit. The sweep writes the rows it would # list to .claude/tmp/scope-meaning-differential-proposed-allowlist.txt. local/callee/Comprehension/outer=ImportedName Ice # #2423 ice @@ -117,6 +119,12 @@ read/alias-target/Missing/Unused/Earlier/struct/optional SilentWrong # #2423 mis read/alias-target/Missing/Unused/Earlier/struct/result-error SilentWrong # #2423 missing-refusal read/alias-target/Missing/Unused/Earlier/struct/tuple-element SilentWrong # #2423 missing-refusal read/alias-target/Missing/Unused/Earlier/struct/type-argument SilentWrong # #2423 missing-refusal +read/constant-kind/ConstInitializer/block-const/ClrTypeMethodGroup/Value/Math.abs/from-import FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/block-const/ClrTypeMethodGroup/Value/Math.abs/from-import-as FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/block-const/ClrTypeMethodGroup/Value/Math.abs/import FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/block-const/ClrTypeMethodGroup/Value/Math.abs/import-as FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/block-const/ClrTypeMethodGroup/Value/Math.abs/star-import FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/block-const/ClrTypeMethodGroup/Value/Math.abs/type-alias FalseRefusal # #2277 false-refusal read/constant-kind/ConstInitializer/block-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import Ice # #2432 ice read/constant-kind/ConstInitializer/block-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import-as Ice # #2432 ice read/constant-kind/ConstInitializer/block-const/ClrTypeStaticField/BitConverter.is_little_endian/import Ice # #2432 ice @@ -145,6 +153,12 @@ read/constant-kind/ConstInitializer/block-const/StringEnumName/name/type-alias I read/constant-kind/ConstInitializer/block-const/StringEnumName/name/type-name Ice # #2432 ice read/constant-kind/ConstInitializer/block-const/StringEnumValue/EnumValue/value/type-alias Ice # #2432 ice read/constant-kind/ConstInitializer/block-const/StringEnumValue/EnumValue/value/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/class-const/ClrTypeMethodGroup/Value/Math.abs/from-import FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/class-const/ClrTypeMethodGroup/Value/Math.abs/from-import-as FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/class-const/ClrTypeMethodGroup/Value/Math.abs/import FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/class-const/ClrTypeMethodGroup/Value/Math.abs/import-as FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/class-const/ClrTypeMethodGroup/Value/Math.abs/star-import FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/class-const/ClrTypeMethodGroup/Value/Math.abs/type-alias FalseRefusal # #2277 false-refusal read/constant-kind/ConstInitializer/class-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import Ice # #2432 ice read/constant-kind/ConstInitializer/class-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import-as Ice # #2432 ice read/constant-kind/ConstInitializer/class-const/ClrTypeStaticField/BitConverter.is_little_endian/import Ice # #2432 ice @@ -182,6 +196,12 @@ read/constant-kind/ConstInitializer/class-const/StringEnumName/name/type-alias I read/constant-kind/ConstInitializer/class-const/StringEnumName/name/type-name Ice # #2432 ice read/constant-kind/ConstInitializer/class-const/StringEnumValue/EnumValue/value/type-alias Ice # #2432 ice read/constant-kind/ConstInitializer/class-const/StringEnumValue/EnumValue/value/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/interface-const/ClrTypeMethodGroup/Value/Math.abs/from-import FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/interface-const/ClrTypeMethodGroup/Value/Math.abs/from-import-as FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/interface-const/ClrTypeMethodGroup/Value/Math.abs/import FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/interface-const/ClrTypeMethodGroup/Value/Math.abs/import-as FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/interface-const/ClrTypeMethodGroup/Value/Math.abs/star-import FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/interface-const/ClrTypeMethodGroup/Value/Math.abs/type-alias FalseRefusal # #2277 false-refusal read/constant-kind/ConstInitializer/interface-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import Ice # #2432 ice read/constant-kind/ConstInitializer/interface-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import-as Ice # #2432 ice read/constant-kind/ConstInitializer/interface-const/ClrTypeStaticField/BitConverter.is_little_endian/import Ice # #2432 ice @@ -208,6 +228,12 @@ read/constant-kind/ConstInitializer/interface-const/StringEnumName/name/type-ali read/constant-kind/ConstInitializer/interface-const/StringEnumName/name/type-name Ice # #2432 ice read/constant-kind/ConstInitializer/interface-const/StringEnumValue/EnumValue/value/type-alias Ice # #2432 ice read/constant-kind/ConstInitializer/interface-const/StringEnumValue/EnumValue/value/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/local-const/ClrTypeMethodGroup/Value/Math.abs/from-import FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/local-const/ClrTypeMethodGroup/Value/Math.abs/from-import-as FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/local-const/ClrTypeMethodGroup/Value/Math.abs/import FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/local-const/ClrTypeMethodGroup/Value/Math.abs/import-as FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/local-const/ClrTypeMethodGroup/Value/Math.abs/star-import FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/local-const/ClrTypeMethodGroup/Value/Math.abs/type-alias FalseRefusal # #2277 false-refusal read/constant-kind/ConstInitializer/local-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import Ice # #2432 ice read/constant-kind/ConstInitializer/local-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import-as Ice # #2432 ice read/constant-kind/ConstInitializer/local-const/ClrTypeStaticField/BitConverter.is_little_endian/import Ice # #2432 ice @@ -236,6 +262,12 @@ read/constant-kind/ConstInitializer/local-const/StringEnumName/name/type-alias I read/constant-kind/ConstInitializer/local-const/StringEnumName/name/type-name Ice # #2432 ice read/constant-kind/ConstInitializer/local-const/StringEnumValue/EnumValue/value/type-alias Ice # #2432 ice read/constant-kind/ConstInitializer/local-const/StringEnumValue/EnumValue/value/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/module-const/ClrTypeMethodGroup/Value/Math.abs/from-import FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/module-const/ClrTypeMethodGroup/Value/Math.abs/from-import-as FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/module-const/ClrTypeMethodGroup/Value/Math.abs/import FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/module-const/ClrTypeMethodGroup/Value/Math.abs/import-as FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/module-const/ClrTypeMethodGroup/Value/Math.abs/star-import FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/module-const/ClrTypeMethodGroup/Value/Math.abs/type-alias FalseRefusal # #2277 false-refusal read/constant-kind/ConstInitializer/module-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import Ice # #2432 ice read/constant-kind/ConstInitializer/module-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import-as Ice # #2432 ice read/constant-kind/ConstInitializer/module-const/ClrTypeStaticField/BitConverter.is_little_endian/import Ice # #2432 ice @@ -258,6 +290,12 @@ read/constant-kind/ConstInitializer/module-const/StringEnumName/name/type-alias read/constant-kind/ConstInitializer/module-const/StringEnumName/name/type-name Ice # #2432 ice read/constant-kind/ConstInitializer/module-const/StringEnumValue/EnumValue/value/type-alias Ice # #2432 ice read/constant-kind/ConstInitializer/module-const/StringEnumValue/EnumValue/value/type-name Ice # #2432 ice +read/constant-kind/ConstInitializer/struct-const/ClrTypeMethodGroup/Value/Math.abs/from-import FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/struct-const/ClrTypeMethodGroup/Value/Math.abs/from-import-as FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/struct-const/ClrTypeMethodGroup/Value/Math.abs/import FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/struct-const/ClrTypeMethodGroup/Value/Math.abs/import-as FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/struct-const/ClrTypeMethodGroup/Value/Math.abs/star-import FalseRefusal # #2277 false-refusal +read/constant-kind/ConstInitializer/struct-const/ClrTypeMethodGroup/Value/Math.abs/type-alias FalseRefusal # #2277 false-refusal read/constant-kind/ConstInitializer/struct-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import Ice # #2432 ice read/constant-kind/ConstInitializer/struct-const/ClrTypeStaticField/BitConverter.is_little_endian/from-import-as Ice # #2432 ice read/constant-kind/ConstInitializer/struct-const/ClrTypeStaticField/BitConverter.is_little_endian/import Ice # #2432 ice @@ -732,6 +770,12 @@ read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeMethod/Value/Mat read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeMethod/Value/Math.sqrt/import-as Ice # #2432 ice read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeMethod/Value/Math.sqrt/star-import Ice # #2432 ice read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeMethod/Value/Math.sqrt/type-alias Ice # #2432 ice +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeMethodGroup/Value/Math.abs/from-import FalseRefusal # #2277 false-refusal +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeMethodGroup/Value/Math.abs/from-import-as FalseRefusal # #2277 false-refusal +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeMethodGroup/Value/Math.abs/import FalseRefusal # #2277 false-refusal +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeMethodGroup/Value/Math.abs/import-as FalseRefusal # #2277 false-refusal +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeMethodGroup/Value/Math.abs/star-import FalseRefusal # #2277 false-refusal +read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeMethodGroup/Value/Math.abs/type-alias FalseRefusal # #2277 false-refusal read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticField/BitConverter.is_little_endian/from-import Ice # #2432 ice read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticField/BitConverter.is_little_endian/from-import-as Ice # #2432 ice read/constant-kind/ParameterDefault/struct-auto-property/ClrTypeStaticField/BitConverter.is_little_endian/import Ice # #2432 ice From 08eda11e2044a3e6c5cf2ad33d7de2150992d0c7 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Nov 2026 00:20:05 +0000 Subject: [PATCH 21/22] ci: run the scope-meaning sweep in the sweeps job Review finding F9 of PR #2767 and the owner's ruling 27 (#2423 comment 7052893050): "Exclude the sweep from the shard filter and run it in the sweeps job with its own measured hang limit. This PR introduces the test, so it should not merge able to turn shard 1 red for every later PR." Measured on CI @ 5e2156981 (run 44825279604): ScopeMeaning_Sweep is one test that prints nothing for 8 m 24 s in Compiler shard 1, under that step's 10 m hang limit; the shard's job took 22 m 48 s; sweeps-quick took 11 m 12 s (its slowest run with P77 is 19 m 40 s). - COMPILER_MAIN_FILTER excludes `ScopeMeaningDifferential`, as it does its sibling `NameResolutionDifferential`. - sweeps-quick gains the step `Sweep scope-meaning-differential` (`Category=GapDiscovery&FullyQualifiedName~ScopeMeaningDifferential`: the class's 8 tests, its facts with its sweep) with `--blame-hang-timeout 18m`, 2x the measured 8 m 24 s (16 m 48 s). - The job's `timeout-minutes` goes 40 -> 60: 2x (19 m 40 s + the new step, taken as 9 m 15 s) = 57 m 50 s. The step has not run as a step yet, so its first CI run re-measures both numbers. - ci-summary expects `sweep-scope-meaning-differential.trx`. Files the workflow's guards require - CiFilterCoverageConformanceTests.cs: the sweep floor is 8 and the conditioned-step floor 6 (both measured), and the class is pinned among the python-oracle classes. - build_tools/tests/test_ci_gate.py: the ci-summary contract's fixture lists the eighth sweep trx (counts 156 -> 157). Checked locally (lists only): the nine Compiler shards partition the main filter, 52509 = 52509 as multisets, no ScopeMeaning test among them; the new step selects the class's 8 tests. CiFilterCoverage 39/39; pytest build_tools/tests green but the two shallow-clone failures of test_check_review_line.py that predate this branch. Mutation records (each alone: break -> red, restore -> green) - remove the new step -> EverySweep_IsSelectedByExactlyOneStep red ("ScopeMeaning_Sweep: 0 step(s)") and EveryCompilerTest_IsSelectedByAtLeastOneCiStep red. - remove the exclusion from the main filter -> EverySweep_ red ("2 step(s): compiler/Test Compiler ... [shard=1]; sweeps-quick/Sweep scope-meaning-differential"). - remove both -> "Found 7 sweeps (...), expected at least 8"; the old floor of 7 would have passed. - the workflow lists the trx and the fixture has none -> test_counts_every_trx_once_and_leave_out_windows red ("sweep-scope-meaning-differential: no trx"). Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01LGMKZVcFYGqQRfHgd16DLa --- .github/workflows/dotnet10.yml | 40 +++++++++++++++---- build_tools/tests/test_ci_gate.py | 11 ++--- .../CiFilterCoverageConformanceTests.cs | 14 ++++--- 3 files changed, 47 insertions(+), 18 deletions(-) diff --git a/.github/workflows/dotnet10.yml b/.github/workflows/dotnet10.yml index 3ce96f9ce..6f1548d7f 100644 --- a/.github/workflows/dotnet10.yml +++ b/.github/workflows/dotnet10.yml @@ -10,7 +10,8 @@ # ├─ lsp (matrix 1..N) LSP tests, sharded by namespace and sweep twin # ├─ compiler (1..9) the pre-#2178 "Test Compiler" step, sharded by namespace/class # ├─ sweep (matrix 2) one job per long GapDiscovery sweep -# ├─ sweeps-quick the five short GapDiscovery sweeps, one step each +# ├─ sweeps-quick four short GapDiscovery sweeps and the two name-resolution +# │ differentials (P77a, P78's stage 0), one step each # ├─ stdlib-spy-gates .spy native compile + generated-C# staleness gates # └─ shard-partition proves each suite's shards partition its main filter # @@ -42,13 +43,19 @@ # over the 20 mainline push runs before it (42372810738 back to 40623113848; for `compiler`, 2x # the ~11 min projected for the class-split shard 6 at first, and since #2690 the 40 given at the # end of this paragraph), never under 5, in place of the 6-hour -# default; every test run but one (below) has `--blame-hang-timeout 10m`, so a test silent for 10 min aborts the +# default; every test run but two (below) has `--blame-hang-timeout 10m`, so a test silent for 10 min aborts the # run red ("The active test run was aborted") long before the job limit. The longest single test, # NameResolutionDifferential_Sweep, took 372 s in 42372810738; with P77 (#2742) it took 10 m 06 s # and 10 m 29 s (runs 44347230877, 44370550669; dev 6 m 25 s to 8 m 13 s, its last three runs), # so its step alone has `--blame-hang-timeout 22m` and `sweeps-quick` 40, 2x, by the owner's # ruling of 2026-11-18 ("raise then shard after to claw back"; sharding it is #2458's). No dump is taken # (`--blame-hang-dump-type none`): a full one is ~700 MB and nothing uploads it. +# The second such test is ScopeMeaning_Sweep (P78's stage 0, PR #2767): one silent test of 8 m 24 s +# in Compiler shard 1 under the 10 m limit (run 44825279604, where that shard's job took 22 m 48 s +# against its 40). By the owner's ruling of 2026-11-20 (#2423 comment 7052893050, item 27) it runs +# in `sweeps-quick` with `--blame-hang-timeout 18m` (2x is 16 m 48 s), and that job's limit is 60: +# 2x its slowest run with P77 (19 m 40 s) plus this step, taken as 9 m 15 s (the sweep and the +# class's other facts; not yet measured as a step, so the first run with it re-measures both). # Coverage-on runs (COVERAGE_ON below) carry their own limit, 2x their coverage-on duration: the # covered jobs' `timeout-minutes` read the same predicate (`test-fast` 20/15, `lsp` 30/20), set # from local measurement (#2512: Compiler shard 3 +102%); the first coverage-on push re-measures @@ -146,7 +153,10 @@ env: # repetition) and its controls, which must keep running in the shards — a bare # `FullyQualifiedName!~InProcessIsolation` would leave them selected by no step # (CiFilterCoverageConformanceTests). - COMPILER_MAIN_FILTER: "Category!=Benchmark&FullyQualifiedName!~InteropConformance&FullyQualifiedName!~MetamorphicCorpus&FullyQualifiedName!~DifferentialExecution&FullyQualifiedName!~FormatSpecDifferential&FullyQualifiedName!~FormatterEmitInvariance&FullyQualifiedName!~NameResolutionDifferential&(Category!=GapDiscovery|FullyQualifiedName!~InProcessIsolation)" + # The scope-meaning differential (P78's stage 0) is excluded with its sibling, the name-resolution + # differential: its sweep is one test that stays silent for most of a shard's 10 m hang limit + # (see "Hang limits" above), so it has a step and a limit of its own in `sweeps-quick`. + COMPILER_MAIN_FILTER: "Category!=Benchmark&FullyQualifiedName!~InteropConformance&FullyQualifiedName!~MetamorphicCorpus&FullyQualifiedName!~DifferentialExecution&FullyQualifiedName!~FormatSpecDifferential&FullyQualifiedName!~FormatterEmitInvariance&FullyQualifiedName!~NameResolutionDifferential&FullyQualifiedName!~ScopeMeaningDifferential&(Category!=GapDiscovery|FullyQualifiedName!~InProcessIsolation)" # Compiler shard buckets (#2178). Shard n runs COMPILER_MAIN_FILTER&COMPILER_SHARD_. # PARTITION INVARIANT: shards 1–6, 8 and 9 are positive namespace or class buckets (shard 5 # excludes the buckets of shards 4, 6 and 8 by negation); shard 7 is "everything else" @@ -627,7 +637,7 @@ jobs: if-no-files-found: warn sweep: - # The two long GapDiscovery sweeps (~5 min each), one job apiece; the five others share + # The two long GapDiscovery sweeps (~5 min each), one job apiece; the six others share # `sweeps-quick`. Every sweep is excluded from the Compiler shards by name (COMPILER_MAIN_FILTER). name: Sweep (${{ matrix.name }}) needs: build @@ -703,11 +713,14 @@ jobs: # on CI this job took 12 m 16 s, of which that step 7 m 00 s, @ 8c0602b35, run 42332177803, # measured), one step each in one job. Each still writes its own sweep-.trx, and each # reports even if an earlier one failed. With P77 (#2742) the job took 19 m 40 s and 17 m 17 s - # (runs 44347230877, 44370550669), so its limit is 40, 2x (#2458; owner, 2026-11-18). + # (runs 44347230877, 44370550669), so its limit was 40, 2x (#2458; owner, 2026-11-18). With the + # scope-meaning differential's step (P78's stage 0; owner, 2026-11-20, #2423 comment 7052893050 + # item 27) the limit is 60: 2x of 19 m 40 s plus that step, taken as 9 m 15 s from the 8 m 24 s + # its sweep took in Compiler shard 1 (run 44825279604). The job's name is unchanged. name: Sweeps (interop, differential-execution, format-spec, formatter-emit, name-resolution) needs: build runs-on: ubuntu-latest - timeout-minutes: 40 + timeout-minutes: 60 env: # The python oracles below FAIL instead of skipping when no Python 3.12+ interpreter is found: # a skipped sweep guards nothing and the job's other facts would keep it green. Job level, so @@ -801,6 +814,19 @@ jobs: # ci-summary's zero-test check green. if: ${{ !cancelled() && steps.unpack.outcome == 'success' }} run: dotnet test src/Sharpy.Compiler.Tests --no-build --verbosity normal --filter "Category=GapDiscovery&FullyQualifiedName~NameResolutionDifferential" --logger "trx;LogFileName=sweep-name-resolution-differential.trx" --results-directory TestResults --blame-hang-timeout 22m --blame-hang-dump-type none + - name: Sweep scope-meaning-differential + # Scope-meaning differential sweep (P78's stage 0, plan-777361; #2423, #2432). The cells of + # rules N1, N2, N4 and N7 the name-resolution pool has no program for, their verdicts read + # from the same rule table (Conformance/name-resolution-rules.txt): Sharpy `run` against the + # table and, where python3 runs the same program, against python3. Writes + # .claude/tmp/scope-meaning-differential-cells.jsonl and ratchets the reviewed allowlist + # (src/Sharpy.Compiler.Tests/Conformance/scope-meaning-differential-allowlist.txt). The step + # runs the class's facts with its sweep, as the step above does. Excluded from the Compiler + # shards by name (COMPILER_MAIN_FILTER) so it runs exactly once. Its sweep is one test that + # prints nothing for 8 m 24 s on CI (run 44825279604, in Compiler shard 1), so the hang limit + # is 18m, 2x (see "Hang limits" at the top). It FAILS without a suitable python3. + if: ${{ !cancelled() && steps.unpack.outcome == 'success' }} + run: dotnet test src/Sharpy.Compiler.Tests --no-build --verbosity normal --filter "Category=GapDiscovery&FullyQualifiedName~ScopeMeaningDifferential" --logger "trx;LogFileName=sweep-scope-meaning-differential.trx" --results-directory TestResults --blame-hang-timeout 18m --blame-hang-dump-type none - name: Sweep formatter-emit-invariance # Formatter emit-invariance sweep (#2062, #2068). Every executing single-file fixture # P: the Roslyn-normalised C# of Format(P) equals P's with every #line directive line @@ -1082,7 +1108,7 @@ jobs: return sorted(int(k[len(prefix):]) for k in os.environ if k.startswith(prefix)) sweeps = ["interop-conformance", "metamorphic-corpus", "differential-execution", "format-spec-differential", "formatter-emit-invariance", "in-process-isolation", - "name-resolution-differential"] + "name-resolution-differential", "scope-meaning-differential"] expected = (["cli", "core", "stdlib", "windows"] + [f"lsp-shard-{n}" for n in shards("LSP_SHARD_")] + [f"compiler-shard-{n}" for n in shards("COMPILER_SHARD_")] + [f"sweep-{s}" for s in sweeps]) if os.environ.get("CODE") == "false": diff --git a/build_tools/tests/test_ci_gate.py b/build_tools/tests/test_ci_gate.py index 573939e5c..56db1f639 100644 --- a/build_tools/tests/test_ci_gate.py +++ b/build_tools/tests/test_ci_gate.py @@ -553,6 +553,7 @@ class TestCiSummaryContract: "formatter-emit-invariance", "in-process-isolation", "name-resolution-differential", + "scope-meaning-differential", ] def summarize( @@ -598,20 +599,20 @@ def summarize( def test_counts_every_trx_once_and_leave_out_windows(self, tmp_path: Path) -> None: output = self.summarize(tmp_path) assert output.returncode == 0, output.stderr - # 9+20+30+40+50 passed, plus 7 sweeps. Windows' 14 re-run tests the shards already count, + # 9+20+30+40+50 passed, plus 8 sweeps. Windows' 14 re-run tests the shards already count, # and the two per-suite "sum of shards" rows must not count anything a second time. - assert "GATE-COUNTS passed=156 failed=0 skipped=1" in output.stdout + assert "GATE-COUNTS passed=157 failed=0 skipped=1" in output.stdout def test_failed_names_are_printed(self, tmp_path: Path) -> None: output = self.summarize(tmp_path, failed=["Ns.Class.Method"]) - assert "GATE-COUNTS passed=155 failed=1 skipped=1" in output.stdout + assert "GATE-COUNTS passed=156 failed=1 skipped=1" in output.stdout assert "GATE-FAILED Ns.Class.Method" in output.stdout def test_a_windows_failure_is_labelled_because_the_total_omits_it( self, tmp_path: Path ) -> None: output = self.summarize(tmp_path, windows_failed=["Win.Class.Method"]) - assert "GATE-COUNTS passed=156 failed=0 skipped=1" in output.stdout + assert "GATE-COUNTS passed=157 failed=0 skipped=1" in output.stdout assert "GATE-FAILED [windows] Win.Class.Method" in output.stdout def test_only_a_readme_only_run_states_its_scope(self, tmp_path: Path) -> None: @@ -660,7 +661,7 @@ def test_ci_gate_parses_what_ci_summary_really_prints( ) result = rig.gate() assert result.returncode == 1 - assert f"CI GATE RED: 155/1/1 @ {SHA[:9]}" in result.stdout + assert f"CI GATE RED: 156/1/1 @ {SHA[:9]}" in result.stdout failed = [ line for line in result.stdout.splitlines() if line.startswith("FAILED ") ] diff --git a/src/Sharpy.Compiler.Tests/Conformance/CiFilterCoverageConformanceTests.cs b/src/Sharpy.Compiler.Tests/Conformance/CiFilterCoverageConformanceTests.cs index 9ba2a426e..fd4046c3b 100644 --- a/src/Sharpy.Compiler.Tests/Conformance/CiFilterCoverageConformanceTests.cs +++ b/src/Sharpy.Compiler.Tests/Conformance/CiFilterCoverageConformanceTests.cs @@ -107,7 +107,7 @@ public void EverySweep_IsSelectedByExactlyOneStep() /// a required oracle on the runner image's python is a verdict at an unpinned minor. Two judged sets, one rule: /// /// a Compiler.Tests step is judged when its filter selects a class reaching the oracle - /// (, this assembly's call graph). The three sweep classes are pinned, so a scan + /// (, this assembly's call graph). The four sweep classes are pinned, so a scan /// that misses a direct caller is red, and so are two classes it must not name: one reads a repo file through /// and one calls the other gate, TestPreconditions.RequireOrSkip; /// another test project's assembly is not loaded here, so it is judged per project: when its sources call a @@ -127,6 +127,7 @@ public void EveryPythonOracleTest_RunsWithTheOracleRequired() Assert.Contains("Sharpy.Compiler.Tests.Properties.Differential.DifferentialExecutionTests", oracleClasses); Assert.Contains("Sharpy.Compiler.Tests.Properties.Differential.FormatSpecDifferentialTests", oracleClasses); Assert.Contains("Sharpy.Compiler.Tests.Conformance.NameResolutionDifferentialTests", oracleClasses); + Assert.Contains("Sharpy.Compiler.Tests.Conformance.ScopeMeaningDifferentialTests", oracleClasses); Assert.DoesNotContain("Sharpy.Compiler.Tests.Conformance.PythonOracleSkipCensusTests", oracleClasses); Assert.DoesNotContain("Sharpy.Compiler.Tests.RuntimeClosureResolverTests", oracleClasses); @@ -353,9 +354,10 @@ public void Evaluator_ResolvesMatrixAndEnv_AndRefusesWhatItCannotRead() return (steps, ReflectTests()); } - /// The seven sweeps COMPILER_MAIN_FILTER excludes today (measured). A literal, so that a shrinking - /// universe is red rather than a smaller check. - private const int MinimumSweeps = 7; + /// The eight sweeps COMPILER_MAIN_FILTER excludes today (measured; the eighth is the scope-meaning + /// differential, whose one silent test must not run under a shard's hang limit: #2423 comment 7052893050, item 27). A + /// literal, so that a shrinking universe is red rather than a smaller check. + private const int MinimumSweeps = 8; /// Just below the 84 test methods measured when this fact was written, exemptions aside. A literal, so that /// sweep names matching nothing are red. @@ -368,9 +370,9 @@ public void Evaluator_ResolvesMatrixAndEnv_AndRefusesWhatItCannotRead() /// written. A literal, so that a step list this fact stopped judging is red. private const int MinimumJudgedSteps = 10; - /// The five steps of sweeps-quick carry a step-level if: today (measured). A literal, so that a + /// The six steps of sweeps-quick carry a step-level if: today (measured). A literal, so that a /// parser reading no if: is red. - private const int MinimumConditionedSteps = 5; + private const int MinimumConditionedSteps = 6; /// The closed set of if: a judged step or job may carry: the one spelling on them today. It runs the /// step whenever the job is not cancelled and its build output unpacked, so an earlier sweep's red does not skip it. From 6344e5845f2739d14c0cd5dce46165174dc92e41 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Nov 2026 00:20:31 +0000 Subject: [PATCH 22/22] process(plan): plan-777361 (P78) fix round after the independent review The plan follows what the fix round moved in stage 0 (abec1a341 and 08eda11e2; owner rulings 26-29, #2423 comment 7052893050). No design decision's predicate changes and no verify pass is recorded; the text stays an unstamped draft. Added - Generator: 1612 known-red rows, 637 / 766 / 150 / 17 / 42 citing #2423 / #2432 / #2417 / #2147 / #2277; 40 exclusions probed; ruling 26's exclusions (third-type and `G[int]` readers, four callee binders, an arrow-lambda host); an interface's members, not only its statics. - Owner rulings: comments 7051706467 (23-25) and 7052893050 (26-29). - Neighbours: #2277 (ruling 29's rows) and #2772 (ruling 28's interim). - Revision log: one line @ 5e2156981. - The three shas that say where stage 0 stands: 08eda11e2. Cut, to stay under the body cap (20,478 of 20,480 bytes) - Generator: the fact's name (`Axes_EveryValueIsGeneratedOrExcluded`), "of them" and ", one in a child process". - Generator, closed by decision: "a reader nested in or beside the member's type (the 8951 pool's)", which the review showed false (it is now an exclusion with a reason and probes); "(owner, comment 7050154806)" became "(ruling 22)". - Generator, excluded: "a self-reaching alias an annotation names (#2769)", which Out of contract and D10 still state. - D9: "; S0b's R-QI cells, which admit none today, admit SPY0620": stage 0 names the code since abec1a341, so T8 has no edit there. check_plan_refs.py: RESULT: OK. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01LGMKZVcFYGqQRfHgd16DLa --- docs/process/plans/plan-777361.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/process/plans/plan-777361.md b/docs/process/plans/plan-777361.md index d33dd9564..93a21c2cd 100644 --- a/docs/process/plans/plan-777361.md +++ b/docs/process/plans/plan-777361.md @@ -1,4 +1,4 @@ - + # P78 — N1/N2/N4/N7: scope decides meaning @@ -8,7 +8,7 @@ Rules N1, N2, N4 and N7 of `docs/design/name-resolution.md` (charter §3.20l): # ## Current State -`sharpyc run` @ aa6d84462 (code e24aaf9f0); python 3.15.2. The known-red rows are the state. By class: order and kind; untyped reads and bodies (#2398); constant positions (#2432); R-QI (module `x: T` reads `0`). +`sharpyc run` @ 08eda11e2 (code e24aaf9f0); python 3.15.2. The known-red rows are the state. By class: order and kind; untyped reads and bodies (#2398); constant positions (#2432); R-QI (module `x: T` reads `0`). ## Scope @@ -29,8 +29,8 @@ Rules N1, N2, N4 and N7 of `docs/design/name-resolution.md` (charter §3.20l): # - **Sibling cells this plan must also cover:** none; see Generator. - **Lane / reach:** false-refusal + silent-wrong + ice · program; **fidelity-scope row:** "which programs run vs. are refused" and "value of an expression", both COMPARED. - **Standing harness that should have caught it:** `NameResolutionDifferentialTests`; `ClassBodyReadPositionMatrixTests` is the hand control (R-KF; A6). -- **Generator:** stage 0 (§2.1) @ aa6d84462. `name-resolution-rules.txt` (S0a, #2487): one row per cell of both pools and a cell per row. `NameResolutionDifferentialTests`: 8951 cases, 2368 known-red rows. `ScopeMeaningDifferentialTests` (S0b): 4963 cases, 1570 known-red rows (637 / 766 / 150 / 17 cite #2423 / #2432 / #2417 / #2147), verdicts read from the rows. Each S0b axis is an image, every value generated or excluded with a reason, 32 of them probed, one in a child process (`Axes_EveryValueIsGeneratedOrExcluded`). Hand lists, each a decision: one host program per reader, one or two members per kind, one outer binding per sibling form, one value per declared type, one call per lambda spelling, the census's namespace (`System`). Closed by decision: the chain pair (call 45), the five other `Scope*` enums, one call site per callee cell (D5's census), a reader nested in or beside the member's type (the 8951 pool's), a constant position's hosts (owner, comment 7050154806). Excluded: the project route (A3, A14), message text, a self-reaching alias an annotation names (#2769), an interface's statics (#2383, #2111), an int enum's `.value` / `.name` through an alias, a lambda's dotted annotation, its default when stored or in a property default, `char` as a receiver. Green by D1–D7, D10 (A1, A2, A4–A7, A13), D8 (A9). -- **Owner rulings:** R-KD, R-KF, R-KG, R-KJ, R-KV, R-LJ, R-LO, R-PM, R-QE, R-QI (charter §4); #2432's call-43 and call-45 cells (§3.20l); owner 2026-11-20, #2423 comments 7030074628 (1–4), 7039834146 (5–6), 7042723494 (7–9), 7045166298 (10), 7046304965 (12–13), 7049561049 (17, 19–20), 7050154806 (22). +- **Generator:** stage 0 (§2.1) @ 08eda11e2. `name-resolution-rules.txt` (S0a, #2487): one row per cell of both pools and a cell per row. `NameResolutionDifferentialTests`: 8951 cases, 2368 known-red rows. `ScopeMeaningDifferentialTests` (S0b): 4963 cases, 1612 known-red rows (637 / 766 / 150 / 17 / 42 cite #2423 / #2432 / #2417 / #2147 / #2277), verdicts read from the rows. Each S0b axis is an image, every value generated or excluded with a reason, 40 probed. Hand lists, each a decision: one host program per reader, one or two members per kind, one outer binding per sibling form, one value per declared type, one call per lambda spelling, the census's namespace (`System`). Closed by decision: the chain pair (call 45), the five other `Scope*` enums, one call site per callee cell (D5's census), a constant position's hosts (ruling 22). Excluded: the project route (A3, A14), message text, an interface's members (#2383, #2111), an int enum's `.value` / `.name` through an alias, a lambda's dotted annotation, its default when stored or in a property default, `char` as a receiver; ruling 26: third-type and `G[int]` readers, four callee binders, an arrow-lambda host. Green by D1–D7, D10 (A1, A2, A4–A7, A13), D8 (A9). +- **Owner rulings:** R-KD, R-KF, R-KG, R-KJ, R-KV, R-LJ, R-LO, R-PM, R-QE, R-QI (charter §4); #2432's call-43 and call-45 cells (§3.20l); owner 2026-11-20, #2423 comments 7030074628 (1–4), 7039834146 (5–6), 7042723494 (7–9), 7045166298 (10), 7046304965 (12–13), 7049561049 (17, 19–20), 7050154806 (22), 7051706467 (23–25), 7052893050 (26–29). ## Adversarial Review (pre-mortem) @@ -52,7 +52,7 @@ No rule below reads a builtin or type name; a rung applies only in D8. - **D6 (N2 at module level; R-LJ).** A read evaluated at load — a module-level or class-level initializer or default, never a function body — of a builtin name its module declares at or after the reader is SPY0619. An import its module redeclares stays SPY0204 at the declaration. - **D7 (R-QI).** A module variable, a `@static` field, and a module or `@static` auto-property with no initializer is SPY0620 at its declaration, whatever its type and host; the steer names `x: T = ` and `x: T | None = None`. Untouched: an instance field, a local `x: T`, a property with accessor bodies. - **D8 (#2432; Semantic, Validation, CodeGen).** One answer per name the checker bound, for the identifier and member hooks, under every spelling (N7). True: a `const` whose fact is true; an int enum's member and its `.value`; and — rung 3: a referenced assembly's constant has no Sharpy symbol — a field of a referenced type or module that C# reads as a constant (a module's by discovery's `IsConst`; a type's or enum's by `FieldInfo.IsLiteral` or, except at an attribute argument, `DecimalConstantAttribute`, through `ClrTypeHelper`). False: every other bound name (a `@static` member, own or inherited; a module variable, property or function; a string enum's member, any `.name`; a CLR static that is no such constant). The shape rule keeps only what the checker did not bind. Every `IsAdmitted` call passes the answer: a `const` handed a non-constant is a computed constant, never C#'s `const`; a struct auto-property is a constructor parameter only for a constant (`MarkStructConstructorProperty`) and otherwise keeps its initializer and runs; the validator judges an enum member's value (a new `AdmissionTable` row), pushes interface and union hosts on `_enclosingTypes`, and refuses an attribute argument under SPY0425, each argument first checked by the checker as an expression in the scope its declaration stands in (a member's attribute in its type's body, so D3 and D4 decide its bare names) and printed by `GenerateAttributeArgumentExpression`'s ordinary read route. A `ComparisonChain` is admitted when each link is. Predicate: in contract, no expression reaches C# as a non-constant in a constant position, and no constant admitted today is refused. -- **D9 (codes).** SPY0619 (N2; the text carries both readings and the qualified spelling) and SPY0620 (R-QI); SPY0618 retires. T8 edits, in one commit, the table's rows, the `Expect*` arms that mirror them and `AdmittedRefusals`: D3's N2 cells leave `kind:instance-at-initializer` and `SPY0401`, N2 admits SPY0619 alone, N2-module SPY0619 and SPY0204, `kind:enum-member-constant` SPY0401, `N1-arity` names its code; S0b's R-QI cells, which admit none today, admit SPY0620. +- **D9 (codes).** SPY0619 (N2; the text carries both readings and the qualified spelling) and SPY0620 (R-QI); SPY0618 retires. T8 edits, in one commit, the table's rows, the `Expect*` arms that mirror them and `AdmittedRefusals`: D3's N2 cells leave `kind:instance-at-initializer` and `SPY0401`, N2 admits SPY0619 alone, N2-module SPY0619 and SPY0204, `kind:enum-member-constant` SPY0401, `N1-arity` names its code. - **D10 (an alias names a type that exists; owner).** An alias whose target names a missing type — as the name itself, inside a wrapper, type argument or callable, dotted, or in a generic alias's body — is SPY0202 at the alias, at every site (module, type body, function, block), named or not: both binders resolve the target where the alias is declared, expanding none that reaches its own alias (#2769, unruled: unused, it still runs). Predicate: no declared alias's target names a missing type. - **Out of contract:** a read above a same-scope local (P80); a store without `global` (P79); a walrus over `let` (P21b); `ALSO = RED` (#2069); a receiver read untyped at either order (#2417); `self.x` of a `const` (#2147); a self-reaching alias named by an annotation (#2769); the #2397 rows; `T !E` above its `E` (#2249); `from m import x` as a live alias (N6); a `delegate`'s default, a signature-only interface method's, attributes not on a class's method, a union's attribute arguments (#2779; ruling 22). @@ -128,7 +128,7 @@ No rule below reads a builtin or type name; a rung applies only in D8. - #2427 (the principle), #2457 (the harness's residue) - #2486 — the rule tables; #2487 stays open: ruling 6 lists its remainder -- #2397, #2417, #2069, #2147, #2249, #2383, #2768, #2769, #2779 — neighbours +- #2397, #2417, #2069, #2147, #2249, #2277, #2383, #2768, #2769, #2772, #2779 — neighbours ## Revision log @@ -137,3 +137,4 @@ No rule below reads a builtin or type name; a rung applies only in D8. - @ 656991807 — revised after the 2nd pass (NEEDS REVISION, Dimension 6): member kinds, the reader census; D8 per bound name. Deferred (owner): D10's module-level judgement ← the pipeline order — fix: judge the target once every type and import is declared — proved by the `dotted` and `Later` must-run cells. - @ 56dbb009f — revised after the 3rd pass (NEEDS REVISION, Dimension 6): stage 0: spelling and placement, module functions, probes; D8's attribute scope; A14. - @ 73c785856 — revised after the 4th pass (NEEDS REVISION, Dimension 4 and 6): stage 0 with D8's decimal constant and D4's lambda default; builtin names; ruling 6 (findings 1, 3–5). Finding 2 left the plan by the owner's decision (#2423 comment 7050154806): #2779. +- @ 5e2156981 — fix round after the independent review (rulings 26–29); D9's S0b clause cut (in stage 0).