Skip to content

Add the missing class and instance checks (M5 codes without a checker kind) #97

Closed

Description

@biuld

Part of #77 (Phase 4). The M5 codes that have no corresponding checker kind at all — new checks, not new mappings. 30 corpus cases.

Code Cases Needs
InvalidInstanceHead 7 Validate the instance head against the class: constructor head vs. type variable head, the newtype-constructor special case.
OrphanInstance 7 Reject an instance whose class is not in scope, or whose type is defined elsewhere. Needs a rule that composes with OrphanTypeDeclaration, which is already reported.
InvalidNewtypeInstance 6 Coercible/Coerce instance validity — adjacent to FE-16's role checking, which is already in place.
ClassInstanceArityMismatch 4 Compare the instance head's argument count against the class's.
CycleInTypeClassDeclaration 2 Class-member and superclass cycles.
MissingClassMember 2 Maps from the existing MissingInstanceMethod kind.
PossiblyInfiniteInstance 1 Head-recursive use of the instance being solved.
DuplicateTypeClass 1 Two classes with one name.
DuplicateInstance 1 Two instances for the same head.

Prerequisites

DuplicateInstance and DuplicateTypeClass are resolver work, not typechecker work — they belong with #90, which takes instances into the resolver. Do them there or coordinate explicitly, or they will be solved twice.

Acceptance

All 30 cases agree on the L5 scoreboard from #82.

Activity

  1. added
    gate:L4Blocks core type checking (D-04 L4)
    gate:L5Blocks type classes and instances (D-04 L5)
    area:frontendFrontend: syntax, resolution, kinds, types, classes
    on Oct 1, 2026
  2. biuld commented on Oct 16, 2026

    @biuld
    OwnerAuthor

    The 2026-10-17 L5 board is 77/97. Of the codes this issue lists, these now agree: InvalidNewtypeInstance 6/6, ClassInstanceArityMismatch 4/4, DuplicateInstance 1/1, MissingClassMember 2/2.

    Still open: InvalidInstanceHead 6 (1/7), OrphanInstance 7 (0/7), PossiblyInfiniteInstance 1 (0/1), DuplicateTypeClass 1 (0/1). Corpus cases moves from 30 to 15. CycleInTypeClassDeclaration is not in the current L5 per-code table, so it is not part of the 15.

    Evidence: the L5 row in docs/design/D-04-suite-roadmap.md (2026-10-17, 886cd82c, annotations oracle).

  3. biuld commented on Oct 18, 2026

    @biuld
    OwnerAuthor

    All codes this issue owns agree on the L5 board, remeasured 2026-10-18 on master (annotations oracle, vendored corpus, package e556bf2f): 98/99, denominator 97 → 99 after the two superclass-cycle cases left the blocked rows.

    • InvalidInstanceHead 7/7 — the determined-head rule at the common instance recorder (4a078b95), one rule covering the wildcard, free-variable-through-synonym (TypeSynonyms7), derived-head (3510, InvalidDerivedInstance2), and fundep-undetermined (RowInInstanceNotDetermined0/1/2) triggers; official covering-set minimalization (9a4c2e04).
    • OrphanInstance 7/7 — the official orphan rule (298cc585); 3405.purs's produced set is exactly [OrphanInstance].
    • PossiblyInfiniteInstance 1/1 (438.purs), CycleInTypeClassDeclaration 2/2 (Superclasses2, SelfCycleInTypeClassDeclaration) — 4a078b95.
    • DuplicateTypeClass 1/1 — resolver-side distinction from DeclConflict (fd7bf88a), with DeclConflict staying 11/11 and DuplicateInstance 1/1.
    • Already-agreeing InvalidNewtypeInstance 6/6, ClassInstanceArityMismatch 4/4, MissingClassMember 2/2, DuplicateInstance 1/1, CannotDeriveInvalidConstructorArg 7/7 unchanged.

    The only remaining L5 mismatch is ClassHeadNoVTA3.purs, which is #123's visible-type-application limit, not a code this issue owns. Boards: L2 72/72 + 403/413 passing, L3 44/48, L4 41/50, L6/M7 287/340 (serial rerun, same failure set; recorded in D-04 and the runtime-program scoreboard). The Project board field updates for this item still need the project scope on the gh token.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:frontendFrontend: syntax, resolution, kinds, types, classesenhancementNew feature or requestgate:L4Blocks core type checking (D-04 L4)gate:L5Blocks type classes and instances (D-04 L5)

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions