summaryrefslogtreecommitdiff
path: root/compiler/main/Constants.hs
diff options
context:
space:
mode:
authorRichard Eisenberg <eir@cis.upenn.edu>2015-03-23 10:30:19 -0400
committerRichard Eisenberg <eir@cis.upenn.edu>2015-03-23 12:26:35 -0400
commitc1edbdfd9148ad9f74bfe41e76c524f3e775aaaa (patch)
tree001ba874b4a2e324556c95a76accec7b750879dd /compiler/main/Constants.hs
parent0f03a843e7e740218f3ce3853f80de99b0ed6236 (diff)
downloadhaskell-c1edbdfd9148ad9f74bfe41e76c524f3e775aaaa.tar.gz
Do proper depth checking in the flattener to avoid looping.
This implements (roughly) the plan put forward in comment:14:ticket:7788, fixing #7788, #8550, #9554, #10139, and addressing concerns raised in #10079. There are some regressions w.r.t. GHC 7.8, but only with pathological type families (like F a = F a). This also (hopefully -- don't have a test case) fixes #10158. Unsolved problems include #10184 and #10185, which are both known deficiencies of the approach used here. As part of this change, the plumbing around detecting infinite loops has changed. Instead of -fcontext-stack and -ftype-function-depth, we now have one combined -freduction-depth parameter. Setting it to 0 disbales the check, which is now the recommended way to get (terminating) code to typecheck in releases. (The number of reduction steps may well change between minor GHC releases!) This commit also introduces a new IntWithInf type in BasicTypes that represents an integer+infinity. This type is used in a few places throughout the code. Tests in indexed-types/should_fail/T7788 indexed-types/should_fail/T8550 indexed-types/should_fail/T9554 indexed-types/should_compile/T10079 indexed-types/should_compile/T10139 typecheck/should_compile/T10184 (expected broken) typecheck/should_compile/T10185 (expected broken) This commit also changes performance testsuite numbers, for the better.
Diffstat (limited to 'compiler/main/Constants.hs')
-rw-r--r--compiler/main/Constants.hs11
1 files changed, 4 insertions, 7 deletions
diff --git a/compiler/main/Constants.hs b/compiler/main/Constants.hs
index 0054888df3..0f23fc242e 100644
--- a/compiler/main/Constants.hs
+++ b/compiler/main/Constants.hs
@@ -17,13 +17,10 @@ mAX_TUPLE_SIZE :: Int
mAX_TUPLE_SIZE = 62 -- Should really match the number
-- of decls in Data.Tuple
-mAX_CONTEXT_REDUCTION_DEPTH :: Int
-mAX_CONTEXT_REDUCTION_DEPTH = 100
- -- Trac #5395 reports at least one library that needs depth 37 here
-
-mAX_TYPE_FUNCTION_REDUCTION_DEPTH :: Int
-mAX_TYPE_FUNCTION_REDUCTION_DEPTH = 200
- -- Needs to be much higher than mAX_CONTEXT_REDUCTION_DEPTH; see Trac #5395
+-- | Default maximum depth for both class instance search and type family
+-- reduction. See also Trac #5395.
+mAX_REDUCTION_DEPTH :: Int
+mAX_REDUCTION_DEPTH = 200
wORD64_SIZE :: Int
wORD64_SIZE = 8