summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testsuite/tests/ghci/scripts/T16804.script123
-rw-r--r--testsuite/tests/ghci/scripts/T16804.stderr2
-rw-r--r--testsuite/tests/ghci/scripts/T16804.stdout940
-rw-r--r--testsuite/tests/ghci/scripts/T16804b.hs1
-rw-r--r--testsuite/tests/ghci/scripts/T16804c.hs15
-rwxr-xr-xtestsuite/tests/ghci/scripts/all.T6
6 files changed, 889 insertions, 198 deletions
diff --git a/testsuite/tests/ghci/scripts/T16804.script b/testsuite/tests/ghci/scripts/T16804.script
index 12afa35a54..3591b06d44 100644
--- a/testsuite/tests/ghci/scripts/T16804.script
+++ b/testsuite/tests/ghci/scripts/T16804.script
@@ -1,31 +1,60 @@
-let custom c s e = let cmd = c ++ " " ++ s ++ maybe "" (" " ++) e; in (putStrLn ("input: " ++ cmd) >> return cmd)
+:{
+annotate :: [String] -> Int -> Int -> Int -> String
+annotate content row startcol endcol =
+ let
+ (toDrop, toTake) = calcRows row
+ startRows = drop toDrop content
+ markFile = map ("> " ++)
+ rows = markFile (take toTake startRows) ++ ["% " ++ annotateRow] ++ markFile (take 1 (drop toTake startRows))
+ in unlines rows
+ where
+ calcRows 1 = (0, 1)
+ calcRows c = (c-2, 2)
+ annotateRow
+ | startcol == endcol = replicate (startcol - 1) ' ' ++ "^"
+ | otherwise = replicate (startcol - 1) ' ' ++ "^" ++ replicate (endcol - startcol - 1) '~' ++ "^"
+
+annotateFile :: [(String, [String])] -> String -> String
+annotateFile fileStore args = do
+ case words args of
+ [filename,row,startcol,_,endcol] ->
+ let
+ file = snd . head . filter ((filename ==) . fst) $ fileStore
+ in annotate file (read row) (read startcol) (read endcol)
+ _ -> "malformed args"
+:}
+
+t1 <- readFile "T16804a.hs"
+t2 <- readFile "T16804b.hs"
+t3 <- readFile "T16804c.hs"
+
+let fileStore = [("T16804a.hs", lines t1), ("T16804b.hs", lines t2), ("T16804c.hs", lines t3)]
+
+:{
+custom c s e =
+ let
+ cmd = c ++ " " ++ s ++ maybe "" (" " ++) e
+ in do
+ putStrLn ""
+ putStrLn ("% executing: \"" ++ cmd ++ "\"")
+ putStrLn ("% file snippet:")
+ putStr (annotateFile fileStore s)
+ putStrLn "% output:"
+ return cmd
+:}
let tp s = custom ":type-at" s (Just "undefined")
let up s = custom ":uses" s Nothing
-let cp s = putStrLn s >> return ""
-
-let ruler p n = putStrLn $ replicate p ' ' ++ replicate (n * 10) ' ' ++ "1234567890"
-let putruler p s = ruler p 0 >> ruler p 1 >> ruler p 2 >> ruler p 3 >> return ""
:def tp tp
:def up up
-:def cp cp
-:def putruler1 (putruler 2)
-:def putruler2 (putruler 3)
:set +c
-:l T16804a.hs T16804b.hs
-
-:cp 1 module T16804a where
-:putruler1
+:l T16804a.hs T16804b.hs T16804c.hs
:tp T16804a.hs 1 8 1 14
:up T16804a.hs 1 8 1 14
-:cp 2
-:cp 3 import Data.Monoid
-:putruler1
-
:tp T16804a.hs 3 8 3 11
:tp T16804a.hs 3 8 3 18
:tp T16804a.hs 3 13 3 18
@@ -34,11 +63,6 @@ let putruler p s = ruler p 0 >> ruler p 1 >> ruler p 2 >> ruler p 3 >> return ""
:up T16804a.hs 3 8 3 18
:up T16804a.hs 3 13 3 18
-:cp 4
-:cp 5 data Test = A | B
-:cp 6 deriving (Show)
-:putruler1
-
:tp T16804a.hs 5 6 5 9
:tp T16804a.hs 5 13 5 13
:tp T16804a.hs 5 15 5 15
@@ -51,11 +75,6 @@ let putruler p s = ruler p 0 >> ruler p 1 >> ruler p 2 >> ruler p 3 >> return ""
:up T16804a.hs 5 17 5 17
:up T16804a.hs 6 13 6 16
-:cp 7 instance Monoid Test where
-:cp 8 mempty = A
-:cp 9 -- gone
-:cp 10 -- gone
-:putruler1
:tp T16804a.hs 7 10 7 15
:tp T16804a.hs 7 17 7 20
:tp T16804a.hs 7 10 7 20
@@ -68,12 +87,6 @@ let putruler p s = ruler p 0 >> ruler p 1 >> ruler p 2 >> ruler p 3 >> return ""
:up T16804a.hs 8 3 8 8
:up T16804a.hs 8 12 8 12
-:cp 11
-:cp 12 testFunction :: Test -> Test -> Bool
-:cp 13 testFunction A B = True
-:cp 14 testFunction B A = True
-:cp 15 testFunction _ _ = False
-:putruler2
:tp T16804a.hs 12 1 12 12
:tp T16804a.hs 13 1 13 12
:tp T16804a.hs 13 14 13 14
@@ -88,21 +101,12 @@ let putruler p s = ruler p 0 >> ruler p 1 >> ruler p 2 >> ruler p 3 >> return ""
:up T16804a.hs 15 16 15 16
:up T16804a.hs 15 20 15 24
-:cp 16
-:cp 17 testFunction2 :: Bool -> Test
-:cp 18 testFunction2 True = A
-:cp 19 testFunction2 False = B
-:putruler2
:tp T16804a.hs 18 15 18 18
:tp T16804a.hs 18 22 18 22
:up T16804a.hs 18 15 18 18
:up T16804a.hs 18 22 18 22
-:cp 20
-:cp 21 niceValue :: Int
-:cp 22 niceValue = getSum (Sum 1 <> Sum 2 <> mempty)
-:putruler2
:tp T16804a.hs 22 13 22 18
:tp T16804a.hs 22 21 22 23
:tp T16804a.hs 22 25 22 25
@@ -115,10 +119,6 @@ let putruler p s = ruler p 0 >> ruler p 1 >> ruler p 2 >> ruler p 3 >> return ""
:up T16804a.hs 22 21 22 25
:up T16804a.hs 22 27 22 28
-:cp 23
-:cp 24 niceValue2 :: Test
-:cp 25 niceValue2 = A <> A <> A <> B <> A <> mempty
-:putruler2
:tp T16804a.hs 25 14 25 14
:tp T16804a.hs 25 16 25 17
:tp T16804a.hs 25 39 25 44
@@ -127,11 +127,6 @@ let putruler p s = ruler p 0 >> ruler p 1 >> ruler p 2 >> ruler p 3 >> return ""
:up T16804a.hs 25 16 25 17
:up T16804a.hs 25 39 25 44
-:cp 26
-:cp 27 instance Semigroup Test where
-:cp 28 A <> val = val
-:cp 29 B <> _ = B
-:putruler2
:tp T16804a.hs 28 3 28 3
:tp T16804a.hs 28 5 28 6
:tp T16804a.hs 28 8 28 10
@@ -149,3 +144,31 @@ let putruler p s = ruler p 0 >> ruler p 1 >> ruler p 2 >> ruler p 3 >> return ""
:up T16804a.hs 29 5 29 6
:up T16804a.hs 29 8 29 8
:up T16804a.hs 29 14 29 14
+
+:tp T16804b.hs 7 10 7 21
+:tp T16804b.hs 7 10 7 23
+:tp T16804b.hs 7 10 7 25
+:tp T16804b.hs 7 23 7 23
+
+:up T16804b.hs 7 10 7 21
+:up T16804b.hs 7 10 7 25
+:up T16804b.hs 7 23 7 23
+
+:tp T16804b.hs 8 10 8 22
+:tp T16804b.hs 8 10 8 27
+
+:tp T16804b.hs 10 9 10 17
+:up T16804b.hs 10 9 10 17
+
+:up T16804c.hs 5 1 5 1
+:up T16804c.hs 6 1 6 1
+
+:up T16804c.hs 9 12 9 14
+:up T16804c.hs 9 31 9 31
+:up T16804c.hs 9 33 9 35
+
+:up T16804c.hs 12 13 12 13
+:up T16804c.hs 12 32 12 32
+
+:up T16804c.hs 15 13 15 13
+:up T16804c.hs 15 30 15 30
diff --git a/testsuite/tests/ghci/scripts/T16804.stderr b/testsuite/tests/ghci/scripts/T16804.stderr
index ca243087b9..596fb837bb 100644
--- a/testsuite/tests/ghci/scripts/T16804.stderr
+++ b/testsuite/tests/ghci/scripts/T16804.stderr
@@ -29,3 +29,5 @@ Couldn't resolve to any modules.
Couldn't resolve to any modules.
Couldn't resolve to any modules.
Couldn't resolve to any modules.
+Couldn't resolve to any modules.
+Couldn't resolve to any modules.
diff --git a/testsuite/tests/ghci/scripts/T16804.stdout b/testsuite/tests/ghci/scripts/T16804.stdout
index a02f32e784..897a42e48a 100644
--- a/testsuite/tests/ghci/scripts/T16804.stdout
+++ b/testsuite/tests/ghci/scripts/T16804.stdout
@@ -1,196 +1,844 @@
-Collecting type info for 2 module(s) ...
-1 module T16804a where
- 1234567890
- 1234567890
- 1234567890
- 1234567890
-input: :type-at T16804a.hs 1 8 1 14 undefined
+Collecting type info for 3 module(s) ...
+
+% executing: ":type-at T16804a.hs 1 8 1 14 undefined"
+% file snippet:
+> module T16804a where
+% ^~~~~~^
+>
+% output:
undefined :: forall a. a
-input: :uses T16804a.hs 1 8 1 14
-2
-3 import Data.Monoid
- 1234567890
- 1234567890
- 1234567890
- 1234567890
-input: :type-at T16804a.hs 3 8 3 11 undefined
+
+% executing: ":uses T16804a.hs 1 8 1 14"
+% file snippet:
+> module T16804a where
+% ^~~~~~^
+>
+% output:
+
+% executing: ":type-at T16804a.hs 3 8 3 11 undefined"
+% file snippet:
+>
+> import Data.Monoid
+% ^~~^
+>
+% output:
undefined :: forall a. a
-input: :type-at T16804a.hs 3 8 3 18 undefined
+
+% executing: ":type-at T16804a.hs 3 8 3 18 undefined"
+% file snippet:
+>
+> import Data.Monoid
+% ^~~~~~~~~~^
+>
+% output:
undefined :: forall a. a
-input: :type-at T16804a.hs 3 13 3 18 undefined
+
+% executing: ":type-at T16804a.hs 3 13 3 18 undefined"
+% file snippet:
+>
+> import Data.Monoid
+% ^~~~~^
+>
+% output:
undefined :: forall a. a
-input: :uses T16804a.hs 3 8 3 11
-input: :uses T16804a.hs 3 8 3 18
-input: :uses T16804a.hs 3 13 3 18
-4
-5 data Test = A | B
-6 deriving (Show)
- 1234567890
- 1234567890
- 1234567890
- 1234567890
-input: :type-at T16804a.hs 5 6 5 9 undefined
+
+% executing: ":uses T16804a.hs 3 8 3 11"
+% file snippet:
+>
+> import Data.Monoid
+% ^~~^
+>
+% output:
+
+% executing: ":uses T16804a.hs 3 8 3 18"
+% file snippet:
+>
+> import Data.Monoid
+% ^~~~~~~~~~^
+>
+% output:
+
+% executing: ":uses T16804a.hs 3 13 3 18"
+% file snippet:
+>
+> import Data.Monoid
+% ^~~~~^
+>
+% output:
+
+% executing: ":type-at T16804a.hs 5 6 5 9 undefined"
+% file snippet:
+>
+> data Test = A | B
+% ^~~^
+> deriving (Show)
+% output:
undefined :: forall a. a
-input: :type-at T16804a.hs 5 13 5 13 undefined
+
+% executing: ":type-at T16804a.hs 5 13 5 13 undefined"
+% file snippet:
+>
+> data Test = A | B
+% ^
+> deriving (Show)
+% output:
undefined :: forall a. a
-input: :type-at T16804a.hs 5 15 5 15 undefined
+
+% executing: ":type-at T16804a.hs 5 15 5 15 undefined"
+% file snippet:
+>
+> data Test = A | B
+% ^
+> deriving (Show)
+% output:
undefined :: forall a. a
-input: :type-at T16804a.hs 5 17 5 17 undefined
+
+% executing: ":type-at T16804a.hs 5 17 5 17 undefined"
+% file snippet:
+>
+> data Test = A | B
+% ^
+> deriving (Show)
+% output:
undefined :: forall a. a
-input: :type-at T16804a.hs 6 13 6 16 undefined
+
+% executing: ":type-at T16804a.hs 6 13 6 16 undefined"
+% file snippet:
+> data Test = A | B
+> deriving (Show)
+% ^~~^
+> instance Monoid Test where
+% output:
undefined :: [Test] -> ShowS
-input: :uses T16804a.hs 5 6 5 9
-input: :uses T16804a.hs 5 13 5 13
-input: :uses T16804a.hs 5 15 5 15
-input: :uses T16804a.hs 5 17 5 17
-input: :uses T16804a.hs 6 13 6 16
+
+% executing: ":uses T16804a.hs 5 6 5 9"
+% file snippet:
+>
+> data Test = A | B
+% ^~~^
+> deriving (Show)
+% output:
+
+% executing: ":uses T16804a.hs 5 13 5 13"
+% file snippet:
+>
+> data Test = A | B
+% ^
+> deriving (Show)
+% output:
+
+% executing: ":uses T16804a.hs 5 15 5 15"
+% file snippet:
+>
+> data Test = A | B
+% ^
+> deriving (Show)
+% output:
+
+% executing: ":uses T16804a.hs 5 17 5 17"
+% file snippet:
+>
+> data Test = A | B
+% ^
+> deriving (Show)
+% output:
+
+% executing: ":uses T16804a.hs 6 13 6 16"
+% file snippet:
+> data Test = A | B
+> deriving (Show)
+% ^~~^
+> instance Monoid Test where
+% output:
T16804a.hs:(6,13)-(6,16)
T16804a.hs:(6,13)-(6,16)
-7 instance Monoid Test where
-8 mempty = A
-9 -- gone
-10 -- gone
- 1234567890
- 1234567890
- 1234567890
- 1234567890
-input: :type-at T16804a.hs 7 10 7 15 undefined
+
+% executing: ":type-at T16804a.hs 7 10 7 15 undefined"
+% file snippet:
+> deriving (Show)
+> instance Monoid Test where
+% ^~~~~^
+> mempty = A
+% output:
undefined :: forall a. a
-input: :type-at T16804a.hs 7 17 7 20 undefined
+
+% executing: ":type-at T16804a.hs 7 17 7 20 undefined"
+% file snippet:
+> deriving (Show)
+> instance Monoid Test where
+% ^~~^
+> mempty = A
+% output:
undefined :: forall a. a
-input: :type-at T16804a.hs 7 10 7 20 undefined
+
+% executing: ":type-at T16804a.hs 7 10 7 20 undefined"
+% file snippet:
+> deriving (Show)
+> instance Monoid Test where
+% ^~~~~~~~~~^
+> mempty = A
+% output:
undefined :: [Test] -> Test
-input: :type-at T16804a.hs 8 3 8 8 undefined
+
+% executing: ":type-at T16804a.hs 8 3 8 8 undefined"
+% file snippet:
+> instance Monoid Test where
+> mempty = A
+% ^~~~~^
+> -- empty for linenumbers in T16804 to be correct
+% output:
undefined :: Test
-input: :type-at T16804a.hs 8 12 8 12 undefined
+
+% executing: ":type-at T16804a.hs 8 12 8 12 undefined"
+% file snippet:
+> instance Monoid Test where
+> mempty = A
+% ^
+> -- empty for linenumbers in T16804 to be correct
+% output:
undefined :: Test
-input: :uses T16804a.hs 7 10 7 15
-input: :uses T16804a.hs 7 17 7 20
-input: :uses T16804a.hs 7 10 7 20
+
+% executing: ":uses T16804a.hs 7 10 7 15"
+% file snippet:
+> deriving (Show)
+> instance Monoid Test where
+% ^~~~~^
+> mempty = A
+% output:
+
+% executing: ":uses T16804a.hs 7 17 7 20"
+% file snippet:
+> deriving (Show)
+> instance Monoid Test where
+% ^~~^
+> mempty = A
+% output:
+
+% executing: ":uses T16804a.hs 7 10 7 20"
+% file snippet:
+> deriving (Show)
+> instance Monoid Test where
+% ^~~~~~~~~~^
+> mempty = A
+% output:
T16804a.hs:(7,10)-(7,20)
T16804a.hs:(7,10)-(7,20)
-input: :uses T16804a.hs 8 3 8 8
+
+% executing: ":uses T16804a.hs 8 3 8 8"
+% file snippet:
+> instance Monoid Test where
+> mempty = A
+% ^~~~~^
+> -- empty for linenumbers in T16804 to be correct
+% output:
T16804a.hs:(8,3)-(8,8)
T16804a.hs:(8,3)-(8,8)
-input: :uses T16804a.hs 8 12 8 12
-11
-12 testFunction :: Test -> Test -> Bool
-13 testFunction A B = True
-14 testFunction B A = True
-15 testFunction _ _ = False
- 1234567890
- 1234567890
- 1234567890
- 1234567890
-input: :type-at T16804a.hs 12 1 12 12 undefined
+
+% executing: ":uses T16804a.hs 8 12 8 12"
+% file snippet:
+> instance Monoid Test where
+> mempty = A
+% ^
+> -- empty for linenumbers in T16804 to be correct
+% output:
+
+% executing: ":type-at T16804a.hs 12 1 12 12 undefined"
+% file snippet:
+>
+> testFunction :: Test -> Test -> Bool
+% ^~~~~~~~~~~^
+> testFunction A B = True
+% output:
undefined :: forall a. a
-input: :type-at T16804a.hs 13 1 13 12 undefined
+
+% executing: ":type-at T16804a.hs 13 1 13 12 undefined"
+% file snippet:
+> testFunction :: Test -> Test -> Bool
+> testFunction A B = True
+% ^~~~~~~~~~~^
+> testFunction B A = True
+% output:
undefined :: Test -> Test -> Bool
-input: :type-at T16804a.hs 13 14 13 14 undefined
+
+% executing: ":type-at T16804a.hs 13 14 13 14 undefined"
+% file snippet:
+> testFunction :: Test -> Test -> Bool
+> testFunction A B = True
+% ^
+> testFunction B A = True
+% output:
undefined :: Test
-input: :type-at T16804a.hs 13 16 13 16 undefined
+
+% executing: ":type-at T16804a.hs 13 16 13 16 undefined"
+% file snippet:
+> testFunction :: Test -> Test -> Bool
+> testFunction A B = True
+% ^
+> testFunction B A = True
+% output:
undefined :: Test
-input: :type-at T16804a.hs 15 16 15 16 undefined
+
+% executing: ":type-at T16804a.hs 15 16 15 16 undefined"
+% file snippet:
+> testFunction B A = True
+> testFunction _ _ = False
+% ^
+>
+% output:
undefined :: Test
-input: :type-at T16804a.hs 15 20 15 24 undefined
+
+% executing: ":type-at T16804a.hs 15 20 15 24 undefined"
+% file snippet:
+> testFunction B A = True
+> testFunction _ _ = False
+% ^~~~^
+>
+% output:
undefined :: Bool
-input: :uses T16804a.hs 12 1 12 12
-input: :uses T16804a.hs 13 1 13 12
+
+% executing: ":uses T16804a.hs 12 1 12 12"
+% file snippet:
+>
+> testFunction :: Test -> Test -> Bool
+% ^~~~~~~~~~~^
+> testFunction A B = True
+% output:
+
+% executing: ":uses T16804a.hs 13 1 13 12"
+% file snippet:
+> testFunction :: Test -> Test -> Bool
+> testFunction A B = True
+% ^~~~~~~~~~~^
+> testFunction B A = True
+% output:
T16804a.hs:(13,1)-(13,12)
T16804a.hs:(13,1)-(13,12)
-input: :uses T16804a.hs 13 14 13 14
-input: :uses T16804a.hs 13 16 13 16
-input: :uses T16804a.hs 15 16 15 16
-input: :uses T16804a.hs 15 20 15 24
-16
-17 testFunction2 :: Bool -> Test
-18 testFunction2 True = A
-19 testFunction2 False = B
- 1234567890
- 1234567890
- 1234567890
- 1234567890
-input: :type-at T16804a.hs 18 15 18 18 undefined
+
+% executing: ":uses T16804a.hs 13 14 13 14"
+% file snippet:
+> testFunction :: Test -> Test -> Bool
+> testFunction A B = True
+% ^
+> testFunction B A = True
+% output:
+
+% executing: ":uses T16804a.hs 13 16 13 16"
+% file snippet:
+> testFunction :: Test -> Test -> Bool
+> testFunction A B = True
+% ^
+> testFunction B A = True
+% output:
+
+% executing: ":uses T16804a.hs 15 16 15 16"
+% file snippet:
+> testFunction B A = True
+> testFunction _ _ = False
+% ^
+>
+% output:
+
+% executing: ":uses T16804a.hs 15 20 15 24"
+% file snippet:
+> testFunction B A = True
+> testFunction _ _ = False
+% ^~~~^
+>
+% output:
+
+% executing: ":type-at T16804a.hs 18 15 18 18 undefined"
+% file snippet:
+> testFunction2 :: Bool -> Test
+> testFunction2 True = A
+% ^~~^
+> testFunction2 False = B
+% output:
undefined :: Bool
-input: :type-at T16804a.hs 18 22 18 22 undefined
-undefined :: Test
-input: :uses T16804a.hs 18 15 18 18
-input: :uses T16804a.hs 18 22 18 22
-20
-21 niceValue :: Int
-22 niceValue = getSum (Sum 1 <> Sum 2 <> mempty)
- 1234567890
- 1234567890
- 1234567890
- 1234567890
-input: :type-at T16804a.hs 22 13 22 18 undefined
+
+% executing: ":type-at T16804a.hs 18 22 18 22 undefined"
+% file snippet:
+> testFunction2 :: Bool -> Test
+> testFunction2 True = A
+% ^
+> testFunction2 False = B
+% output:
+undefined :: Test
+
+% executing: ":uses T16804a.hs 18 15 18 18"
+% file snippet:
+> testFunction2 :: Bool -> Test
+> testFunction2 True = A
+% ^~~^
+> testFunction2 False = B
+% output:
+
+% executing: ":uses T16804a.hs 18 22 18 22"
+% file snippet:
+> testFunction2 :: Bool -> Test
+> testFunction2 True = A
+% ^
+> testFunction2 False = B
+% output:
+
+% executing: ":type-at T16804a.hs 22 13 22 18 undefined"
+% file snippet:
+> niceValue :: Int
+> niceValue = getSum (Sum 1 <> Sum 2 <> mempty)
+% ^~~~~^
+>
+% output:
undefined :: Sum Int -> Int
-input: :type-at T16804a.hs 22 21 22 23 undefined
+
+% executing: ":type-at T16804a.hs 22 21 22 23 undefined"
+% file snippet:
+> niceValue :: Int
+> niceValue = getSum (Sum 1 <> Sum 2 <> mempty)
+% ^~^
+>
+% output:
undefined :: Int -> Sum Int
-input: :type-at T16804a.hs 22 25 22 25 undefined
+
+% executing: ":type-at T16804a.hs 22 25 22 25 undefined"
+% file snippet:
+> niceValue :: Int
+> niceValue = getSum (Sum 1 <> Sum 2 <> mempty)
+% ^
+>
+% output:
undefined :: Int
-input: :type-at T16804a.hs 22 21 22 25 undefined
+
+% executing: ":type-at T16804a.hs 22 21 22 25 undefined"
+% file snippet:
+> niceValue :: Int
+> niceValue = getSum (Sum 1 <> Sum 2 <> mempty)
+% ^~~~^
+>
+% output:
undefined :: Sum Int
-input: :type-at T16804a.hs 22 27 22 28 undefined
+
+% executing: ":type-at T16804a.hs 22 27 22 28 undefined"
+% file snippet:
+> niceValue :: Int
+> niceValue = getSum (Sum 1 <> Sum 2 <> mempty)
+% ^^
+>
+% output:
undefined :: Sum Int -> Sum Int -> Sum Int
-input: :uses T16804a.hs 22 13 22 18
-input: :uses T16804a.hs 22 21 22 23
-input: :uses T16804a.hs 22 25 22 25
-input: :uses T16804a.hs 22 21 22 25
-input: :uses T16804a.hs 22 27 22 28
-23
-24 niceValue2 :: Test
-25 niceValue2 = A <> A <> A <> B <> A <> mempty
- 1234567890
- 1234567890
- 1234567890
- 1234567890
-input: :type-at T16804a.hs 25 14 25 14 undefined
-undefined :: Test
-input: :type-at T16804a.hs 25 16 25 17 undefined
+
+% executing: ":uses T16804a.hs 22 13 22 18"
+% file snippet:
+> niceValue :: Int
+> niceValue = getSum (Sum 1 <> Sum 2 <> mempty)
+% ^~~~~^
+>
+% output:
+
+% executing: ":uses T16804a.hs 22 21 22 23"
+% file snippet:
+> niceValue :: Int
+> niceValue = getSum (Sum 1 <> Sum 2 <> mempty)
+% ^~^
+>
+% output:
+
+% executing: ":uses T16804a.hs 22 25 22 25"
+% file snippet:
+> niceValue :: Int
+> niceValue = getSum (Sum 1 <> Sum 2 <> mempty)
+% ^
+>
+% output:
+
+% executing: ":uses T16804a.hs 22 21 22 25"
+% file snippet:
+> niceValue :: Int
+> niceValue = getSum (Sum 1 <> Sum 2 <> mempty)
+% ^~~~^
+>
+% output:
+
+% executing: ":uses T16804a.hs 22 27 22 28"
+% file snippet:
+> niceValue :: Int
+> niceValue = getSum (Sum 1 <> Sum 2 <> mempty)
+% ^^
+>
+% output:
+
+% executing: ":type-at T16804a.hs 25 14 25 14 undefined"
+% file snippet:
+> niceValue2 :: Test
+> niceValue2 = A <> A <> A <> B <> A <> mempty
+% ^
+>
+% output:
+undefined :: Test
+
+% executing: ":type-at T16804a.hs 25 16 25 17 undefined"
+% file snippet:
+> niceValue2 :: Test
+> niceValue2 = A <> A <> A <> B <> A <> mempty
+% ^^
+>
+% output:
undefined :: Test -> Test -> Test
-input: :type-at T16804a.hs 25 39 25 44 undefined
-undefined :: Test
-input: :uses T16804a.hs 25 14 25 14
-input: :uses T16804a.hs 25 16 25 17
-input: :uses T16804a.hs 25 39 25 44
-26
-27 instance Semigroup Test where
-28 A <> val = val
-29 B <> _ = B
- 1234567890
- 1234567890
- 1234567890
- 1234567890
-input: :type-at T16804a.hs 28 3 28 3 undefined
-undefined :: Test
-input: :type-at T16804a.hs 28 5 28 6 undefined
+
+% executing: ":type-at T16804a.hs 25 39 25 44 undefined"
+% file snippet:
+> niceValue2 :: Test
+> niceValue2 = A <> A <> A <> B <> A <> mempty
+% ^~~~~^
+>
+% output:
+undefined :: Test
+
+% executing: ":uses T16804a.hs 25 14 25 14"
+% file snippet:
+> niceValue2 :: Test
+> niceValue2 = A <> A <> A <> B <> A <> mempty
+% ^
+>
+% output:
+
+% executing: ":uses T16804a.hs 25 16 25 17"
+% file snippet:
+> niceValue2 :: Test
+> niceValue2 = A <> A <> A <> B <> A <> mempty
+% ^^
+>
+% output:
+
+% executing: ":uses T16804a.hs 25 39 25 44"
+% file snippet:
+> niceValue2 :: Test
+> niceValue2 = A <> A <> A <> B <> A <> mempty
+% ^~~~~^
+>
+% output:
+
+% executing: ":type-at T16804a.hs 28 3 28 3 undefined"
+% file snippet:
+> instance Semigroup Test where
+> A <> val = val
+% ^
+> B <> _ = B
+% output:
+undefined :: Test
+
+% executing: ":type-at T16804a.hs 28 5 28 6 undefined"
+% file snippet:
+> instance Semigroup Test where
+> A <> val = val
+% ^^
+> B <> _ = B
+% output:
undefined :: Test -> Test -> Test
-input: :type-at T16804a.hs 28 8 28 10 undefined
+
+% executing: ":type-at T16804a.hs 28 8 28 10 undefined"
+% file snippet:
+> instance Semigroup Test where
+> A <> val = val
+% ^~^
+> B <> _ = B
+% output:
undefined :: Test
-input: :type-at T16804a.hs 28 14 28 16 undefined
+
+% executing: ":type-at T16804a.hs 28 14 28 16 undefined"
+% file snippet:
+> instance Semigroup Test where
+> A <> val = val
+% ^~^
+> B <> _ = B
+% output:
undefined :: Test
-input: :type-at T16804a.hs 29 3 29 3 undefined
+
+% executing: ":type-at T16804a.hs 29 3 29 3 undefined"
+% file snippet:
+> A <> val = val
+> B <> _ = B
+% ^
+% output:
undefined :: Test
-input: :type-at T16804a.hs 29 5 29 6 undefined
+
+% executing: ":type-at T16804a.hs 29 5 29 6 undefined"
+% file snippet:
+> A <> val = val
+> B <> _ = B
+% ^^
+% output:
undefined :: forall a. a
-input: :type-at T16804a.hs 29 8 29 8 undefined
+
+% executing: ":type-at T16804a.hs 29 8 29 8 undefined"
+% file snippet:
+> A <> val = val
+> B <> _ = B
+% ^
+% output:
undefined :: Test
-input: :type-at T16804a.hs 29 14 29 14 undefined
+
+% executing: ":type-at T16804a.hs 29 14 29 14 undefined"
+% file snippet:
+> A <> val = val
+> B <> _ = B
+% ^
+% output:
undefined :: Test
-input: :uses T16804a.hs 28 3 28 3
-input: :uses T16804a.hs 28 5 28 6
+
+% executing: ":uses T16804a.hs 28 3 28 3"
+% file snippet:
+> instance Semigroup Test where
+> A <> val = val
+% ^
+> B <> _ = B
+% output:
+
+% executing: ":uses T16804a.hs 28 5 28 6"
+% file snippet:
+> instance Semigroup Test where
+> A <> val = val
+% ^^
+> B <> _ = B
+% output:
T16804a.hs:(28,5)-(28,6)
T16804a.hs:(28,5)-(28,6)
-input: :uses T16804a.hs 28 8 28 10
+
+% executing: ":uses T16804a.hs 28 8 28 10"
+% file snippet:
+> instance Semigroup Test where
+> A <> val = val
+% ^~^
+> B <> _ = B
+% output:
T16804a.hs:(28,8)-(28,10)
T16804a.hs:(28,14)-(28,16)
T16804a.hs:(28,8)-(28,10)
-input: :uses T16804a.hs 28 14 28 16
+
+% executing: ":uses T16804a.hs 28 14 28 16"
+% file snippet:
+> instance Semigroup Test where
+> A <> val = val
+% ^~^
+> B <> _ = B
+% output:
T16804a.hs:(28,8)-(28,10)
T16804a.hs:(28,14)-(28,16)
T16804a.hs:(28,8)-(28,10)
-input: :uses T16804a.hs 29 3 29 3
-input: :uses T16804a.hs 29 5 29 6
-input: :uses T16804a.hs 29 8 29 8
-input: :uses T16804a.hs 29 14 29 14
+
+% executing: ":uses T16804a.hs 29 3 29 3"
+% file snippet:
+> A <> val = val
+> B <> _ = B
+% ^
+% output:
+
+% executing: ":uses T16804a.hs 29 5 29 6"
+% file snippet:
+> A <> val = val
+> B <> _ = B
+% ^^
+% output:
+
+% executing: ":uses T16804a.hs 29 8 29 8"
+% file snippet:
+> A <> val = val
+> B <> _ = B
+% ^
+% output:
+
+% executing: ":uses T16804a.hs 29 14 29 14"
+% file snippet:
+> A <> val = val
+> B <> _ = B
+% ^
+% output:
+
+% executing: ":type-at T16804b.hs 7 10 7 21 undefined"
+% file snippet:
+> printStuff = do
+> print (testFunction A A)
+% ^~~~~~~~~~~^
+> print (testFunction2 True)
+% output:
+undefined :: Test -> Test -> Bool
+
+% executing: ":type-at T16804b.hs 7 10 7 23 undefined"
+% file snippet:
+> printStuff = do
+> print (testFunction A A)
+% ^~~~~~~~~~~~~^
+> print (testFunction2 True)
+% output:
+undefined :: Test -> Bool
+
+% executing: ":type-at T16804b.hs 7 10 7 25 undefined"
+% file snippet:
+> printStuff = do
+> print (testFunction A A)
+% ^~~~~~~~~~~~~~~^
+> print (testFunction2 True)
+% output:
+undefined :: Bool
+
+% executing: ":type-at T16804b.hs 7 23 7 23 undefined"
+% file snippet:
+> printStuff = do
+> print (testFunction A A)
+% ^
+> print (testFunction2 True)
+% output:
+undefined :: Test
+
+% executing: ":uses T16804b.hs 7 10 7 21"
+% file snippet:
+> printStuff = do
+> print (testFunction A A)
+% ^~~~~~~~~~~^
+> print (testFunction2 True)
+% output:
+T16804a.hs:(13,1)-(13,12)
+T16804b.hs:(7,10)-(7,21)
+
+% executing: ":uses T16804b.hs 7 10 7 25"
+% file snippet:
+> printStuff = do
+> print (testFunction A A)
+% ^~~~~~~~~~~~~~~^
+> print (testFunction2 True)
+% output:
+T16804a.hs:(13,1)-(13,12)
+T16804b.hs:(7,10)-(7,21)
+
+% executing: ":uses T16804b.hs 7 23 7 23"
+% file snippet:
+> printStuff = do
+> print (testFunction A A)
+% ^
+> print (testFunction2 True)
+% output:
+
+% executing: ":type-at T16804b.hs 8 10 8 22 undefined"
+% file snippet:
+> print (testFunction A A)
+> print (testFunction2 True)
+% ^~~~~~~~~~~~^
+> print (testFunction2 False)
+% output:
+undefined :: Bool -> Test
+
+% executing: ":type-at T16804b.hs 8 10 8 27 undefined"
+% file snippet:
+> print (testFunction A A)
+> print (testFunction2 True)
+% ^~~~~~~~~~~~~~~~~^
+> print (testFunction2 False)
+% output:
+undefined :: Test
+
+% executing: ":type-at T16804b.hs 10 9 10 17 undefined"
+% file snippet:
+> print (testFunction2 False)
+> print niceValue
+% ^~~~~~~~^
+% output:
+undefined :: Int
+
+% executing: ":uses T16804b.hs 10 9 10 17"
+% file snippet:
+> print (testFunction2 False)
+> print niceValue
+% ^~~~~~~~^
+% output:
+T16804a.hs:(22,1)-(22,9)
+T16804b.hs:(10,9)-(10,17)
+
+% executing: ":uses T16804c.hs 5 1 5 1"
+% file snippet:
+>
+> a :: Test
+% ^
+> a = A
+% output:
+
+% executing: ":uses T16804c.hs 6 1 6 1"
+% file snippet:
+> a :: Test
+> a = A
+% ^
+>
+% output:
+T16804c.hs:(6,1)-(6,1)
+T16804c.hs:(6,1)-(6,1)
+
+% executing: ":uses T16804c.hs 9 12 9 14"
+% file snippet:
+> localScope :: Test -> Bool
+> localScope arg = testFunction a arg
+% ^~^
+>
+% output:
+T16804c.hs:(9,12)-(9,14)
+T16804c.hs:(9,33)-(9,35)
+T16804c.hs:(9,12)-(9,14)
+
+% executing: ":uses T16804c.hs 9 31 9 31"
+% file snippet:
+> localScope :: Test -> Bool
+> localScope arg = testFunction a arg
+% ^
+>
+% output:
+T16804c.hs:(6,1)-(6,1)
+T16804c.hs:(9,31)-(9,31)
+
+% executing: ":uses T16804c.hs 9 33 9 35"
+% file snippet:
+> localScope :: Test -> Bool
+> localScope arg = testFunction a arg
+% ^~^
+>
+% output:
+T16804c.hs:(9,12)-(9,14)
+T16804c.hs:(9,33)-(9,35)
+T16804c.hs:(9,12)-(9,14)
+
+% executing: ":uses T16804c.hs 12 13 12 13"
+% file snippet:
+> localScope2 :: Test -> Bool
+> localScope2 a = testFunction B a
+% ^
+>
+% output:
+T16804c.hs:(12,13)-(12,13)
+T16804c.hs:(12,32)-(12,32)
+T16804c.hs:(12,13)-(12,13)
+
+% executing: ":uses T16804c.hs 12 32 12 32"
+% file snippet:
+> localScope2 :: Test -> Bool
+> localScope2 a = testFunction B a
+% ^
+>
+% output:
+T16804c.hs:(12,13)-(12,13)
+T16804c.hs:(12,32)-(12,32)
+T16804c.hs:(12,13)-(12,13)
+
+% executing: ":uses T16804c.hs 15 13 15 13"
+% file snippet:
+> localScope3 :: Test -> Bool
+> localScope3 a = testFunction a A
+% ^
+% output:
+T16804c.hs:(15,13)-(15,13)
+T16804c.hs:(15,30)-(15,30)
+T16804c.hs:(15,13)-(15,13)
+
+% executing: ":uses T16804c.hs 15 30 15 30"
+% file snippet:
+> localScope3 :: Test -> Bool
+> localScope3 a = testFunction a A
+% ^
+% output:
+T16804c.hs:(15,13)-(15,13)
+T16804c.hs:(15,30)-(15,30)
+T16804c.hs:(15,13)-(15,13)
diff --git a/testsuite/tests/ghci/scripts/T16804b.hs b/testsuite/tests/ghci/scripts/T16804b.hs
index 5868bd3fe4..b09e4b6f9c 100644
--- a/testsuite/tests/ghci/scripts/T16804b.hs
+++ b/testsuite/tests/ghci/scripts/T16804b.hs
@@ -8,4 +8,3 @@ printStuff = do
print (testFunction2 True)
print (testFunction2 False)
print niceValue
- print niceValue2
diff --git a/testsuite/tests/ghci/scripts/T16804c.hs b/testsuite/tests/ghci/scripts/T16804c.hs
new file mode 100644
index 0000000000..3183fdced8
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T16804c.hs
@@ -0,0 +1,15 @@
+module T16804c where
+
+import T16804a
+
+a :: Test
+a = A
+
+localScope :: Test -> Bool
+localScope arg = testFunction a arg
+
+localScope2 :: Test -> Bool
+localScope2 a = testFunction B a
+
+localScope3 :: Test -> Bool
+localScope3 a = testFunction a A
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index 609cbf0592..4b0234d25c 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -302,5 +302,9 @@ test('T16569', normal, ghci_script, ['T16569.script'])
test('T16767', normal, ghci_script, ['T16767.script'])
test('T16575', normal, ghci_script, ['T16575.script'])
test('T16509', normal, ghci_script, ['T16509.script'])
-test('T16804', extra_files(['T16804a.hs', 'T16804b.hs']), ghci_script, ['T16804.script'])
+# Tests :type-at and :uses
+# historical note: introduced to see the changes in the behaviour
+# when the implementation of :type-at and :uses will be/was changed
+# to use hie files
+test('T16804', extra_files(['T16804a.hs', 'T16804b.hs', 'T16804c.hs']), ghci_script, ['T16804.script'])
test('T15546', normal, ghci_script, ['T15546.script'])