summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/T14396f.hs
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@fb.com>2017-10-29 20:15:07 -0400
committerEdward Z. Yang <ezyang@fb.com>2017-11-30 19:25:29 -0500
commit6998772043a7f0b0360116eb5ffcbaa5630b21fb (patch)
tree0dbe4c73951283b06a234b0c7eb72c594de0a87c /testsuite/tests/typecheck/should_compile/T14396f.hs
parentd672b7ffa0cf23fae6bf95731b841105ab4e9c8e (diff)
downloadhaskell-6998772043a7f0b0360116eb5ffcbaa5630b21fb.tar.gz
Make use of boot TyThings during typechecking.
Summary: Suppose that you are typechecking A.hs, which transitively imports, via B.hs, A.hs-boot. When we poke on B.hs and discover that it has a reference to a type from A, what TyThing should we wire it up with? Clearly, if we have already typechecked A, we should use the most up-to-date TyThing: the one we freshly generated when we typechecked A. But what if we haven't typechecked it yet? For the longest time, GHC adopted the policy that this was *an error condition*; that you MUST NEVER poke on B.hs's reference to a thing defined in A.hs until A.hs has gotten around to checking this. However, actually ensuring this is the case has proven to be a bug farm. The problem was especially poignant with type family consistency checks, which eagerly happen before any typechecking takes place. This patch takes a different strategy: if we ever try to access an entity from A which doesn't exist, we just fall back on the definition of A from the hs-boot file. This means that you may end up with a mix of A.hs and A.hs-boot TyThings during the course of typechecking. Signed-off-by: Edward Z. Yang <ezyang@fb.com> Test Plan: validate Reviewers: simonpj, bgamari, austin, goldfire Subscribers: thomie, rwbarton GHC Trac Issues: #14396 Differential Revision: https://phabricator.haskell.org/D4154
Diffstat (limited to 'testsuite/tests/typecheck/should_compile/T14396f.hs')
-rw-r--r--testsuite/tests/typecheck/should_compile/T14396f.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T14396f.hs b/testsuite/tests/typecheck/should_compile/T14396f.hs
new file mode 100644
index 0000000000..e6230fd11b
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T14396f.hs
@@ -0,0 +1,3 @@
+{-# LANGUAGE TypeFamilies #-}
+module T14396f where
+type family F a