summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2019-11-22 20:44:51 +0100
committerKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2019-11-25 14:37:38 +0100
commit8b8dc36653878de5556e368bd3e93abf66f839e9 (patch)
tree5b02618e49cdcf6a7dc19fa4b5567751d511faba
parentb694b5662f8c9915b1a9d072cd530cd29124194a (diff)
downloadhaskell-8b8dc36653878de5556e368bd3e93abf66f839e9.tar.gz
Remove prefix arrow support for GADTs (#17211)
This reverts the change in #9096. The specialcasing done for prefix (->) is brittle and does not support VTA, type families, type synonyms etc.
-rw-r--r--compiler/GHC/Hs/Types.hs16
-rw-r--r--testsuite/tests/gadt/T9096.hs6
-rw-r--r--testsuite/tests/gadt/all.T1
3 files changed, 0 insertions, 23 deletions
diff --git a/compiler/GHC/Hs/Types.hs b/compiler/GHC/Hs/Types.hs
index fcf22584cb..7af0a1ee4e 100644
--- a/compiler/GHC/Hs/Types.hs
+++ b/compiler/GHC/Hs/Types.hs
@@ -84,7 +84,6 @@ import Name( Name, NamedThing(getName) )
import RdrName ( RdrName )
import DataCon( HsSrcBang(..), HsImplBang(..),
SrcStrictness(..), SrcUnpackedness(..) )
-import TysPrim( funTyConName )
import TysWiredIn( mkTupleStr )
import Type
import GHC.Hs.Doc
@@ -1151,8 +1150,6 @@ mkHsAppKindTy ext ty k
-- splitHsFunType decomposes a type (t1 -> t2 ... -> tn)
-- Breaks up any parens in the result type:
-- splitHsFunType (a -> (b -> c)) = ([a,b], c)
--- Also deals with (->) t1 t2; that is why it only works on LHsType Name
--- (see #9096)
splitHsFunType :: LHsType GhcRn -> ([LHsType GhcRn], LHsType GhcRn)
splitHsFunType (L _ (HsParTy _ ty))
= splitHsFunType ty
@@ -1160,19 +1157,6 @@ splitHsFunType (L _ (HsParTy _ ty))
splitHsFunType (L _ (HsFunTy _ x y))
| (args, res) <- splitHsFunType y
= (x:args, res)
-{- This is not so correct, because it won't work with visible kind app, in case
- someone wants to write '(->) @k1 @k2 t1 t2'. Fixing this would require changing
- ConDeclGADT abstract syntax -}
-splitHsFunType orig_ty@(L _ (HsAppTy _ t1 t2))
- = go t1 [t2]
- where -- Look for (->) t1 t2, possibly with parenthesisation
- go (L _ (HsTyVar _ _ (L _ fn))) tys | fn == funTyConName
- , [t1,t2] <- tys
- , (args, res) <- splitHsFunType t2
- = (t1:args, res)
- go (L _ (HsAppTy _ t1 t2)) tys = go t1 (t2:tys)
- go (L _ (HsParTy _ ty)) tys = go ty tys
- go _ _ = ([], orig_ty) -- Failure to match
splitHsFunType other = ([], other)
diff --git a/testsuite/tests/gadt/T9096.hs b/testsuite/tests/gadt/T9096.hs
deleted file mode 100644
index d778798d36..0000000000
--- a/testsuite/tests/gadt/T9096.hs
+++ /dev/null
@@ -1,6 +0,0 @@
-{-# LANGUAGE GADTs #-}
-
-module T9096 where
-
-data Foo a where
- MkFoo :: (->) a (Foo a)
diff --git a/testsuite/tests/gadt/all.T b/testsuite/tests/gadt/all.T
index be7177445e..29bde94100 100644
--- a/testsuite/tests/gadt/all.T
+++ b/testsuite/tests/gadt/all.T
@@ -110,7 +110,6 @@ test('T7294', normal, compile, [''])
test('T7321', [], makefile_test, [])
test('T7974', normal, compile, [''])
test('T7558', normal, compile_fail, [''])
-test('T9096', normal, compile, [''])
test('T9380', normal, compile_and_run, [''])
test('T12087', normal, compile_fail, [''])
test('T12468', normal, compile_fail, [''])