summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/T13651.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2018-01-31 13:05:13 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2018-01-31 13:24:23 +0000
commitefba054640d3418d7477316ae0c1e992d0aa0f22 (patch)
tree25d887fe807edc6c1f53b0d74dde92bfc7d4572f /testsuite/tests/typecheck/should_compile/T13651.hs
parent0f43d0dba3da7b16f6d3fd2e7cb6e62ac524eb04 (diff)
downloadhaskell-efba054640d3418d7477316ae0c1e992d0aa0f22.tar.gz
Prioritise equalities when solving, incl deriveds
We already prioritise equalities when solving, but Trac #14723 showed that we were not doing so consistently enough, and as a result the type checker could go into a loop. Yikes. See Note [Prioritise equalities] in TcSMonad. Fixng this bug changed the solve order enough to demonstrate a problem with fundeps: Trac #14745.
Diffstat (limited to 'testsuite/tests/typecheck/should_compile/T13651.hs')
-rw-r--r--testsuite/tests/typecheck/should_compile/T13651.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T13651.hs b/testsuite/tests/typecheck/should_compile/T13651.hs
index 43ae633534..63bd88eb5c 100644
--- a/testsuite/tests/typecheck/should_compile/T13651.hs
+++ b/testsuite/tests/typecheck/should_compile/T13651.hs
@@ -12,3 +12,24 @@ foo :: (F cr cu ~ Bar h (Bar r u),
F cu cs ~ Bar (Foo h) (Bar u s))
=> Bar h (Bar r u) -> Bar (Foo h) (Bar u s) -> Foo (cr -> cs)
foo = undefined
+
+{- Typechecking this program used to /just/ succeed in GHC 8.2,
+ (see Trac #14745 for why), but doesn't in 8.4.
+
+[G] F cr cu ~ Bar h (Bar r u),
+ F cu cs ~ Bar (Foo h) (Bar u s))
+
+
+[W] F cr cu0 ~ Bar h (Bar r u)
+ --> (top-level fundeps) cr ~ Bar h (Foo r)
+ cu0 ~ Bar h (Foo u)
+ (local fundeps) cu ~ cu0
+
+[W] F cu0 cs ~ Bar (Foo h) (Bar u s)
+ --> (top-level fundeps) cu0 ~ Bar (Foo h) (Foo u)
+ cs ~ Bar (Foo h) (Foo s)
+ (local fundeps) cu0 ~ cu
+
+[W] F cr (Bar (Foo h) (Fo u)) ~ Bar h (Bar r u)
+
+-}