diff options
author | Richard Eisenberg <eir@cis.upenn.edu> | 2016-04-22 22:39:17 -0400 |
---|---|---|
committer | Richard Eisenberg <eir@cis.upenn.edu> | 2016-06-23 15:17:43 -0400 |
commit | 8035d1a5dc7290e8d3d61446ee4861e0b460214e (patch) | |
tree | 2e517feff25329abb942184ac4a7d20c9f77ba29 /testsuite/tests/ghci | |
parent | 9a34bf1985035858ece043bf38b47b6ff4b88efb (diff) | |
download | haskell-8035d1a5dc7290e8d3d61446ee4861e0b460214e.tar.gz |
Fix #10963 and #11975 by adding new cmds to GHCi.
See the user's guide entry or the Note [TcRnExprMode] in TcRnDriver.
Test cases: ghci/scripts/T{10963,11975}
Diffstat (limited to 'testsuite/tests/ghci')
-rw-r--r-- | testsuite/tests/ghci/scripts/T10963.script | 7 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/T10963.stderr | 12 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/T10963.stdout | 4 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/T11975.script | 9 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/T11975.stdout | 15 | ||||
-rwxr-xr-x | testsuite/tests/ghci/scripts/all.T | 2 |
6 files changed, 49 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/scripts/T10963.script b/testsuite/tests/ghci/scripts/T10963.script new file mode 100644 index 0000000000..357d1256ba --- /dev/null +++ b/testsuite/tests/ghci/scripts/T10963.script @@ -0,0 +1,7 @@ +:type mapM +:type +d mapM +:t +d length +let foo :: (Num a, Monoid a) => a -> a; foo = undefined +:t +d foo +instance Monoid Double where mempty = 0; mappend = (+) +:t +d foo diff --git a/testsuite/tests/ghci/scripts/T10963.stderr b/testsuite/tests/ghci/scripts/T10963.stderr new file mode 100644 index 0000000000..e20f792773 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T10963.stderr @@ -0,0 +1,12 @@ + +<interactive>:1:1: error: + Ambiguous type variable ‘a0’ arising from a use of ‘foo’ + prevents the constraint ‘(Num a0)’ from being solved. + Probable fix: use a type annotation to specify what ‘a0’ should be. + These potential instances exist: + instance Num Integer -- Defined in ‘GHC.Num’ + instance Num Double -- Defined in ‘GHC.Float’ + instance Num Float -- Defined in ‘GHC.Float’ + ...plus two others + ...plus five instances involving out-of-scope types + (use -fprint-potential-instances to see them all) diff --git a/testsuite/tests/ghci/scripts/T10963.stdout b/testsuite/tests/ghci/scripts/T10963.stdout new file mode 100644 index 0000000000..bf639a8aa5 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T10963.stdout @@ -0,0 +1,4 @@ +mapM :: (Monad m, Traversable t) => (a -> m b) -> t a -> m (t b) +mapM :: Monad m => (a -> m b) -> [a] -> m [b] +length :: [a] -> Int +foo :: Double -> Double diff --git a/testsuite/tests/ghci/scripts/T11975.script b/testsuite/tests/ghci/scripts/T11975.script new file mode 100644 index 0000000000..80061ef97b --- /dev/null +++ b/testsuite/tests/ghci/scripts/T11975.script @@ -0,0 +1,9 @@ +:set -fprint-explicit-foralls +:type mapM +:type +v mapM +:t +v mapM +let foo :: (Show a, Num b) => a -> b; foo = undefined +:set -XTypeApplications +:type foo @Int +:type +v foo @Int +:t +v foo @Int diff --git a/testsuite/tests/ghci/scripts/T11975.stdout b/testsuite/tests/ghci/scripts/T11975.stdout new file mode 100644 index 0000000000..23adaf02db --- /dev/null +++ b/testsuite/tests/ghci/scripts/T11975.stdout @@ -0,0 +1,15 @@ +mapM + :: forall {t :: * -> *} {b} {m :: * -> *} {a}. + (Monad m, Traversable t) => + (a -> m b) -> t a -> m (t b) +mapM + :: forall (t :: * -> *). + Traversable t => + forall (m :: * -> *) a b. Monad m => (a -> m b) -> t a -> m (t b) +mapM + :: forall (t :: * -> *). + Traversable t => + forall (m :: * -> *) a b. Monad m => (a -> m b) -> t a -> m (t b) +foo @Int :: forall {b}. Num b => Int -> b +foo @Int :: forall b. (Show Int, Num b) => Int -> b +foo @Int :: forall b. (Show Int, Num b) => Int -> b diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index dfedb39ea7..b2ea302f42 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -254,3 +254,5 @@ test('TypeAppData', normal, ghci_script, ['TypeAppData.script']) test('T11728', normal, ghci_script, ['T11728.script']) test('T11376', normal, ghci_script, ['T11376.script']) test('T12007', normal, ghci_script, ['T12007.script']) +test('T11975', normal, ghci_script, ['T11975.script']) +test('T10963', normal, ghci_script, ['T10963.script']) |