Commit f7daf5af authored by Christiaan Baaij's avatar Christiaan Baaij Committed by Austin Seipp

Normalise type families in the type of an expression

Before, the type of an expression, and the type of a variable
binding that expression used to be different in GHCi. The
reason being that types of bound variables were already normalised.
Now, both are normalised.

This implements the suggestions as given in Trac #10321
Also adds an expected output for test T10321

Reviewed By: goldfire, simonpj

Differential Revision: https://phabricator.haskell.org/D870

GHC Trac Issues: #10321
parent 341a7664
......@@ -1777,7 +1777,15 @@ tcRnExpr hsc_env rdr_expr
_ <- simplifyInteractive (andWC stWC lie_top) ;
let { all_expr_ty = mkForAllTys qtvs (mkPiTypes dicts res_ty) } ;
zonkTcType all_expr_ty
ty <- zonkTcType all_expr_ty ;
-- We normalise type families, so that the type of an expression is the
-- same as of a bound expression (TcBinds.mkInferredPolyId). See Trac
-- #10321 for further discussion.
fam_envs <- tcGetFamInstEnvs ;
-- normaliseType returns a coercion which we discard, so the Role is
-- irrelevant
return (snd (normaliseType fam_envs Nominal ty))
}
--------------------------
......
3 :> 4 :> 5 :> Nil :: Num a => Vec 3 a
......@@ -210,4 +210,4 @@ test('T10122', normal, ghci_script, ['T10122.script'])
test('T10322', when(opsys('darwin'), expect_broken(10322)),
ghci_script, ['T10322.script'])
test('T10321', expect_broken(10321), ghci_script, ['T10321.script'])
test('T10321', normal, ghci_script, ['T10321.script'])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment