summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2018-11-15 09:02:11 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2018-11-15 11:50:52 +0000
commitae2c9b40f5b6bf272251d1f4107c60003f541b62 (patch)
treeeb786f1cd10c872df876871a44baf7a2ef97abef /testsuite
parent0ce66be953becf7c9de3cbea406953306b4db3b1 (diff)
downloadhaskell-ae2c9b40f5b6bf272251d1f4107c60003f541b62.tar.gz
Smarter HsType pretty-print for promoted datacons
Fix Trac #15898, by being smarter about when to print a space before a promoted data constructor, in a HsType. I had to implement a mildly tiresome function HsType.lhsTypeHasLeadingPromotionQuote It has multiple cases, of course, but it's very simple. The patch improves the error-message output in a bunch of cases, and (to my surprise) actually fixes a bug in the output of T14343 (Trac #14343), thus - In the expression: _ :: Proxy '('( 'True, 'False), 'False) + In the expression: _ :: Proxy '( '( 'True, 'False), 'False) I discovered that there were two copies of the PromotionFlag type (a boolean, with helpfully named data cons), one in IfaceType and one in HsType. So I combined into one, PromotionFlag, and moved it to BasicTypes. That's why quite a few files are touched, but it's all routine.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/dependent/should_fail/PromotedClass.stderr4
-rw-r--r--testsuite/tests/dependent/should_fail/T15245.stderr6
-rw-r--r--testsuite/tests/ghci/scripts/T15898.script6
-rw-r--r--testsuite/tests/ghci/scripts/T15898.stdout1
-rwxr-xr-xtestsuite/tests/ghci/scripts/all.T1
-rw-r--r--testsuite/tests/parser/should_compile/DumpParsedAst.stderr2
-rw-r--r--testsuite/tests/parser/should_compile/DumpRenamedAst.stderr2
-rw-r--r--testsuite/tests/parser/should_compile/KindSigs.stderr2
-rw-r--r--testsuite/tests/polykinds/PolyKinds07.stderr12
-rw-r--r--testsuite/tests/polykinds/T10503.stderr2
-rw-r--r--testsuite/tests/polykinds/T15116a.stderr4
-rw-r--r--testsuite/tests/polykinds/T7433.stderr2
-rw-r--r--testsuite/tests/printer/T14343.stderr8
-rw-r--r--testsuite/tests/printer/T14343b.stderr12
-rw-r--r--testsuite/tests/typecheck/should_fail/T14607.stderr12
15 files changed, 42 insertions, 34 deletions
diff --git a/testsuite/tests/dependent/should_fail/PromotedClass.stderr b/testsuite/tests/dependent/should_fail/PromotedClass.stderr
index 4da1a32fca..9f8d84a410 100644
--- a/testsuite/tests/dependent/should_fail/PromotedClass.stderr
+++ b/testsuite/tests/dependent/should_fail/PromotedClass.stderr
@@ -2,5 +2,5 @@
PromotedClass.hs:10:15: error:
• Data constructor ‘MkX’ cannot be used here
(it has an unpromotable context ‘Show a’)
- • In the first argument of ‘Proxy’, namely ‘( 'MkX 'True)’
- In the type signature: foo :: Proxy ( 'MkX 'True)
+ • In the first argument of ‘Proxy’, namely ‘('MkX 'True)’
+ In the type signature: foo :: Proxy ('MkX 'True)
diff --git a/testsuite/tests/dependent/should_fail/T15245.stderr b/testsuite/tests/dependent/should_fail/T15245.stderr
index b41076636f..859fafda8b 100644
--- a/testsuite/tests/dependent/should_fail/T15245.stderr
+++ b/testsuite/tests/dependent/should_fail/T15245.stderr
@@ -2,6 +2,6 @@
T15245.hs:10:24: error:
• Data constructor ‘MkK’ cannot be used here
(it comes from a data family instance)
- • In the type ‘ 'MkK’
- In the first argument of ‘print’, namely ‘(typeRep @ 'MkK)’
- In the expression: print (typeRep @ 'MkK)
+ • In the type ‘'MkK’
+ In the first argument of ‘print’, namely ‘(typeRep @'MkK)’
+ In the expression: print (typeRep @'MkK)
diff --git a/testsuite/tests/ghci/scripts/T15898.script b/testsuite/tests/ghci/scripts/T15898.script
new file mode 100644
index 0000000000..930b319124
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T15898.script
@@ -0,0 +1,6 @@
+:set -XDataKinds
+import Data.Proxy
+undefined :: '()
+undefined :: Proxy '() Int
+undefined :: [(), ()]
+undefined :: '( '[], '[] )
diff --git a/testsuite/tests/ghci/scripts/T15898.stdout b/testsuite/tests/ghci/scripts/T15898.stdout
new file mode 100644
index 0000000000..0519ecba6e
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T15898.stdout
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index 97ae8bb26f..493daa4412 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -288,3 +288,4 @@ test('T15568', normal, ghci_script, ['T15568.script'])
test('T15325', normal, ghci_script, ['T15325.script'])
test('T15591', normal, ghci_script, ['T15591.script'])
test('T15743b', normal, ghci_script, ['T15743b.script'])
+test('T15898', normal, ghci_script, ['T15898.script'])
diff --git a/testsuite/tests/parser/should_compile/DumpParsedAst.stderr b/testsuite/tests/parser/should_compile/DumpParsedAst.stderr
index 4648baa1f1..408f28b4f7 100644
--- a/testsuite/tests/parser/should_compile/DumpParsedAst.stderr
+++ b/testsuite/tests/parser/should_compile/DumpParsedAst.stderr
@@ -145,7 +145,7 @@
[({ DumpParsedAst.hs:9:10-12 }
(HsExplicitListTy
(NoExt)
- (Promoted)
+ (IsPromoted)
[]))]
(Prefix)
({ DumpParsedAst.hs:9:21-24 }
diff --git a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
index 5c1a03e091..5a35b0037c 100644
--- a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
+++ b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
@@ -191,7 +191,7 @@
[({ DumpRenamedAst.hs:12:10-12 }
(HsExplicitListTy
(NoExt)
- (Promoted)
+ (IsPromoted)
[]))]
(Prefix)
({ DumpRenamedAst.hs:12:21-24 }
diff --git a/testsuite/tests/parser/should_compile/KindSigs.stderr b/testsuite/tests/parser/should_compile/KindSigs.stderr
index 71a54b085a..ebbec08ad5 100644
--- a/testsuite/tests/parser/should_compile/KindSigs.stderr
+++ b/testsuite/tests/parser/should_compile/KindSigs.stderr
@@ -377,7 +377,7 @@
({ KindSigs.hs:26:13-29 }
(HsExplicitListTy
(NoExt)
- (Promoted)
+ (IsPromoted)
[({ KindSigs.hs:26:16-27 }
(HsKindSig
(NoExt)
diff --git a/testsuite/tests/polykinds/PolyKinds07.stderr b/testsuite/tests/polykinds/PolyKinds07.stderr
index ce70e7d07a..596cae306e 100644
--- a/testsuite/tests/polykinds/PolyKinds07.stderr
+++ b/testsuite/tests/polykinds/PolyKinds07.stderr
@@ -1,7 +1,7 @@
-PolyKinds07.hs:10:11:
- Data constructor ‘A1’ cannot be used here
- (it is defined and used in the same recursive group)
- In the first argument of ‘B’, namely ‘ 'A1’
- In the type ‘B 'A1’
- In the definition of data constructor ‘B1’
+PolyKinds07.hs:10:11: error:
+ • Data constructor ‘A1’ cannot be used here
+ (it is defined and used in the same recursive group)
+ • In the first argument of ‘B’, namely ‘'A1’
+ In the type ‘B 'A1’
+ In the definition of data constructor ‘B1’
diff --git a/testsuite/tests/polykinds/T10503.stderr b/testsuite/tests/polykinds/T10503.stderr
index 2309cdaaae..9fb87e9be7 100644
--- a/testsuite/tests/polykinds/T10503.stderr
+++ b/testsuite/tests/polykinds/T10503.stderr
@@ -13,5 +13,5 @@ T10503.hs:8:6: error:
To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
In the type signature:
h :: forall r.
- (Proxy ( 'KProxy :: KProxy k) ~ Proxy ( 'KProxy :: KProxy *) => r)
+ (Proxy ('KProxy :: KProxy k) ~ Proxy ('KProxy :: KProxy *) => r)
-> r
diff --git a/testsuite/tests/polykinds/T15116a.stderr b/testsuite/tests/polykinds/T15116a.stderr
index 7e4788f5b8..148432f5ca 100644
--- a/testsuite/tests/polykinds/T15116a.stderr
+++ b/testsuite/tests/polykinds/T15116a.stderr
@@ -2,6 +2,6 @@
T15116a.hs:6:21: error:
• Data constructor ‘MkB’ cannot be used here
(it is defined and used in the same recursive group)
- • In the first argument of ‘Proxy’, namely ‘ 'MkB’
- In the type ‘(Proxy 'MkB)’
+ • In the first argument of ‘Proxy’, namely ‘'MkB’
+ In the type ‘(Proxy 'MkB)’
In the definition of data constructor ‘MkB’
diff --git a/testsuite/tests/polykinds/T7433.stderr b/testsuite/tests/polykinds/T7433.stderr
index 4dce12a653..317a9a4595 100644
--- a/testsuite/tests/polykinds/T7433.stderr
+++ b/testsuite/tests/polykinds/T7433.stderr
@@ -2,5 +2,5 @@
T7433.hs:2:10: error:
• Data constructor ‘Z’ cannot be used here
(perhaps you intended to use DataKinds)
- • In the type ‘ 'Z’
+ • In the type ‘'Z’
In the type declaration for ‘T’
diff --git a/testsuite/tests/printer/T14343.stderr b/testsuite/tests/printer/T14343.stderr
index 1bceb67403..5865669302 100644
--- a/testsuite/tests/printer/T14343.stderr
+++ b/testsuite/tests/printer/T14343.stderr
@@ -13,8 +13,8 @@ T14343.hs:10:9: error:
T14343.hs:11:9: error:
• Found hole: _ :: Proxy '[ '[1]]
- • In the expression: _ :: Proxy '['[1]]
- In an equation for ‘test2’: test2 = _ :: Proxy '['[1]]
+ • In the expression: _ :: Proxy '[ '[1]]
+ In an equation for ‘test2’: test2 = _ :: Proxy '[ '[1]]
• Relevant bindings include
test2 :: Proxy '[ '[1]] (bound at T14343.hs:11:1)
Valid hole fits include
@@ -25,8 +25,8 @@ T14343.hs:11:9: error:
T14343.hs:12:9: error:
• Found hole: _ :: Proxy '[ '("Symbol", 1)]
- • In the expression: _ :: Proxy '['("Symbol", 1)]
- In an equation for ‘test3’: test3 = _ :: Proxy '['("Symbol", 1)]
+ • In the expression: _ :: Proxy '[ '("Symbol", 1)]
+ In an equation for ‘test3’: test3 = _ :: Proxy '[ '("Symbol", 1)]
• Relevant bindings include
test3 :: Proxy '[ '("Symbol", 1)] (bound at T14343.hs:12:1)
Valid hole fits include
diff --git a/testsuite/tests/printer/T14343b.stderr b/testsuite/tests/printer/T14343b.stderr
index 1954f9465a..7573169414 100644
--- a/testsuite/tests/printer/T14343b.stderr
+++ b/testsuite/tests/printer/T14343b.stderr
@@ -1,8 +1,8 @@
T14343b.hs:10:9: error:
• Found hole: _ :: Proxy '( 'True, 'False)
- • In the expression: _ :: Proxy '( 'True, 'False)
- In an equation for ‘test1’: test1 = _ :: Proxy '( 'True, 'False)
+ • In the expression: _ :: Proxy '( 'True, 'False)
+ In an equation for ‘test1’: test1 = _ :: Proxy '( 'True, 'False)
• Relevant bindings include
test1 :: Proxy '( 'True, 'False) (bound at T14343b.hs:10:1)
Valid hole fits include
@@ -13,9 +13,9 @@ T14343b.hs:10:9: error:
T14343b.hs:11:9: error:
• Found hole: _ :: Proxy '( '( 'True, 'False), 'False)
- • In the expression: _ :: Proxy '('( 'True, 'False), 'False)
+ • In the expression: _ :: Proxy '( '( 'True, 'False), 'False)
In an equation for ‘test2’:
- test2 = _ :: Proxy '('( 'True, 'False), 'False)
+ test2 = _ :: Proxy '( '( 'True, 'False), 'False)
• Relevant bindings include
test2 :: Proxy '( '( 'True, 'False), 'False)
(bound at T14343b.hs:11:1)
@@ -28,8 +28,8 @@ T14343b.hs:11:9: error:
T14343b.hs:12:9: error:
• Found hole: _ :: Proxy '( '[1], 'False)
- • In the expression: _ :: Proxy '('[1], 'False)
- In an equation for ‘test3’: test3 = _ :: Proxy '('[1], 'False)
+ • In the expression: _ :: Proxy '( '[1], 'False)
+ In an equation for ‘test3’: test3 = _ :: Proxy '( '[1], 'False)
• Relevant bindings include
test3 :: Proxy '( '[1], 'False) (bound at T14343b.hs:12:1)
Valid hole fits include
diff --git a/testsuite/tests/typecheck/should_fail/T14607.stderr b/testsuite/tests/typecheck/should_fail/T14607.stderr
index 740f89a0d4..5e0b66a340 100644
--- a/testsuite/tests/typecheck/should_fail/T14607.stderr
+++ b/testsuite/tests/typecheck/should_fail/T14607.stderr
@@ -1,14 +1,14 @@
T14607.hs:22:9: warning: [-Wdeferred-type-errors (in -Wdefault)]
- • Expecting one more argument to ‘LamCons a '()’
- Expected a type, but ‘LamCons a '()’ has kind ‘() -> *’
- • In the type signature: mk :: LamCons a '()
+ • Expecting one more argument to ‘LamCons a '()’
+ Expected a type, but ‘LamCons a '()’ has kind ‘() -> *’
+ • In the type signature: mk :: LamCons a '()
In the instance declaration for ‘Mk a’
T14607.hs:22:19: warning: [-Wdeferred-type-errors (in -Wdefault)]
- • Expected a type, but ‘ '()’ has kind ‘()’
- • In the second argument of ‘LamCons’, namely ‘ '()’
- In the type signature: mk :: LamCons a '()
+ • Expected a type, but ‘'()’ has kind ‘()’
+ • In the second argument of ‘LamCons’, namely ‘'()’
+ In the type signature: mk :: LamCons a '()
In the instance declaration for ‘Mk a’
T14607.hs:23:8: warning: [-Wdeferred-type-errors (in -Wdefault)]