
#15986: Poor error message source location reporting with unsaturated type family -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.6.2 Resolution: | Keywords: TypeFamilies, | TypeErrors Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): Now that I think about this some more, I'm less confident in my declaration that "I know GHC can do better here". That's because the two error messages that I pointed out in the original comments actually come from two entirely different compilation passes. The latter error message (`Expecting one more argument to ‘F’`) arises during typechecking, which works over source code—that is, where everything has a `SrcSpan` attached. The former error message (`The type family ‘F’ should have 1 argument`), however, arises //after// typechecking (during some //post hoc// validity checks in `TcValidity`) when we only have `Type`s floating around. The problem is that `Type`s don't have `SrcSpan`s attached to all of their subcomponents like `HsType GhcRn`s do, so it's harder to tell where to report errors during validity checking. Perhaps this is a sign that this bug can't reasonably be fixed until #15479 is implemented (i.e., when typechecking returns `HsType GhcTc` instead of `Type`). Unless someone can see a better path forward here? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15986#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler