summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorEric Seidel <gridaphobe@gmail.com>2016-04-04 12:05:01 +0200
committerBen Gamari <ben@smart-cactus.org>2016-04-04 13:05:20 +0200
commit7407a66d5bd29aa011f5a4228c6e2b2f7f8ad3f8 (patch)
treea79dbba0a8a0c3a7ecb12e1262487f0d876072c7 /testsuite
parent9b6820cdd6bac8b8346be48224627e3feefa9036 (diff)
downloadhaskell-7407a66d5bd29aa011f5a4228c6e2b2f7f8ad3f8.tar.gz
Don't infer CallStacks
We originally wanted CallStacks to be opt-in, but dealing with let binders complicated things, forcing us to infer CallStacks. It turns out that the inference is actually unnecessary though, we can let the wanted CallStacks bubble up to the outer context by refusing to quantify over them. Eventually they'll be solved from a given CallStack or defaulted to the empty CallStack if they reach the top. So this patch prevents GHC from quantifying over CallStacks, getting us back to the original plan. There's a small ugliness to do with PartialTypeSignatures, if the partial theta contains a CallStack constraint, we *do* want to quantify over the CallStack; the user asked us to! Note that this means that foo :: _ => CallStack foo = getCallStack callStack will be an *empty* CallStack, since we won't infer a CallStack for the hole in the theta. I think this is the right move though, since we want CallStacks to be opt-in. One can always write foo :: (HasCallStack, _) => CallStack foo = getCallStack callStack to get the CallStack and still have GHC infer the rest of the theta. Test Plan: ./validate Reviewers: goldfire, simonpj, austin, hvr, bgamari Reviewed By: simonpj, bgamari Subscribers: bitemyapp, thomie Projects: #ghc Differential Revision: https://phabricator.haskell.org/D1912 GHC Trac Issues: #11573
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/codeGen/should_run/cgrun059.stderr3
-rw-r--r--testsuite/tests/concurrent/should_run/conc021.stderr3
-rw-r--r--testsuite/tests/deSugar/should_run/T11601.stderr1
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break017.stdout5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print033.stdout3
-rw-r--r--testsuite/tests/ghci/scripts/T5557.stdout10
-rw-r--r--testsuite/tests/ghci/scripts/ghci013.stdout3
-rw-r--r--testsuite/tests/ghci/scripts/ghci046.stdout4
-rw-r--r--testsuite/tests/ghci/scripts/ghci055.stdout7
-rw-r--r--testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr7
-rw-r--r--testsuite/tests/partial-sigs/should_fail/T10999.stderr8
-rw-r--r--testsuite/tests/typecheck/should_run/T10845.hs11
-rw-r--r--testsuite/tests/typecheck/should_run/T10845.stdout7
-rw-r--r--testsuite/tests/typecheck/should_run/T8119.stdout3
14 files changed, 27 insertions, 48 deletions
diff --git a/testsuite/tests/codeGen/should_run/cgrun059.stderr b/testsuite/tests/codeGen/should_run/cgrun059.stderr
index af01704f99..da868fc522 100644
--- a/testsuite/tests/codeGen/should_run/cgrun059.stderr
+++ b/testsuite/tests/codeGen/should_run/cgrun059.stderr
@@ -1,4 +1,3 @@
cgrun059: Error: File not found
-CallStack (from ImplicitParams):
+CallStack (from HasCallStack):
error, called at cgrun059.hs:12:28 in main:Main
- raiseError, called at cgrun059.hs:25:29 in main:Main
diff --git a/testsuite/tests/concurrent/should_run/conc021.stderr b/testsuite/tests/concurrent/should_run/conc021.stderr
index 4c70f77f54..659f325726 100644
--- a/testsuite/tests/concurrent/should_run/conc021.stderr
+++ b/testsuite/tests/concurrent/should_run/conc021.stderr
@@ -1,4 +1,3 @@
conc021: wurble
-CallStack (from ImplicitParams):
+CallStack (from HasCallStack):
error, called at conc021.hs:9:9 in main:Main
- foo, called at conc021.hs:6:1 in main:Main
diff --git a/testsuite/tests/deSugar/should_run/T11601.stderr b/testsuite/tests/deSugar/should_run/T11601.stderr
index 6db78c08a4..de0d9deb91 100644
--- a/testsuite/tests/deSugar/should_run/T11601.stderr
+++ b/testsuite/tests/deSugar/should_run/T11601.stderr
@@ -2,4 +2,3 @@ T11601: Prelude.undefined
CallStack (from HasCallStack):
error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err
undefined, called at T11601.hs:6:35 in main:Main
- f, called at T11601.hs:8:15 in main:Main
diff --git a/testsuite/tests/ghci.debugger/scripts/break017.stdout b/testsuite/tests/ghci.debugger/scripts/break017.stdout
index 6c8513f00b..7a1664db78 100644
--- a/testsuite/tests/ghci.debugger/scripts/break017.stdout
+++ b/testsuite/tests/ghci.debugger/scripts/break017.stdout
@@ -8,9 +8,8 @@ Printing 1
as = 'b' : 'c' : (_t1::[Char])
Forcing
*** Exception: Prelude.undefined
-CallStack (from ImplicitParams):
- error, called at libraries/base/GHC/Err.hs:43:14 in base:GHC.Err
+CallStack (from HasCallStack):
+ error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err
undefined, called at <interactive>:3:17 in interactive:Ghci1
- it, called at <interactive>:3:1 in interactive:Ghci1
Printing 2
as = 'b' : 'c' : (_t2::[Char])
diff --git a/testsuite/tests/ghci.debugger/scripts/print033.stdout b/testsuite/tests/ghci.debugger/scripts/print033.stdout
index 4963c68366..62b39bbaea 100644
--- a/testsuite/tests/ghci.debugger/scripts/print033.stdout
+++ b/testsuite/tests/ghci.debugger/scripts/print033.stdout
@@ -1,2 +1 @@
-u = (_t1::(?callStack::GHC.Stack.Types.CallStack) =>
- ST s (forall s'. ST s' a))
+u = (_t1::ST s (forall s'. ST s' a))
diff --git a/testsuite/tests/ghci/scripts/T5557.stdout b/testsuite/tests/ghci/scripts/T5557.stdout
index 835d351d75..4b864f9063 100644
--- a/testsuite/tests/ghci/scripts/T5557.stdout
+++ b/testsuite/tests/ghci/scripts/T5557.stdout
@@ -1,10 +1,8 @@
*** Exception: Prelude.undefined
-CallStack (from ImplicitParams):
- error, called at libraries/base/GHC/Err.hs:43:14 in base:GHC.Err
+CallStack (from HasCallStack):
+ error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err
undefined, called at <interactive>:2:12 in interactive:Ghci1
- it, called at <interactive>:2:1 in interactive:Ghci1
*** Exception: Prelude.undefined
-CallStack (from ImplicitParams):
- error, called at libraries/base/GHC/Err.hs:43:14 in base:GHC.Err
+CallStack (from HasCallStack):
+ error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err
undefined, called at <interactive>:3:12 in interactive:Ghci1
- it, called at <interactive>:3:1 in interactive:Ghci1
diff --git a/testsuite/tests/ghci/scripts/ghci013.stdout b/testsuite/tests/ghci/scripts/ghci013.stdout
index d70c57fd67..d6c3823fdd 100644
--- a/testsuite/tests/ghci/scripts/ghci013.stdout
+++ b/testsuite/tests/ghci/scripts/ghci013.stdout
@@ -1,2 +1 @@
-f :: (?callStack::GHC.Stack.Types.CallStack, Monad m) =>
- (m a, t) -> m b
+f :: Monad m => (m a, t) -> m b
diff --git a/testsuite/tests/ghci/scripts/ghci046.stdout b/testsuite/tests/ghci/scripts/ghci046.stdout
index da71a9a73d..c4e7cf3fc7 100644
--- a/testsuite/tests/ghci/scripts/ghci046.stdout
+++ b/testsuite/tests/ghci/scripts/ghci046.stdout
@@ -2,5 +2,5 @@ AND HTrue HTrue :: *
= HTrue
AND (OR HFalse HTrue) (OR HTrue HFalse) :: *
= HTrue
-t :: (?callStack::GHC.Stack.Types.CallStack) => HTrue
-t :: (?callStack::GHC.Stack.Types.CallStack) => HFalse
+t :: HTrue
+t :: HFalse
diff --git a/testsuite/tests/ghci/scripts/ghci055.stdout b/testsuite/tests/ghci/scripts/ghci055.stdout
index e878582a2b..f98845ccbe 100644
--- a/testsuite/tests/ghci/scripts/ghci055.stdout
+++ b/testsuite/tests/ghci/scripts/ghci055.stdout
@@ -1,3 +1,6 @@
-x = _
-x :: ?callStack::GHC.Stack.Types.CallStack => a = _
+*** Exception: Prelude.undefined
+CallStack (from HasCallStack):
+ error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err
+ undefined, called at <interactive>:1:5 in interactive:Ghci1
+x :: a = _
y :: Integer = 3
diff --git a/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr b/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr
index e0daa4e87d..c34b1396c7 100644
--- a/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr
+++ b/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr
@@ -62,8 +62,7 @@ TYPE SIGNATURES
enumFromThen :: forall a. Enum a => a -> a -> [a]
enumFromThenTo :: forall a. Enum a => a -> a -> a -> [a]
enumFromTo :: forall a. Enum a => a -> a -> [a]
- error ::
- forall a. (?callStack::GHC.Stack.Types.CallStack) => [Char] -> a
+ error :: forall a. [Char] -> a
even :: forall a. Integral a => a -> Bool
exp :: forall a. Floating a => a -> a
exponent :: forall a. RealFloat a => a -> Int
@@ -213,7 +212,7 @@ TYPE SIGNATURES
toRational :: forall a. Real a => a -> Rational
truncate :: forall a b. (RealFrac a, Integral b) => a -> b
uncurry :: forall a b c. (a -> b -> c) -> (a, b) -> c
- undefined :: forall t. (?callStack::GHC.Stack.Types.CallStack) => t
+ undefined :: forall t. t
unlines :: [String] -> String
until :: forall a. (a -> Bool) -> (a -> a) -> a -> a
unwords :: [String] -> String
@@ -232,4 +231,4 @@ TYPE CONSTRUCTORS
COERCION AXIOMS
Dependent modules: []
Dependent packages: [base-4.9.0.0, ghc-prim-0.5.0.0,
- integer-gmp-1.0.0.0]
+ integer-gmp-1.0.0.1]
diff --git a/testsuite/tests/partial-sigs/should_fail/T10999.stderr b/testsuite/tests/partial-sigs/should_fail/T10999.stderr
index ef4d9f83c1..c74719addf 100644
--- a/testsuite/tests/partial-sigs/should_fail/T10999.stderr
+++ b/testsuite/tests/partial-sigs/should_fail/T10999.stderr
@@ -1,7 +1,6 @@
T10999.hs:5:6: error:
- Found constraint wildcard ‘_’
- standing for ‘(?callStack::GHC.Stack.Types.CallStack, Ord a)’
+ Found constraint wildcard ‘_’ standing for ‘Ord a’
To use the inferred type, enable PartialTypeSignatures
In the type signature:
f :: _ => () -> _
@@ -9,10 +8,7 @@ T10999.hs:5:6: error:
T10999.hs:5:17: error:
• Found type wildcard ‘_’ standing for ‘Set.Set a’
Where: ‘a’ is a rigid type variable bound by
- the inferred type of
- f :: (?callStack::GHC.Stack.Types.CallStack, Ord a) =>
- () -> Set.Set a
- at T10999.hs:6:1
+ the inferred type of f :: Ord a => () -> Set.Set a at T10999.hs:6:1
To use the inferred type, enable PartialTypeSignatures
• In the type signature:
f :: _ => () -> _
diff --git a/testsuite/tests/typecheck/should_run/T10845.hs b/testsuite/tests/typecheck/should_run/T10845.hs
index 3d813fc40f..c93595feff 100644
--- a/testsuite/tests/typecheck/should_run/T10845.hs
+++ b/testsuite/tests/typecheck/should_run/T10845.hs
@@ -4,17 +4,10 @@
import GHC.Stack
f1 :: (?loc :: CallStack) => CallStack
--- we can infer a CallStack for let-binders
+-- we can solve CallStacks in local functions from CallStacks
+-- in the outer context
f1 = let y x = (?loc :: CallStack)
in y 0
-f2 :: (?loc :: CallStack) => CallStack
--- but only when we would infer an IP.
--- i.e. the monomorphism restriction prevents us
--- from inferring a CallStack.
-f2 = let y = (?loc :: CallStack)
- in y
-
main :: IO ()
main = do putStrLn $ prettyCallStack f1
- putStrLn $ prettyCallStack f2
diff --git a/testsuite/tests/typecheck/should_run/T10845.stdout b/testsuite/tests/typecheck/should_run/T10845.stdout
index af39ed4728..9f065bb837 100644
--- a/testsuite/tests/typecheck/should_run/T10845.stdout
+++ b/testsuite/tests/typecheck/should_run/T10845.stdout
@@ -1,5 +1,2 @@
-CallStack (from ImplicitParams):
- y, called at T10845.hs:10:9 in main:Main
- f1, called at T10845.hs:20:36 in main:Main
-CallStack (from ImplicitParams):
- f2, called at T10845.hs:21:36 in main:Main
+CallStack (from HasCallStack):
+ f1, called at T10845.hs:13:38 in main:Main
diff --git a/testsuite/tests/typecheck/should_run/T8119.stdout b/testsuite/tests/typecheck/should_run/T8119.stdout
index 7e9d9e1558..cda6b1de02 100644
--- a/testsuite/tests/typecheck/should_run/T8119.stdout
+++ b/testsuite/tests/typecheck/should_run/T8119.stdout
@@ -1,3 +1,2 @@
-test `asTypeOf` (undefined :: a -> b)
- :: (?callStack::GHC.Stack.Types.CallStack) => Int -> Int
+test `asTypeOf` (undefined :: a -> b) :: Int -> Int
\x -> test x :: Int -> Int