summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2018-09-05 13:22:24 +0200
committerKrzysztof Gogolewski <krz.gogolewski@gmail.com>2018-09-05 13:23:23 +0200
commit49d50b2b7d194dca0b23de6fe4dcc717562e90a7 (patch)
tree4040cbdb9718de7a8290be9fdc529c5d9ff3e11a /testsuite
parentc0e5087d01e2912f00feede6c259a2ee87685c90 (diff)
downloadhaskell-49d50b2b7d194dca0b23de6fe4dcc717562e90a7.tar.gz
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
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/typecheck/should_compile/T15368.hs11
-rw-r--r--testsuite/tests/typecheck/should_compile/T15368.stderr45
-rw-r--r--testsuite/tests/typecheck/should_compile/all.T1
3 files changed, 57 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T15368.hs b/testsuite/tests/typecheck/should_compile/T15368.hs
new file mode 100644
index 0000000000..2db485740f
--- /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 0000000000..36650d0506
--- /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 c3a90ee24c..b9cb68eb63 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'])