
#15796: Core Lint error with invalid newtype declaration -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: Compiler (Type | Version: 8.6.1 checker) | Resolution: | Keywords: TypeFamilies Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): I'm pretty sure I know what's happening: * The newtype declaration is bogus. It kind-checks, but then fails the validity check. * If a declaration fails a validity check, we manufacture a "recovery tycon", which is a `TcTyCon`. See `Note [Recover from validity error]` in TcTyClsDecls. * When we create a type family instance, we (optionally) do a quick core- lint check on it, as there's no other time we ever do so. * Core lint falls over when it sees a `TcTyCon`, which should never make it past the type checker. I don't want to remove this last check. And I don't want to abolish recovery tycons, as they produce nice error messages. Maybe we tell core- lint (in a new parameter) that it's being called in the type checker? Maybe we skip this check if there are errors? Yes, that seems sensible. Patch incoming. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15796#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler