diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2018-01-31 14:25:50 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2018-01-31 14:27:59 +0000 |
commit | e9ae0cae9eb6a340473b339b5711ae76c6bdd045 (patch) | |
tree | ac45bed2f2371df0681f40433ebe7c072a9393c2 /testsuite | |
parent | efba054640d3418d7477316ae0c1e992d0aa0f22 (diff) | |
download | haskell-e9ae0cae9eb6a340473b339b5711ae76c6bdd045.tar.gz |
Look inside implications in simplifyRule
Trac #14732 was a perpelexing bug in which -fdefer-typed-holes
caused a mysterious type error in a RULE. This turned out to
be because we are more aggressive about creating implications
when deferring (see TcUnify.implicationNeeded), and the rule
mechanism hadn't caught up.
This fixes it.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/typecheck/should_compile/T14732.hs | 34 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/all.T | 1 |
2 files changed, 35 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T14732.hs b/testsuite/tests/typecheck/should_compile/T14732.hs new file mode 100644 index 0000000000..4fa070ed09 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T14732.hs @@ -0,0 +1,34 @@ +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# OPTIONS_GHC -fdefer-type-errors -O #-} +-- Oddly this bug was only triggered with -fdefer-type-errors +-- The -O ensures that the RULE is processed + +module T14732 where + +import Prelude hiding (zip, zipWith) + +zipWith :: (a -> b -> c) + -> Bundle v a + -> Bundle v b + -> Bundle v c +zipWith = undefined + +class GVector (v :: * -> *) a +instance GVector Vector a + +data Bundle (v :: * -> *) a +data Vector a +class Unbox a + +stream :: GVector v a => v a -> Bundle v a +{-# INLINE [1] stream #-} +stream = undefined + +zip :: (Unbox a, Unbox b) => Vector a -> Vector b -> Vector (a, b) +{-# INLINE [1] zip #-} +zip = undefined +{-# RULES "stream/zip [Vector.Unboxed]" forall as bs . + stream (zip as bs) = zipWith (,) (stream as) + (stream bs) #-} diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 9e6898190d..795e1730a9 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -591,3 +591,4 @@ test('T14488', normal, compile, ['']) test('T14590', normal, compile, ['-fdefer-type-errors -fno-max-valid-substitutions']) test('T13032', normal, compile, ['']) test('T14273', normal, compile, ['-fdefer-type-errors -fno-max-valid-substitutions']) +test('T14732', normal, compile, ['']) |