[commit: ghc] master: testsuite: Add test for #15368 (49d50b2)

git at git.haskell.org git at git.haskell.org
Wed Sep 5 11:23:56 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/49d50b2b7d194dca0b23de6fe4dcc717562e90a7/ghc

>---------------------------------------------------------------

commit 49d50b2b7d194dca0b23de6fe4dcc717562e90a7
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Wed Sep 5 13:22:24 2018 +0200

    testsuite: Add test for #15368
    
    Reviewers: bgamari, osa1
    
    Reviewed By: osa1
    
    Subscribers: osa1, monoidal, rwbarton, thomie, carter
    
    GHC Trac Issues: #15368
    
    Differential Revision: https://phabricator.haskell.org/D4958


>---------------------------------------------------------------

49d50b2b7d194dca0b23de6fe4dcc717562e90a7
 testsuite/tests/typecheck/should_compile/T15368.hs | 11 ++++++
 .../tests/typecheck/should_compile/T15368.stderr   | 45 ++++++++++++++++++++++
 testsuite/tests/typecheck/should_compile/all.T     |  1 +
 3 files changed, 57 insertions(+)

diff --git a/testsuite/tests/typecheck/should_compile/T15368.hs b/testsuite/tests/typecheck/should_compile/T15368.hs
new file mode 100644
index 0000000..2db4857
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T15368.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE TypeFamilies #-}
+
+module T15368 where
+
+transitive :: (a, b) -> (b, c) -> (a, c)
+transitive = undefined
+
+trigger :: a -> b -> (F a b, F b a)
+trigger _ _ = _ `transitive` trigger _ _
+
+type family F (n :: *) (m :: *) :: *
diff --git a/testsuite/tests/typecheck/should_compile/T15368.stderr b/testsuite/tests/typecheck/should_compile/T15368.stderr
new file mode 100644
index 0000000..36650d0
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T15368.stderr
@@ -0,0 +1,45 @@
+
+T15368.hs:9:15: warning: [-Wtyped-holes (in -Wdefault)]
+    • Found hole: _ :: (F a b, F a0 b0)
+      Where: ‘a0’ is an ambiguous type variable
+             ‘b0’ is an ambiguous type variable
+             ‘a’, ‘b’ are rigid type variables bound by
+               the type signature for:
+                 trigger :: forall a b. a -> b -> (F a b, F b a)
+               at T15368.hs:8:1-35
+    • In the first argument of ‘transitive’, namely ‘_’
+      In the expression: _ `transitive` trigger _ _
+      In an equation for ‘trigger’:
+          trigger _ _ = _ `transitive` trigger _ _
+    • Relevant bindings include
+        trigger :: a -> b -> (F a b, F b a) (bound at T15368.hs:9:1)
+
+T15368.hs:9:15: warning: [-Wdeferred-type-errors (in -Wdefault)]
+    • Couldn't match type ‘F b a’ with ‘F b0 a0’
+      Expected type: (F a b, F b a)
+        Actual type: (F a b, F b0 a0)
+      NB: ‘F’ is a non-injective type family
+      The type variables ‘b0’, ‘a0’ are ambiguous
+    • In the expression: _ `transitive` trigger _ _
+      In an equation for ‘trigger’:
+          trigger _ _ = _ `transitive` trigger _ _
+    • Relevant bindings include
+        trigger :: a -> b -> (F a b, F b a) (bound at T15368.hs:9:1)
+
+T15368.hs:9:38: warning: [-Wtyped-holes (in -Wdefault)]
+    • Found hole: _ :: a0
+      Where: ‘a0’ is an ambiguous type variable
+    • In the first argument of ‘trigger’, namely ‘_’
+      In the second argument of ‘transitive’, namely ‘trigger _ _’
+      In the expression: _ `transitive` trigger _ _
+    • Relevant bindings include
+        trigger :: a -> b -> (F a b, F b a) (bound at T15368.hs:9:1)
+
+T15368.hs:9:40: warning: [-Wtyped-holes (in -Wdefault)]
+    • Found hole: _ :: b0
+      Where: ‘b0’ is an ambiguous type variable
+    • In the second argument of ‘trigger’, namely ‘_’
+      In the second argument of ‘transitive’, namely ‘trigger _ _’
+      In the expression: _ `transitive` trigger _ _
+    • Relevant bindings include
+        trigger :: a -> b -> (F a b, F b a) (bound at T15368.hs:9:1)
diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T
index c3a90ee..b9cb68e 100644
--- a/testsuite/tests/typecheck/should_compile/all.T
+++ b/testsuite/tests/typecheck/should_compile/all.T
@@ -650,3 +650,4 @@ test('T15141', normal, compile, [''])
 test('T15473', normal, compile_fail, [''])
 test('T15499', normal, compile, [''])
 test('T15586', normal, compile, [''])
+test('T15368', normal, compile, ['-fdefer-type-errors'])



More information about the ghc-commits mailing list