diff options
Diffstat (limited to 'testsuite')
21 files changed, 255 insertions, 65 deletions
diff --git a/testsuite/tests/ghc-api/T6145.hs b/testsuite/tests/ghc-api/T6145.hs index 2b55c1267d..d771bd7cbb 100644 --- a/testsuite/tests/ghc-api/T6145.hs +++ b/testsuite/tests/ghc-api/T6145.hs @@ -41,7 +41,7 @@ main = do = not (isEmptyBag (filterBag isDataCon bs)) isDataCon (L l (f@FunBind {})) | (MG _ (L _ (m:_))) <- fun_matches f, - ((L _ (c@ConPat{})):_)<-hsLMatchPats m, + (L _ (VisPat _ (L _ (c@ConPat{}))):_)<-hsLMatchPats m, (L l _)<-pat_con c = isGoodSrcSpan (locA l) -- Check that the source location is a good one isDataCon _ diff --git a/testsuite/tests/parser/should_compile/DumpSemis.stderr b/testsuite/tests/parser/should_compile/DumpSemis.stderr index 9147e29ec4..c488bc0113 100644 --- a/testsuite/tests/parser/should_compile/DumpSemis.stderr +++ b/testsuite/tests/parser/should_compile/DumpSemis.stderr @@ -1402,12 +1402,16 @@ (NoSrcStrict)) [(L (SrcSpanAnn (EpAnnNotUsed) { DumpSemis.hs:32:3 }) - (VarPat + (VisPat (NoExtField) (L (SrcSpanAnn (EpAnnNotUsed) { DumpSemis.hs:32:3 }) - (Unqual - {OccName: x}))))] + (VarPat + (NoExtField) + (L + (SrcSpanAnn (EpAnnNotUsed) { DumpSemis.hs:32:3 }) + (Unqual + {OccName: x}))))))] (GRHSs (EpaComments []) @@ -1761,12 +1765,16 @@ (NoSrcStrict)) [(L (SrcSpanAnn (EpAnnNotUsed) { DumpSemis.hs:36:5 }) - (VarPat + (VisPat (NoExtField) (L (SrcSpanAnn (EpAnnNotUsed) { DumpSemis.hs:36:5 }) - (Unqual - {OccName: x}))))] + (VarPat + (NoExtField) + (L + (SrcSpanAnn (EpAnnNotUsed) { DumpSemis.hs:36:5 }) + (Unqual + {OccName: x}))))))] (GRHSs (EpaComments []) @@ -1849,21 +1857,25 @@ (CaseAlt) [(L (SrcSpanAnn (EpAnnNotUsed) { DumpSemis.hs:39:6 }) - (NPat - (EpAnnNotUsed) + (VisPat + (NoExtField) (L - (SrcSpanAnn + (SrcSpanAnn (EpAnnNotUsed) { DumpSemis.hs:39:6 }) + (NPat (EpAnnNotUsed) - { DumpSemis.hs:39:6 }) - (OverLit - (NoExtField) - (HsIntegral - (IL - (SourceText 0) - (False) - (0))))) - (Nothing) - (NoExtField)))] + (L + (SrcSpanAnn + (EpAnnNotUsed) + { DumpSemis.hs:39:6 }) + (OverLit + (NoExtField) + (HsIntegral + (IL + (SourceText 0) + (False) + (0))))) + (Nothing) + (NoExtField)))))] (GRHSs (EpaComments []) @@ -1918,21 +1930,25 @@ (CaseAlt) [(L (SrcSpanAnn (EpAnnNotUsed) { DumpSemis.hs:40:6 }) - (NPat - (EpAnnNotUsed) + (VisPat + (NoExtField) (L - (SrcSpanAnn + (SrcSpanAnn (EpAnnNotUsed) { DumpSemis.hs:40:6 }) + (NPat (EpAnnNotUsed) - { DumpSemis.hs:40:6 }) - (OverLit - (NoExtField) - (HsIntegral - (IL - (SourceText 1) - (False) - (1))))) - (Nothing) - (NoExtField)))] + (L + (SrcSpanAnn + (EpAnnNotUsed) + { DumpSemis.hs:40:6 }) + (OverLit + (NoExtField) + (HsIntegral + (IL + (SourceText 1) + (False) + (1))))) + (Nothing) + (NoExtField)))))] (GRHSs (EpaComments []) @@ -1989,21 +2005,25 @@ (CaseAlt) [(L (SrcSpanAnn (EpAnnNotUsed) { DumpSemis.hs:41:6 }) - (NPat - (EpAnnNotUsed) + (VisPat + (NoExtField) (L - (SrcSpanAnn + (SrcSpanAnn (EpAnnNotUsed) { DumpSemis.hs:41:6 }) + (NPat (EpAnnNotUsed) - { DumpSemis.hs:41:6 }) - (OverLit - (NoExtField) - (HsIntegral - (IL - (SourceText 2) - (False) - (2))))) - (Nothing) - (NoExtField)))] + (L + (SrcSpanAnn + (EpAnnNotUsed) + { DumpSemis.hs:41:6 }) + (OverLit + (NoExtField) + (HsIntegral + (IL + (SourceText 2) + (False) + (2))))) + (Nothing) + (NoExtField)))))] (GRHSs (EpaComments []) @@ -2062,21 +2082,25 @@ (CaseAlt) [(L (SrcSpanAnn (EpAnnNotUsed) { DumpSemis.hs:42:6 }) - (NPat - (EpAnnNotUsed) + (VisPat + (NoExtField) (L - (SrcSpanAnn + (SrcSpanAnn (EpAnnNotUsed) { DumpSemis.hs:42:6 }) + (NPat (EpAnnNotUsed) - { DumpSemis.hs:42:6 }) - (OverLit - (NoExtField) - (HsIntegral - (IL - (SourceText 3) - (False) - (3))))) - (Nothing) - (NoExtField)))] + (L + (SrcSpanAnn + (EpAnnNotUsed) + { DumpSemis.hs:42:6 }) + (OverLit + (NoExtField) + (HsIntegral + (IL + (SourceText 3) + (False) + (3))))) + (Nothing) + (NoExtField)))))] (GRHSs (EpaComments []) diff --git a/testsuite/tests/parser/should_compile/KindSigs.stderr b/testsuite/tests/parser/should_compile/KindSigs.stderr index f9b9a986e4..4d504287be 100644 --- a/testsuite/tests/parser/should_compile/KindSigs.stderr +++ b/testsuite/tests/parser/should_compile/KindSigs.stderr @@ -876,12 +876,20 @@ (NoSrcStrict)) [(L (SrcSpanAnn (EpAnnNotUsed) { KindSigs.hs:23:5 }) - (WildPat - (NoExtField))) + (VisPat + (NoExtField) + (L + (SrcSpanAnn (EpAnnNotUsed) { KindSigs.hs:23:5 }) + (WildPat + (NoExtField))))) ,(L (SrcSpanAnn (EpAnnNotUsed) { KindSigs.hs:23:7 }) - (WildPat - (NoExtField)))] + (VisPat + (NoExtField) + (L + (SrcSpanAnn (EpAnnNotUsed) { KindSigs.hs:23:7 }) + (WildPat + (NoExtField)))))] (GRHSs (EpaComments []) diff --git a/testsuite/tests/parser/should_fail/T17594b.hs b/testsuite/tests/parser/should_fail/T17594b.hs new file mode 100644 index 0000000000..c0f92f9b26 --- /dev/null +++ b/testsuite/tests/parser/should_fail/T17594b.hs @@ -0,0 +1,6 @@ +module T17594b where + +foo :: forall a. a -> a +foo @a = + case a of + @a -> id diff --git a/testsuite/tests/parser/should_fail/T17594b.stderr b/testsuite/tests/parser/should_fail/T17594b.stderr new file mode 100644 index 0000000000..a41e27242e --- /dev/null +++ b/testsuite/tests/parser/should_fail/T17594b.stderr @@ -0,0 +1,9 @@ + +T17594b.hs:5:3: error: + Unexpected case expression in function application: + case a of {} + Suggested fixes: + • Use parentheses. + • Perhaps you intended to use BlockArguments + +T17594b.hs:6:8: error: parse error on input ‘->’ diff --git a/testsuite/tests/parser/should_fail/T17594c.hs b/testsuite/tests/parser/should_fail/T17594c.hs new file mode 100644 index 0000000000..1cb84bccb7 --- /dev/null +++ b/testsuite/tests/parser/should_fail/T17594c.hs @@ -0,0 +1,6 @@ +module T17594c where + +foo :: forall a m. Monad m => a -> m a +foo x = do + @a <- undefined + return (x :: a) diff --git a/testsuite/tests/parser/should_fail/T17594c.stderr b/testsuite/tests/parser/should_fail/T17594c.stderr new file mode 100644 index 0000000000..d93da5d6a5 --- /dev/null +++ b/testsuite/tests/parser/should_fail/T17594c.stderr @@ -0,0 +1,11 @@ + +T17594c.hs:4:9: error: + Unexpected do block in function application: + do + Suggested fixes: + • Use parentheses. + • Perhaps you intended to use BlockArguments + +T17594c.hs:5:6: error: + parse error on input ‘<-’ + Suggested fix: Possibly caused by a missing 'do'? diff --git a/testsuite/tests/parser/should_fail/T17594e.hs b/testsuite/tests/parser/should_fail/T17594e.hs new file mode 100644 index 0000000000..92608eddec --- /dev/null +++ b/testsuite/tests/parser/should_fail/T17594e.hs @@ -0,0 +1,5 @@ +module T17594e where + +thing :: forall a b. (a -> b) -> a -> b +thing @a @b f x = f x +thing @a = \ @b f x -> f x diff --git a/testsuite/tests/parser/should_fail/T17594e.stderr b/testsuite/tests/parser/should_fail/T17594e.stderr new file mode 100644 index 0000000000..543113b4a5 --- /dev/null +++ b/testsuite/tests/parser/should_fail/T17594e.stderr @@ -0,0 +1,5 @@ + +T17594e.hs:4:1: error: + Equations for ‘thing’ have different numbers of arguments + T17594e.hs:4:1-21 + T17594e.hs:5:1-26 diff --git a/testsuite/tests/parser/should_fail/T18251d.stderr b/testsuite/tests/parser/should_fail/T18251d.stderr index 15825502e0..bf82c53290 100644 --- a/testsuite/tests/parser/should_fail/T18251d.stderr +++ b/testsuite/tests/parser/should_fail/T18251d.stderr @@ -1,4 +1,6 @@ T18251d.hs:6:1: error: - Parse error in pattern: f @a - Type applications in patterns are only allowed on data constructors. + • @-binders in functions are not allowed yet + • In an equation for ‘f’: f @a _ = () + The equation for ‘f’ has two value arguments, + but its type ‘a -> ()’ has only one diff --git a/testsuite/tests/parser/should_fail/all.T b/testsuite/tests/parser/should_fail/all.T index 4d70833bed..786b9829fe 100644 --- a/testsuite/tests/parser/should_fail/all.T +++ b/testsuite/tests/parser/should_fail/all.T @@ -208,3 +208,6 @@ test('OpaqueParseFail4', normal, compile_fail, ['']) test('T20385A', normal, compile_fail, ['']) test('T20385B', normal, compile_fail, ['']) test('T16999', normal, compile_fail, ['']) +test('T17594b', normal, compile_fail, ['']) +test('T17594c', normal, compile_fail, ['']) +test('T17594e', normal, compile_fail, ['']) diff --git a/testsuite/tests/typecheck/should_fail/T17594a.hs b/testsuite/tests/typecheck/should_fail/T17594a.hs new file mode 100644 index 0000000000..c43d362a3c --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T17594a.hs @@ -0,0 +1,13 @@ +module T17594a where + +id1 :: forall a. a -> a +id1 @a x = x + +id2 :: forall a. a -> a +id2 @_ x = x + +id3 :: forall a. a -> a +id3 @a (x :: a) = x + +const' :: forall a. a -> forall b. b -> a +const' @a x @b y = x diff --git a/testsuite/tests/typecheck/should_fail/T17594a.stderr b/testsuite/tests/typecheck/should_fail/T17594a.stderr new file mode 100644 index 0000000000..9302796ce4 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T17594a.stderr @@ -0,0 +1,24 @@ + +T17594a.hs:4:1: error: + • @-binders in functions are not allowed yet + • In an equation for ‘id1’: id1 @a x = x + The equation for ‘id1’ has two value arguments, + but its type ‘a -> a’ has only one + +T17594a.hs:7:1: error: + • @-binders in functions are not allowed yet + • In an equation for ‘id2’: id2 @_ x = x + The equation for ‘id2’ has two value arguments, + but its type ‘a -> a’ has only one + +T17594a.hs:10:1: error: + • @-binders in functions are not allowed yet + • In an equation for ‘id3’: id3 @a (x :: a) = x + The equation for ‘id3’ has two value arguments, + but its type ‘a -> a’ has only one + +T17594a.hs:13:1: error: + • @-binders in functions are not allowed yet + • In an equation for ‘const'’: const' @a x @b y = x + The equation for ‘const'’ has four value arguments, + but its type ‘a -> b -> a’ has only two diff --git a/testsuite/tests/typecheck/should_fail/T17594b.hs b/testsuite/tests/typecheck/should_fail/T17594b.hs new file mode 100644 index 0000000000..cb7013efd0 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T17594b.hs @@ -0,0 +1,6 @@ +module T17594b where + +f :: forall a. a -> a +f @x = + case x of + @a -> id diff --git a/testsuite/tests/typecheck/should_fail/T17594d.hs b/testsuite/tests/typecheck/should_fail/T17594d.hs new file mode 100644 index 0000000000..f5abd04710 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T17594d.hs @@ -0,0 +1,13 @@ +module T17594d where + +thing :: forall k (a :: k) b. (a -> b) -> a -> b +thing @k @(a :: k) f x = f x + +thing' :: forall k (a :: k) b. (a -> b) -> a -> b +thing' @_ @a f x = f x + +thing'' :: forall k (a :: k) b. (a -> b) -> a -> b +thing'' @k @_ f x = f x + +thing''' :: forall k (a :: k) b. (a -> b) -> a -> b +thing''' @_ @_ f x = f x diff --git a/testsuite/tests/typecheck/should_fail/T17594d.stderr b/testsuite/tests/typecheck/should_fail/T17594d.stderr new file mode 100644 index 0000000000..9db8658992 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T17594d.stderr @@ -0,0 +1,2 @@ + +T17594d.hs:4:1: error: Parse error in pattern: thing diff --git a/testsuite/tests/typecheck/should_fail/T17594f.hs b/testsuite/tests/typecheck/should_fail/T17594f.hs new file mode 100644 index 0000000000..32578e6193 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T17594f.hs @@ -0,0 +1,13 @@ +module T17594f where + +id1 :: forall a. a -> a +id1 = \ @a x -> x + +id2 :: forall a. a -> a +id2 = \ @_ x -> x + +id3 :: forall a. a -> a +id3 = \ @a (x :: a) -> x + +const' :: forall a. a -> forall b. b -> a +const' = \ @a x @b y -> x diff --git a/testsuite/tests/typecheck/should_fail/T17594f.stderr b/testsuite/tests/typecheck/should_fail/T17594f.stderr new file mode 100644 index 0000000000..4691dd86b0 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T17594f.stderr @@ -0,0 +1,30 @@ + +T17594f.hs:4:7: error: + • @-binders in functions are not allowed yet + • The lambda expression ‘\ @a x -> x’ has two value arguments, + but its type ‘a -> a’ has only one + In the expression: \ @a x -> x + In an equation for ‘id1’: id1 = \ @a x -> x + +T17594f.hs:7:7: error: + • @-binders in functions are not allowed yet + • The lambda expression ‘\ @_ x -> x’ has two value arguments, + but its type ‘a -> a’ has only one + In the expression: \ @_ x -> x + In an equation for ‘id2’: id2 = \ @_ x -> x + +T17594f.hs:10:7: error: + • @-binders in functions are not allowed yet + • The lambda expression ‘\ @a (x :: a) -> x’ + has two value arguments, + but its type ‘a -> a’ has only one + In the expression: \ @a (x :: a) -> x + In an equation for ‘id3’: id3 = \ @a (x :: a) -> x + +T17594f.hs:13:10: error: + • @-binders in functions are not allowed yet + • The lambda expression ‘\ @a x @b y -> x’ + has four value arguments, + but its type ‘a -> b -> a’ has only two + In the expression: \ @a x @b y -> x + In an equation for ‘const'’: const' = \ @a x @b y -> x diff --git a/testsuite/tests/typecheck/should_fail/T17594g.hs b/testsuite/tests/typecheck/should_fail/T17594g.hs new file mode 100644 index 0000000000..63bf8346fa --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T17594g.hs @@ -0,0 +1,4 @@ +module T17594g where + +comp :: forall a b c. (a -> b) -> (b -> c) -> a -> c +comp @(a :: Type) @(b :: Type) @(c :: Type) = \ f g x -> g (f x) diff --git a/testsuite/tests/typecheck/should_fail/T17594g.stderr b/testsuite/tests/typecheck/should_fail/T17594g.stderr new file mode 100644 index 0000000000..c4f35d2f3a --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T17594g.stderr @@ -0,0 +1,2 @@ + +T17594g.hs:4:1: error: Parse error in pattern: comp diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 457e0c5bc1..de1ba1bb45 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -657,3 +657,7 @@ test('T20768_fail', normal, compile_fail, ['']) test('T21327', normal, compile_fail, ['']) test('T21338', normal, compile_fail, ['']) test('T21158', normal, compile_fail, ['']) +test('T17594a', normal, compile_fail, ['']) +test('T17594d', normal, compile_fail, ['']) +test('T17594f', normal, compile_fail, ['']) +test('T17594g', normal, compile_fail, ['']) |