
#13738: TypeApplications-related GHC internal error -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: RyanGlScott Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: | TypeApplications Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #13985 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): Ugh. Trying to change anything involving `bindLHsTyVarBndr` is proving to be a massive headache. There are numerous complications here that I'm not sure how to deal with: * Using `rnImplicitBinders` simply won't work in `bindHsQTyVars`. `rnImplicitBinders` expects an `LHsType GhcPs` as an argument, which `bindHsQTyVars` doesn't have. * Even if we did somehow pass an `LHsType GhcPs` to `rnImplicitBndrs` from `bindHsQTyVars`, I'm not convinced it would do the right thing. The problem: the `kv_bndrs` from `bindHsQTyVars` need to be bound using `newTyVarNameRn mb_assoc` (since the `kv_bndrs` might be from an associated class), but `rnImplicitBndrs` does nothing of the sort. * `bindLHsTyVarBndr` performs a validity check ([http://git.haskell.org/ghc.git/blob/7463a95dbe53d789f8f245f26735a7ac74bb6e11... here]) to ensure that a list of tyvar binders is well scoped (i.e., reject something like `forall (a :: k) k.`). But we can only perform this check because `bindLHsTyVarBndrs` keeps track of the kind variables that are implicitly bound so far, one by one, and communicates this information to each call to `bindLHsTyVarBndr` so that it can check if a binder is in the set of implicitly bound kind variables. If we removed `bindLHsTyVarBndr`'s ability to implicitly bind kind variables, I'm not sure how we'd perform this check at all. * Could we move this error check to `rnImplicitBndrs`? Perhaps, but then we'd need to migrate the code which tracks one-by-one all of the implicitly bound kind variables so far. That doesn't sound fun. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13738#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler