Skip to content
Snippets Groups Projects
Commit 8d8743ae authored by Simon Peyton Jones's avatar Simon Peyton Jones Committed by Ian Lynagh
Browse files

Use the right environment for tidying the types of a data constructor

Fixes Trac #7438
parent c41ca798
No related branches found
No related tags found
No related merge requests found
...@@ -1508,16 +1508,19 @@ tyConToIfaceDecl env tycon ...@@ -1508,16 +1508,19 @@ tyConToIfaceDecl env tycon
ifConUnivTvs = toIfaceTvBndrs univ_tvs', ifConUnivTvs = toIfaceTvBndrs univ_tvs',
ifConExTvs = toIfaceTvBndrs ex_tvs', ifConExTvs = toIfaceTvBndrs ex_tvs',
ifConEqSpec = to_eq_spec eq_spec, ifConEqSpec = to_eq_spec eq_spec,
ifConCtxt = tidyToIfaceContext env3 theta, ifConCtxt = tidyToIfaceContext env2 theta,
ifConArgTys = map (tidyToIfaceType env3) arg_tys, ifConArgTys = map (tidyToIfaceType env2) arg_tys,
ifConFields = map getOccName ifConFields = map getOccName
(dataConFieldLabels data_con), (dataConFieldLabels data_con),
ifConStricts = dataConStrictMarks data_con } ifConStricts = dataConStrictMarks data_con }
where where
(univ_tvs, ex_tvs, eq_spec, theta, arg_tys, _) = dataConFullSig data_con (univ_tvs, ex_tvs, eq_spec, theta, arg_tys, _) = dataConFullSig data_con
(env2, univ_tvs') = tidyTyClTyVarBndrs env1 univ_tvs
(env3, ex_tvs') = tidyTyVarBndrs env2 ex_tvs -- Start with 'emptyTidyEnv' not 'env1', because the type of the
to_eq_spec spec = [ (getOccName (tidyTyVar env3 tv), tidyToIfaceType env3 ty) -- data constructor is fully standalone
(env1, univ_tvs') = tidyTyVarBndrs emptyTidyEnv univ_tvs
(env2, ex_tvs') = tidyTyVarBndrs env1 ex_tvs
to_eq_spec spec = [ (getOccName (tidyTyVar env2 tv), tidyToIfaceType env2 ty)
| (tv,ty) <- spec] | (tv,ty) <- spec]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment