[commit: ghc] wip/hasfield: Adapt ORF/OL tests (c6f7c45)
git at git.haskell.org
git at git.haskell.org
Sat Oct 8 16:15:36 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/hasfield
Link : http://ghc.haskell.org/trac/ghc/changeset/c6f7c45f3151886869a364ae85b86aceb0940bcb/ghc
>---------------------------------------------------------------
commit c6f7c45f3151886869a364ae85b86aceb0940bcb
Author: Adam Gundry <adam at well-typed.com>
Date: Sat Oct 8 14:54:18 2016 +0100
Adapt ORF/OL tests
>---------------------------------------------------------------
c6f7c45f3151886869a364ae85b86aceb0940bcb
.../ghci/overloadedlabelsghci01.script | 5 ++--
.../should_fail/overloadedlabelsfail01.hs | 5 ++--
.../should_fail/overloadedlabelsfail01.stderr | 29 ++++++++++------------
3 files changed, 19 insertions(+), 20 deletions(-)
diff --git a/testsuite/tests/overloadedrecflds/ghci/overloadedlabelsghci01.script b/testsuite/tests/overloadedrecflds/ghci/overloadedlabelsghci01.script
index 70efb79..7bbee54 100644
--- a/testsuite/tests/overloadedrecflds/ghci/overloadedlabelsghci01.script
+++ b/testsuite/tests/overloadedrecflds/ghci/overloadedlabelsghci01.script
@@ -3,10 +3,11 @@
:m + GHC.OverloadedLabels
:seti -XFlexibleInstances -XFlexibleContexts -XTypeFamilies -XMultiParamTypeClasses
instance IsLabel x [Char] where fromLabel = "hello"
-instance (s ~ [Char], t ~ [Char]) => IsLabel x (s -> t) where fromLabel = (++ " world")
+instance {-# OVERLAPS #-} (s ~ [Char]) => IsLabel x (s -> [Char]) where fromLabel = (++ " world")
#x :: String
-#x #y
+#x #y :: String
:{
#x
"goodbye"
+ :: String
:}
diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail01.hs b/testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail01.hs
index 361da45..ed68685 100644
--- a/testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail01.hs
+++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail01.hs
@@ -5,8 +5,9 @@ import GHC.OverloadedLabels
-- No instance for (OverloadedLabel "x" t0)
a = #x
--- No instance for (OverloadedLabel "x" (t0 -> t1), OverloadedLabel "y" t0)
-b = #x #y
+-- No instance for (OverloadedLabel "x" Int)
+b :: Int
+b = #x
-- Could not deduce (OverloadedLabel "y" t) from (OverloadedLabel "x" t)
c :: IsLabel "x" t => t
diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail01.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail01.stderr
index f938d03..6709008 100644
--- a/testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail01.stderr
+++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail01.stderr
@@ -1,31 +1,28 @@
overloadedlabelsfail01.hs:6:5: error:
- • No instance for (IsLabel "x" t2)
- arising from the overloaded label ‘#x’
+ • Ambiguous type variable ‘t0’ arising from the overloaded label ‘#x’
+ prevents the constraint ‘(IsLabel "x" t0)’ from being solved.
+ Relevant bindings include
+ a :: t0 (bound at overloadedlabelsfail01.hs:6:1)
+ Probable fix: use a type annotation to specify what ‘t0’ should be.
+ These potential instance exist:
+ instance GHC.Records.HasField x r a => IsLabel x (r -> a)
+ -- Defined in ‘GHC.OverloadedLabels’
• In the expression: #x
In an equation for ‘a’: a = #x
-overloadedlabelsfail01.hs:9:5: error:
- • No instance for (IsLabel "x" (t1 -> t0))
+overloadedlabelsfail01.hs:10:5: error:
+ • No instance for (IsLabel "x" Int)
arising from the overloaded label ‘#x’
- (maybe you haven't applied a function to enough arguments?)
• In the expression: #x
- In the expression: #x #y
- In an equation for ‘b’: b = #x #y
-
-overloadedlabelsfail01.hs:9:8: error:
- • No instance for (IsLabel "y" t1)
- arising from the overloaded label ‘#y’
- • In the first argument of ‘#x’, namely ‘#y’
- In the expression: #x #y
- In an equation for ‘b’: b = #x #y
+ In an equation for ‘b’: b = #x
-overloadedlabelsfail01.hs:13:5: error:
+overloadedlabelsfail01.hs:14:5: error:
• Could not deduce (IsLabel "y" t)
arising from the overloaded label ‘#y’
from the context: IsLabel "x" t
bound by the type signature for:
c :: IsLabel "x" t => t
- at overloadedlabelsfail01.hs:12:1-23
+ at overloadedlabelsfail01.hs:13:1-23
• In the expression: #y
In an equation for ‘c’: c = #y
More information about the ghc-commits
mailing list