Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

skip constructor: substUnfolding #131

Open
sweirich opened this issue Jun 27, 2019 · 0 comments
Open

skip constructor: substUnfolding #131

sweirich opened this issue Jun 27, 2019 · 0 comments
Assignees

Comments

@sweirich
Copy link
Collaborator

Processing this code fails when DFunUnfolding and CoreUnfolding constructors are skipped
(working around by redefining the function).

substUnfolding subst df@(DFunUnfolding { df_bndrs = bndrs, df_args = args })
  = df { df_bndrs = bndrs', df_args = args' }
  where
    (subst',bndrs') = substBndrs subst bndrs
    args'           = map (substExpr (text "subst-unf:dfun") subst') args

substUnfolding subst unf@(CoreUnfolding { uf_tmpl = tmpl, uf_src = src })
        -- Retain an InlineRule!
  | not (isStableSource src)  -- Zap an unstable unfolding, to save substitution work
  = NoUnfolding
  | otherwise                 -- But keep a stable one!
  = seqExpr new_tmpl `seq`
    unf { uf_tmpl = new_tmpl }
  where
    new_tmpl = substExpr (text "subst-unf") subst tmpl

substUnfolding _ unf = unf      -- NoUnfolding, OtherCon

The error message is

invalid record update with non-record-fields `Core.df_args' and `Core.df_bndrs' unsupported [in definition CoreSubst.substUnfolding in module CoreSubst]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants