diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2016-06-03 22:19:17 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-06-04 09:35:49 +0200 |
commit | 4aa299db6b1025822673713a110b17c002ddcfaf (patch) | |
tree | 94d80515a66e487addd3a976a8c9c4d9f7ae9a98 | |
parent | 02f893eb4fe3f75f0a9dc7e723568f4c75de5785 (diff) | |
download | haskell-4aa299db6b1025822673713a110b17c002ddcfaf.tar.gz |
PrelInfo: Ensure that tuple promoted datacon names are in knownKeyNames
Previously the promoted datacons of the boxed tuple types were not
included in knownKeyNames, which lead to #12132.
Test Plan: Test with included TypeOf testcase
Reviewers: austin, simonpj
Reviewed By: simonpj
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2279
GHC Trac Issues: #12132
-rw-r--r-- | compiler/iface/LoadIface.hs | 2 | ||||
-rw-r--r-- | compiler/prelude/PrelInfo.hs | 7 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_run/TypeOf.hs | 1 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_run/TypeOf.stdout | 1 |
4 files changed, 7 insertions, 4 deletions
diff --git a/compiler/iface/LoadIface.hs b/compiler/iface/LoadIface.hs index 64d100f1ed..ba58c9e456 100644 --- a/compiler/iface/LoadIface.hs +++ b/compiler/iface/LoadIface.hs @@ -169,7 +169,7 @@ for any module with an instance decl or RULE that we might want. * BUT, if the TyCon is a wired-in TyCon, we don't really need its interface; but we must make sure we read its interface in case it has instances or - rules. That is what LoadIface.loadWiredInHomeInterface does. It's called + rules. That is what LoadIface.loadWiredInHomeIface does. It's called from TcIface.{tcImportDecl, checkWiredInTyCon, ifCheckWiredInThing} * HOWEVER, only do this for TyCons. There are no wired-in Classes. There diff --git a/compiler/prelude/PrelInfo.hs b/compiler/prelude/PrelInfo.hs index 74005ed59c..52493b40f5 100644 --- a/compiler/prelude/PrelInfo.hs +++ b/compiler/prelude/PrelInfo.hs @@ -85,19 +85,20 @@ knownKeyNames , concatMap tycon_kk_names typeNatTyCons - , concatMap (rep_names . tupleTyCon Boxed) [2..mAX_TUPLE_SIZE] -- Yuk + , concatMap (tycon_kk_names . tupleTyCon Boxed) [2..mAX_TUPLE_SIZE] -- Yuk , cTupleTyConNames -- Constraint tuples are known-key but not wired-in -- They can't show up in source code, but can appear - -- in intreface files + -- in interface files , map idName wiredInIds , map (idName . primOpId) allThePrimOps , basicKnownKeyNames ] where - -- "kk" short for "known-key" + -- All of the names associated with a known-key thing. + -- This includes TyCons, DataCons and promoted TyCons. tycon_kk_names :: TyCon -> [Name] tycon_kk_names tc = tyConName tc : (rep_names tc ++ concatMap thing_kk_names (implicitTyConThings tc)) diff --git a/testsuite/tests/typecheck/should_run/TypeOf.hs b/testsuite/tests/typecheck/should_run/TypeOf.hs index efd26f9640..53e035923f 100644 --- a/testsuite/tests/typecheck/should_run/TypeOf.hs +++ b/testsuite/tests/typecheck/should_run/TypeOf.hs @@ -31,4 +31,5 @@ main = do print $ typeOf (Proxy :: Proxy *) print $ typeOf (Proxy :: Proxy ★) print $ typeOf (Proxy :: Proxy 'PtrRepLifted) + print $ typeOf (Proxy :: Proxy '(1, "hello")) print $ typeOf (Proxy :: Proxy (~~)) diff --git a/testsuite/tests/typecheck/should_run/TypeOf.stdout b/testsuite/tests/typecheck/should_run/TypeOf.stdout index 6f160f544c..3e3396fa7e 100644 --- a/testsuite/tests/typecheck/should_run/TypeOf.stdout +++ b/testsuite/tests/typecheck/should_run/TypeOf.stdout @@ -20,4 +20,5 @@ Proxy Constraint Constraint Proxy Constraint Constraint Proxy Constraint Constraint Proxy RuntimeRep 'PtrRepLifted +Proxy (Nat,Symbol) ('(,) Nat Symbol 1 "hello") Proxy (Constraint -> Constraint -> Constraint) ~~ |