summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2020-12-23 11:17:28 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-12-24 06:41:43 -0500
commit9809474462527d36b9e237ee7012b08e0845b714 (patch)
treec449f6f8f8dd8722e4c879c1ad86ab7772c33515
parente7d8e4eec179634b34c284c3fdb0bfd1b85f9928 (diff)
downloadhaskell-9809474462527d36b9e237ee7012b08e0845b714.tar.gz
Require ScopedTypeVariables+TypeApplications to use type applications in patterns
Fixes #19109.
-rw-r--r--compiler/GHC/Rename/Pat.hs17
-rw-r--r--testsuite/tests/hiefile/should_compile/ScopesBug.hs1
-rw-r--r--testsuite/tests/typecheck/should_compile/TyAppPat_Existential.hs1
-rw-r--r--testsuite/tests/typecheck/should_compile/TyAppPat_ExistentialMulti.hs1
-rw-r--r--testsuite/tests/typecheck/should_compile/TyAppPat_Mixed.hs1
-rw-r--r--testsuite/tests/typecheck/should_compile/TyAppPat_TH.hs1
-rw-r--r--testsuite/tests/typecheck/should_compile/TyAppPat_Universal.hs1
-rw-r--r--testsuite/tests/typecheck/should_compile/TyAppPat_UniversalMulti1.hs1
-rw-r--r--testsuite/tests/typecheck/should_compile/TyAppPat_UniversalMulti2.hs1
-rw-r--r--testsuite/tests/typecheck/should_compile/TyAppPat_UniversalMulti3.hs1
-rw-r--r--testsuite/tests/typecheck/should_compile/TyAppPat_UniversalNested.hs1
-rw-r--r--testsuite/tests/typecheck/should_compile/TyAppPat_Wildcard.hs1
-rw-r--r--testsuite/tests/typecheck/should_fail/T19109.hs5
-rw-r--r--testsuite/tests/typecheck/should_fail/T19109.stderr4
-rw-r--r--testsuite/tests/typecheck/should_fail/TyAppPat_ExistentialEscape.hs1
-rw-r--r--testsuite/tests/typecheck/should_fail/TyAppPat_ExistentialEscape.stderr10
-rw-r--r--testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearMultiAppPat.hs1
-rw-r--r--testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearMultiAppPat.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearMultiPat.hs1
-rw-r--r--testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearMultiPat.stderr8
-rw-r--r--testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearSinglePat.hs1
-rw-r--r--testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearSinglePat.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/TyAppPat_Nonmatching.hs1
-rw-r--r--testsuite/tests/typecheck/should_fail/TyAppPat_Nonmatching.stderr6
-rw-r--r--testsuite/tests/typecheck/should_fail/TyAppPat_PatternBinding.hs1
-rw-r--r--testsuite/tests/typecheck/should_fail/TyAppPat_PatternBinding.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/TyAppPat_PatternBindingExistential.hs1
-rw-r--r--testsuite/tests/typecheck/should_fail/TyAppPat_PatternBindingExistential.stderr10
-rw-r--r--testsuite/tests/typecheck/should_fail/TyAppPat_TooMany.hs2
-rw-r--r--testsuite/tests/typecheck/should_fail/TyAppPat_TooMany.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/all.T1
31 files changed, 67 insertions, 22 deletions
diff --git a/compiler/GHC/Rename/Pat.hs b/compiler/GHC/Rename/Pat.hs
index 74b93624f0..b2a3874c0a 100644
--- a/compiler/GHC/Rename/Pat.hs
+++ b/compiler/GHC/Rename/Pat.hs
@@ -78,8 +78,9 @@ import GHC.Builtin.Types ( nilDataCon )
import GHC.Core.DataCon
import qualified GHC.LanguageExtensions as LangExt
-import Control.Monad ( when, ap, guard, forM )
+import Control.Monad ( when, ap, guard, forM, unless )
import qualified Data.List.NonEmpty as NE
+import Data.Maybe
import Data.Ratio
{-
@@ -528,6 +529,7 @@ rnConPatAndThen :: NameMaker
rnConPatAndThen mk con (PrefixCon tyargs pats)
= do { con' <- lookupConCps con
+ ; liftCps check_lang_exts
; tyargs' <- forM tyargs $ \t ->
liftCpsWithCont $ rnHsPatSigTypeBindingVars HsTypeCtx t
; pats' <- rnLPatsAndThen mk pats
@@ -537,6 +539,19 @@ rnConPatAndThen mk con (PrefixCon tyargs pats)
, pat_args = PrefixCon tyargs' pats'
}
}
+ where
+ check_lang_exts :: RnM ()
+ check_lang_exts = do
+ scoped_tyvars <- xoptM LangExt.ScopedTypeVariables
+ type_app <- xoptM LangExt.TypeApplications
+ unless (scoped_tyvars && type_app) $
+ case listToMaybe tyargs of
+ Nothing -> pure ()
+ Just tyarg -> addErr $
+ hang (text "Illegal visible type application in a pattern:"
+ <+> quotes (char '@' <> ppr tyarg))
+ 2 (text "Both ScopedTypeVariables and TypeApplications are"
+ <+> text "required to use this feature")
rnConPatAndThen mk con (InfixCon pat1 pat2)
= do { con' <- lookupConCps con
diff --git a/testsuite/tests/hiefile/should_compile/ScopesBug.hs b/testsuite/tests/hiefile/should_compile/ScopesBug.hs
index ea87d308d4..268216ad6e 100644
--- a/testsuite/tests/hiefile/should_compile/ScopesBug.hs
+++ b/testsuite/tests/hiefile/should_compile/ScopesBug.hs
@@ -3,6 +3,7 @@
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE PolyKinds #-}
+{-# LANGUAGE TypeApplications #-}
module ScopesBug where
diff --git a/testsuite/tests/typecheck/should_compile/TyAppPat_Existential.hs b/testsuite/tests/typecheck/should_compile/TyAppPat_Existential.hs
index 7411ba07ee..6c3963655e 100644
--- a/testsuite/tests/typecheck/should_compile/TyAppPat_Existential.hs
+++ b/testsuite/tests/typecheck/should_compile/TyAppPat_Existential.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ExistentialQuantification #-}
+{-# LANGUAGE ScopedTypeVariables #-}
module Main where
diff --git a/testsuite/tests/typecheck/should_compile/TyAppPat_ExistentialMulti.hs b/testsuite/tests/typecheck/should_compile/TyAppPat_ExistentialMulti.hs
index 7e207c312a..7fe9021dc2 100644
--- a/testsuite/tests/typecheck/should_compile/TyAppPat_ExistentialMulti.hs
+++ b/testsuite/tests/typecheck/should_compile/TyAppPat_ExistentialMulti.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ExistentialQuantification #-}
+{-# LANGUAGE ScopedTypeVariables #-}
module Main where
diff --git a/testsuite/tests/typecheck/should_compile/TyAppPat_Mixed.hs b/testsuite/tests/typecheck/should_compile/TyAppPat_Mixed.hs
index 47812d994d..8c50ec96c4 100644
--- a/testsuite/tests/typecheck/should_compile/TyAppPat_Mixed.hs
+++ b/testsuite/tests/typecheck/should_compile/TyAppPat_Mixed.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ExistentialQuantification #-}
+{-# LANGUAGE ScopedTypeVariables #-}
module Main where
diff --git a/testsuite/tests/typecheck/should_compile/TyAppPat_TH.hs b/testsuite/tests/typecheck/should_compile/TyAppPat_TH.hs
index aeaa4fcac3..4bc7fbec7e 100644
--- a/testsuite/tests/typecheck/should_compile/TyAppPat_TH.hs
+++ b/testsuite/tests/typecheck/should_compile/TyAppPat_TH.hs
@@ -2,6 +2,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE ScopedTypeVariables #-}
module Main where
diff --git a/testsuite/tests/typecheck/should_compile/TyAppPat_Universal.hs b/testsuite/tests/typecheck/should_compile/TyAppPat_Universal.hs
index 7a74ff8403..51b3d5d404 100644
--- a/testsuite/tests/typecheck/should_compile/TyAppPat_Universal.hs
+++ b/testsuite/tests/typecheck/should_compile/TyAppPat_Universal.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ExistentialQuantification #-}
+{-# LANGUAGE ScopedTypeVariables #-}
module Main where
diff --git a/testsuite/tests/typecheck/should_compile/TyAppPat_UniversalMulti1.hs b/testsuite/tests/typecheck/should_compile/TyAppPat_UniversalMulti1.hs
index cccee20cb1..c2f67e0c94 100644
--- a/testsuite/tests/typecheck/should_compile/TyAppPat_UniversalMulti1.hs
+++ b/testsuite/tests/typecheck/should_compile/TyAppPat_UniversalMulti1.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ExistentialQuantification #-}
+{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import Data.Maybe
diff --git a/testsuite/tests/typecheck/should_compile/TyAppPat_UniversalMulti2.hs b/testsuite/tests/typecheck/should_compile/TyAppPat_UniversalMulti2.hs
index f01b606799..ac45474ad3 100644
--- a/testsuite/tests/typecheck/should_compile/TyAppPat_UniversalMulti2.hs
+++ b/testsuite/tests/typecheck/should_compile/TyAppPat_UniversalMulti2.hs
@@ -2,6 +2,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE KindSignatures #-}
+{-# LANGUAGE ScopedTypeVariables #-}
module Main where
diff --git a/testsuite/tests/typecheck/should_compile/TyAppPat_UniversalMulti3.hs b/testsuite/tests/typecheck/should_compile/TyAppPat_UniversalMulti3.hs
index 89fb88d5fe..1cebed6561 100644
--- a/testsuite/tests/typecheck/should_compile/TyAppPat_UniversalMulti3.hs
+++ b/testsuite/tests/typecheck/should_compile/TyAppPat_UniversalMulti3.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ExistentialQuantification #-}
+{-# LANGUAGE ScopedTypeVariables #-}
module Main where
diff --git a/testsuite/tests/typecheck/should_compile/TyAppPat_UniversalNested.hs b/testsuite/tests/typecheck/should_compile/TyAppPat_UniversalNested.hs
index e7f5522776..4a8764b9a2 100644
--- a/testsuite/tests/typecheck/should_compile/TyAppPat_UniversalNested.hs
+++ b/testsuite/tests/typecheck/should_compile/TyAppPat_UniversalNested.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ExistentialQuantification #-}
+{-# LANGUAGE ScopedTypeVariables #-}
module Main where
diff --git a/testsuite/tests/typecheck/should_compile/TyAppPat_Wildcard.hs b/testsuite/tests/typecheck/should_compile/TyAppPat_Wildcard.hs
index 722a9b4d63..22827f57bb 100644
--- a/testsuite/tests/typecheck/should_compile/TyAppPat_Wildcard.hs
+++ b/testsuite/tests/typecheck/should_compile/TyAppPat_Wildcard.hs
@@ -2,6 +2,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE PartialTypeSignatures #-}
+{-# LANGUAGE ScopedTypeVariables #-}
module Main where
diff --git a/testsuite/tests/typecheck/should_fail/T19109.hs b/testsuite/tests/typecheck/should_fail/T19109.hs
new file mode 100644
index 0000000000..614f883b52
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T19109.hs
@@ -0,0 +1,5 @@
+module T19109 where
+
+import Data.Functor.Identity
+
+f (Identity @Int x) = x
diff --git a/testsuite/tests/typecheck/should_fail/T19109.stderr b/testsuite/tests/typecheck/should_fail/T19109.stderr
new file mode 100644
index 0000000000..25ce535835
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T19109.stderr
@@ -0,0 +1,4 @@
+
+T19109.hs:5:4: error:
+ Illegal visible type application in a pattern: ‘@Int’
+ Both ScopedTypeVariables and TypeApplications are required to use this feature
diff --git a/testsuite/tests/typecheck/should_fail/TyAppPat_ExistentialEscape.hs b/testsuite/tests/typecheck/should_fail/TyAppPat_ExistentialEscape.hs
index d163874c8e..7ebf23ddc5 100644
--- a/testsuite/tests/typecheck/should_fail/TyAppPat_ExistentialEscape.hs
+++ b/testsuite/tests/typecheck/should_fail/TyAppPat_ExistentialEscape.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ExistentialQuantification #-}
+{-# LANGUAGE ScopedTypeVariables #-}
module Main where
diff --git a/testsuite/tests/typecheck/should_fail/TyAppPat_ExistentialEscape.stderr b/testsuite/tests/typecheck/should_fail/TyAppPat_ExistentialEscape.stderr
index 06f7c3adca..2efb51a5c1 100644
--- a/testsuite/tests/typecheck/should_fail/TyAppPat_ExistentialEscape.stderr
+++ b/testsuite/tests/typecheck/should_fail/TyAppPat_ExistentialEscape.stderr
@@ -1,15 +1,15 @@
-TyAppPat_ExistentialEscape.hs:9:20: error:
+TyAppPat_ExistentialEscape.hs:10:20: error:
• Couldn't match expected type ‘p’ with actual type ‘a’
‘a’ is a rigid type variable bound by
a pattern with constructor: Some :: forall a. a -> Some,
in an equation for ‘foo’
- at TyAppPat_ExistentialEscape.hs:9:6-14
+ at TyAppPat_ExistentialEscape.hs:10:6-14
‘p’ is a rigid type variable bound by
the inferred type of foo :: Some -> p
- at TyAppPat_ExistentialEscape.hs:9:1-26
+ at TyAppPat_ExistentialEscape.hs:10:1-26
• In the expression: x :: a
In an equation for ‘foo’: foo (Some @a x) = (x :: a)
• Relevant bindings include
- x :: a (bound at TyAppPat_ExistentialEscape.hs:9:14)
- foo :: Some -> p (bound at TyAppPat_ExistentialEscape.hs:9:1)
+ x :: a (bound at TyAppPat_ExistentialEscape.hs:10:14)
+ foo :: Some -> p (bound at TyAppPat_ExistentialEscape.hs:10:1)
diff --git a/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearMultiAppPat.hs b/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearMultiAppPat.hs
index db50abb7a5..efdcf517f9 100644
--- a/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearMultiAppPat.hs
+++ b/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearMultiAppPat.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ExistentialQuantification #-}
+{-# LANGUAGE ScopedTypeVariables #-}
module Main where
diff --git a/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearMultiAppPat.stderr b/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearMultiAppPat.stderr
index 4b891df797..87655cb6cf 100644
--- a/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearMultiAppPat.stderr
+++ b/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearMultiAppPat.stderr
@@ -1,4 +1,4 @@
-TyAppPat_NonlinearMultiAppPat.hs:12:6: error:
+TyAppPat_NonlinearMultiAppPat.hs:13:6: error:
Type variable ‘a’ is already in scope.
Type applications in patterns must bind fresh variables, without shadowing.
diff --git a/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearMultiPat.hs b/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearMultiPat.hs
index 557ebb1d97..bba6d08a11 100644
--- a/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearMultiPat.hs
+++ b/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearMultiPat.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ExistentialQuantification #-}
+{-# LANGUAGE ScopedTypeVariables #-}
module Main where
diff --git a/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearMultiPat.stderr b/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearMultiPat.stderr
index 48aeba149e..82c78654f7 100644
--- a/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearMultiPat.stderr
+++ b/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearMultiPat.stderr
@@ -1,16 +1,16 @@
-TyAppPat_NonlinearMultiPat.hs:9:19: error:
+TyAppPat_NonlinearMultiPat.hs:10:19: error:
Type variable ‘a’ is already in scope.
Type applications in patterns must bind fresh variables, without shadowing.
-TyAppPat_NonlinearMultiPat.hs:10:18: error:
+TyAppPat_NonlinearMultiPat.hs:11:18: error:
Type variable ‘a’ is already in scope.
Type applications in patterns must bind fresh variables, without shadowing.
-TyAppPat_NonlinearMultiPat.hs:11:19: error:
+TyAppPat_NonlinearMultiPat.hs:12:19: error:
Type variable ‘a’ is already in scope.
Type applications in patterns must bind fresh variables, without shadowing.
-TyAppPat_NonlinearMultiPat.hs:12:18: error:
+TyAppPat_NonlinearMultiPat.hs:13:18: error:
Type variable ‘a’ is already in scope.
Type applications in patterns must bind fresh variables, without shadowing.
diff --git a/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearSinglePat.hs b/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearSinglePat.hs
index f80e6d448c..192dfbc8e1 100644
--- a/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearSinglePat.hs
+++ b/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearSinglePat.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ExistentialQuantification #-}
+{-# LANGUAGE ScopedTypeVariables #-}
module Main where
diff --git a/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearSinglePat.stderr b/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearSinglePat.stderr
index b25bfcde34..0d06da09d2 100644
--- a/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearSinglePat.stderr
+++ b/testsuite/tests/typecheck/should_fail/TyAppPat_NonlinearSinglePat.stderr
@@ -1,3 +1,3 @@
-TyAppPat_NonlinearSinglePat.hs:12:6: error:
+TyAppPat_NonlinearSinglePat.hs:13:6: error:
Variable `a' would be bound multiple times by a type argument.
diff --git a/testsuite/tests/typecheck/should_fail/TyAppPat_Nonmatching.hs b/testsuite/tests/typecheck/should_fail/TyAppPat_Nonmatching.hs
index 7d6b8a47a5..4f03a4782e 100644
--- a/testsuite/tests/typecheck/should_fail/TyAppPat_Nonmatching.hs
+++ b/testsuite/tests/typecheck/should_fail/TyAppPat_Nonmatching.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ExistentialQuantification #-}
+{-# LANGUAGE ScopedTypeVariables #-}
module Main where
diff --git a/testsuite/tests/typecheck/should_fail/TyAppPat_Nonmatching.stderr b/testsuite/tests/typecheck/should_fail/TyAppPat_Nonmatching.stderr
index 4d70de517c..72a6e27eb8 100644
--- a/testsuite/tests/typecheck/should_fail/TyAppPat_Nonmatching.stderr
+++ b/testsuite/tests/typecheck/should_fail/TyAppPat_Nonmatching.stderr
@@ -1,11 +1,11 @@
-TyAppPat_Nonmatching.hs:8:6: error:
+TyAppPat_Nonmatching.hs:9:6: error:
• Couldn't match expected type ‘a’ with actual type ‘Int’
‘a’ is a rigid type variable bound by
the type signature for:
foo :: forall a. Maybe a -> a
- at TyAppPat_Nonmatching.hs:7:1-19
+ at TyAppPat_Nonmatching.hs:8:1-19
• In the pattern: Just @Int x
In an equation for ‘foo’: foo (Just @Int x) = x
• Relevant bindings include
- foo :: Maybe a -> a (bound at TyAppPat_Nonmatching.hs:8:1)
+ foo :: Maybe a -> a (bound at TyAppPat_Nonmatching.hs:9:1)
diff --git a/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBinding.hs b/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBinding.hs
index 978e611501..f7de9ab2de 100644
--- a/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBinding.hs
+++ b/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBinding.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ExistentialQuantification #-}
+{-# LANGUAGE ScopedTypeVariables #-}
module Main where
diff --git a/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBinding.stderr b/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBinding.stderr
index e0d18596e0..d511b93d78 100644
--- a/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBinding.stderr
+++ b/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBinding.stderr
@@ -1,5 +1,5 @@
-TyAppPat_PatternBinding.hs:8:1: error:
+TyAppPat_PatternBinding.hs:9:1: error:
• Binding type variables is not allowed in pattern bindings
• In the pattern: Just @a x
In a pattern binding: Just @a x = Just (5 :: Integer)
diff --git a/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBindingExistential.hs b/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBindingExistential.hs
index bd888b3bac..a8692f49fe 100644
--- a/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBindingExistential.hs
+++ b/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBindingExistential.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ExistentialQuantification #-}
+{-# LANGUAGE ScopedTypeVariables #-}
module Main where
diff --git a/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBindingExistential.stderr b/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBindingExistential.stderr
index 9204f8016a..86f983241b 100644
--- a/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBindingExistential.stderr
+++ b/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBindingExistential.stderr
@@ -1,22 +1,22 @@
-TyAppPat_PatternBindingExistential.hs:9:1: error:
+TyAppPat_PatternBindingExistential.hs:10:1: error:
• Binding type variables is not allowed in pattern bindings
• In the pattern: Some @a x
In a pattern binding: Some @a x = Some (5 :: Integer)
-TyAppPat_PatternBindingExistential.hs:9:9: error:
+TyAppPat_PatternBindingExistential.hs:10:9: error:
• Couldn't match expected type ‘p’ with actual type ‘a’
‘a’ is a rigid type variable bound by
a pattern with constructor: Some :: forall a. a -> Some,
in a pattern binding
- at TyAppPat_PatternBindingExistential.hs:9:1-9
+ at TyAppPat_PatternBindingExistential.hs:10:1-9
‘p’ is a rigid type variable bound by
the inferred type of x :: p
- at TyAppPat_PatternBindingExistential.hs:9:1-31
+ at TyAppPat_PatternBindingExistential.hs:10:1-31
• In the pattern: Some @a x
In a pattern binding: Some @a x = Some (5 :: Integer)
-TyAppPat_PatternBindingExistential.hs:12:3: error:
+TyAppPat_PatternBindingExistential.hs:13:3: error:
• Ambiguous type variable ‘a0’ arising from a use of ‘print’
prevents the constraint ‘(Show a0)’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
diff --git a/testsuite/tests/typecheck/should_fail/TyAppPat_TooMany.hs b/testsuite/tests/typecheck/should_fail/TyAppPat_TooMany.hs
index 03f44f052f..d69ec335b4 100644
--- a/testsuite/tests/typecheck/should_fail/TyAppPat_TooMany.hs
+++ b/testsuite/tests/typecheck/should_fail/TyAppPat_TooMany.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE TypeApplications #-}
module TyAppPat_TooMany where
f :: Maybe Int -> Int
diff --git a/testsuite/tests/typecheck/should_fail/TyAppPat_TooMany.stderr b/testsuite/tests/typecheck/should_fail/TyAppPat_TooMany.stderr
index 87e9044919..2b5e60d49b 100644
--- a/testsuite/tests/typecheck/should_fail/TyAppPat_TooMany.stderr
+++ b/testsuite/tests/typecheck/should_fail/TyAppPat_TooMany.stderr
@@ -1,5 +1,5 @@
-TyAppPat_TooMany.hs:4:4: error:
+TyAppPat_TooMany.hs:6:4: error:
• Too many type arguments in constructor pattern for ‘Just’
Expected no more than 1; got 2
• In the pattern: Just @Int @Bool x
diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T
index 3eff08d080..c55425ae3a 100644
--- a/testsuite/tests/typecheck/should_fail/all.T
+++ b/testsuite/tests/typecheck/should_fail/all.T
@@ -593,6 +593,7 @@ test('T10709', normal, compile_fail, [''])
test('T10709b', normal, compile_fail, [''])
test('GivenForallLoop', normal, compile_fail, [''])
test('T18891a', normal, compile_fail, [''])
+test('T19109', normal, compile_fail, [''])
test('TyAppPat_ExistentialEscape', normal, compile_fail, [''])
test('TyAppPat_MisplacedApplication', normal, compile_fail, [''])
test('TyAppPat_NonlinearMultiAppPat', normal, compile_fail, [''])