summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorFacundo Domínguez <facundo.dominguez@tweag.io>2016-12-20 08:39:10 -0300
committerFacundo Domínguez <facundo.dominguez@tweag.io>2017-01-06 15:17:23 -0300
commitc1ed9557ad4e40caa72b27693527e02887ddd896 (patch)
tree4b5910cb78266f377a073706267ad268397a3fee /compiler
parentc5452cc1a67e344ea694851d83e2534a6d829e45 (diff)
downloadhaskell-c1ed9557ad4e40caa72b27693527e02887ddd896.tar.gz
Have addModFinalizer expose the local type environment.
Kind inference in ghci was interfered when renaming of type splices introduced the HsSpliced data constructor. This patch has kind inference skip over it. Test Plan: ./validate Reviewers: simonpj, rrnewton, bgamari, goldfire, austin Subscribers: thomie, mboes Differential Revision: https://phabricator.haskell.org/D2886 GHC Trac Issues: #12985
Diffstat (limited to 'compiler')
-rw-r--r--compiler/typecheck/TcHsType.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs
index d96e74e6d9..3fa6077456 100644
--- a/compiler/typecheck/TcHsType.hs
+++ b/compiler/typecheck/TcHsType.hs
@@ -446,6 +446,14 @@ tc_infer_hs_type mode (HsKindSig ty sig)
= do { sig' <- tc_lhs_kind (kindLevel mode) sig
; ty' <- tc_lhs_type mode ty sig'
; return (ty', sig') }
+-- HsSpliced is an annotation produced by 'RnSplice.rnSpliceType' to communicate
+-- the splice location to the typechecker. Here we skip over it in order to have
+-- the same kind inferred for a given expression whether it was produced from
+-- splices or not.
+--
+-- See Note [Delaying modFinalizers in untyped splices].
+tc_infer_hs_type mode (HsSpliceTy (HsSpliced _ (HsSplicedTy ty)) _)
+ = tc_infer_hs_type mode ty
tc_infer_hs_type mode (HsDocTy ty _) = tc_infer_lhs_type mode ty
tc_infer_hs_type _ (HsCoreTy ty) = return (ty, typeKind ty)
tc_infer_hs_type mode other_ty