Skip to content

More precise types for fields of OverlappingInstances and UnsafeOverlap in TcSolverReportMsg

Bodigrim requested to merge Bodigrim/ghc:t22185/avoid-head-and-tail into master

It's clear from asserts in GHC.Tc.Errors that overlappingInstances_matches and unsafeOverlapped are supposed to be non-empty, and unsafeOverlap_matches contains a single instance, but these invariants are immediately lost afterwards and not encoded in types. This patch enforces the invariants by pattern matching and makes types more precise, avoiding asserts and partial functions such as head.

Another step towards #22185 (closed).

Merge request reports