You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Resolve instance declarations and instance signatures #90
Part of #75 (Phase 2). Instance declarations are not part of resolution, which costs two M2 failing cases and blocks the library work in Phase 3.
Failing cases
File
Expected
Why
failing/881.purs
DuplicateValueDeclaration
Two foo definitions in one instance; we report nothing.
failing/InstanceSigsOrphanTypeDeclaration.purs
OrphanTypeDeclaration
A type declared in an instance signature; we report nothing.
Why this is on the critical path
Phase 3's Prelude needs Eq, Ord, Functor, Apply, Applicative, Foldable, Semigroup, Monoidas classes with instances. The class and instance elaboration is done (#63, closed; commits 7b39ca8, c983b32, 814e04b, fe82bb0, and I verified a class + superclass + instance program runs under Wasmtime with the superclass-projected method). What is missing is instances in the resolver: duplicate member detection, instance signatures participating in orphan checks, and instance names in the module namespace.
Scope
Instance declarations lower into AST and HIR and enter the resolver.
Instance member names join the value namespace for duplicate detection (DuplicateValueDeclaration).
Instance signatures are checked for orphan types (OrphanTypeDeclaration).
Instance names participate in module-level name conflicts.
Export/import of classes carries instance visibility consistently.
Do not narrow this to the two failing cases: the resolver must model instances the way it models classes, or Phase 3 will build the library on a partial model.
Acceptance
Both cases agree, instances resolve across modules, and stdlib can declare classes with instances.
Closed by #117 (merge commit 0c7544d), two commits: 98e46e0 attributes every program diagnostic to a named DiagnosticOrigin, cb52868 resolves instance declarations and instance signatures.
Evidence, re-measured on the merged tree with the annotations oracle against the vendored v0.15.16 corpus:
M2 failing agreement 72/72, up from 70/72. The two cases this issue names now agree: failing/881.purs (DuplicateValueDeclaration) and failing/InstanceSigsOrphanTypeDeclaration.purs (OrphanTypeDeclaration).
passing resolution 59/413, unchanged, with 354 first-stage blockers: 337 missing library modules, 8 at P3, 5 at P2, 4 at P0, none on assembly.
L4 17/38 (was 16/40) and L5 45/87 (was 45/89), with 33 cases blocked before the type checker against 29. These are case reclassifications rather than new type-checking evidence; D-04 names each case that moved.
L1 904/908, L3 29/48, and the L6/M7 runtime board are unchanged.
The scoreboard numbers were not trustworthy until diagnostic attribution was fixed, so the first commit repairs it before the second re-measures. Two defects, both confirmed by tests that fail without the fix: a lenient pass enumerated the modules that survived resolution and used that position as the source index, so a diagnostic landed on whichever module took the failing module's slot and an imported instance was looked up in the importing module's own slot; and the trusted library prefix was subtracted with saturation, mapping every library diagnostic and every module-less backend diagnostic onto the caller's first source. DiagnosticOrigin now names a caller source, the library, and the program as a whole. That commit is scoreboard-neutral against master: the full board output is byte-identical.
Corpus cases stays 2, the two failing cases this issue recovers, one per errorCode; no passing count moved.
Validation: cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings, cargo test --workspace (1126 passed, 0 failed), PSRS_REQUIRE_WASMTIME=1 cargo test --workspace (1126 passed, 0 failed, 5 ignored, Wasmtime 49.0.1), PURESCRIPT_REPO=… cargo test -p psrs-driver --test upstream (4 passed), full scoreboards run twice with identical output, and both required Wasmtime CI checks.
Activity
biuld commentedon Oct 2, 2026
Closed by #117 (merge commit
0c7544d), two commits:98e46e0attributes every program diagnostic to a namedDiagnosticOrigin,cb52868resolves instance declarations and instance signatures.Evidence, re-measured on the merged tree with the annotations oracle against the vendored v0.15.16 corpus:
failing/881.purs(DuplicateValueDeclaration) andfailing/InstanceSigsOrphanTypeDeclaration.purs(OrphanTypeDeclaration).passingresolution 59/413, unchanged, with 354 first-stage blockers: 337 missing library modules, 8 at P3, 5 at P2, 4 at P0, none on assembly.The scoreboard numbers were not trustworthy until diagnostic attribution was fixed, so the first commit repairs it before the second re-measures. Two defects, both confirmed by tests that fail without the fix: a lenient pass enumerated the modules that survived resolution and used that position as the source index, so a diagnostic landed on whichever module took the failing module's slot and an imported instance was looked up in the importing module's own slot; and the trusted library prefix was subtracted with saturation, mapping every library diagnostic and every module-less backend diagnostic onto the caller's first source.
DiagnosticOriginnow names a caller source, the library, and the program as a whole. That commit is scoreboard-neutral againstmaster: the full board output is byte-identical.Corpus casesstays 2, the twofailingcases this issue recovers, one pererrorCode; nopassingcount moved.Validation:
cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace(1126 passed, 0 failed),PSRS_REQUIRE_WASMTIME=1 cargo test --workspace(1126 passed, 0 failed, 5 ignored, Wasmtime 49.0.1),PURESCRIPT_REPO=… cargo test -p psrs-driver --test upstream(4 passed), full scoreboards run twice with identical output, and both required Wasmtime CI checks.