Skip to content

Draft: isUnliftedHsBind: don't panic on rep-poly binders

sheaf requested to merge sheaf/ghc:T24357 into master

We shouldn't panic on binders which have an unknown runtime representation in GHC.Hs.Utils.isUnliftedHsBind, as such binders might well arise while typechecking a module which is not fully instantiated (in the sense of Backpack), as in T24357.

Similarly for GHC.Core.Utils.needsCaseBindingL, which should handle unknown representations in the same way as definitely-unlifted representations.

Example:

unit p where
  signature S where
    import GHC.Exts
    data R :: RuntimeRep
    data E :: TYPE R
    foo :: E -> E
  module M where
    import S
    bar :: E -> E
    bar x = let y = foo x in y

Here, we should not panic when we see the let-bound y which has an as-yet unknown representation. Note that we are only going to typecheck this module (because it is not fully instantiated in the sense of Backpack); we can't generate code for it until we know the representation!

Edited by sheaf

Merge request reports