From 8168b42a95ddf37c56958955eef065eb8747470f Mon Sep 17 00:00:00 2001 From: Vladislav Zavialov Date: Wed, 30 Oct 2019 08:44:34 +0300 Subject: Whitespace-sensitive bang patterns (#1087, #17162) This patch implements a part of GHC Proposal #229 that covers five operators: * the bang operator (!) * the tilde operator (~) * the at operator (@) * the dollar operator ($) * the double dollar operator ($$) Based on surrounding whitespace, these operators are disambiguated into bang patterns, lazy patterns, strictness annotations, type applications, splices, and typed splices. This patch doesn't cover the (-) operator or the -Woperator-whitespace warning, which are left as future work. --- .../partial-sigs/should_compile/SplicesUsed.stderr | 30 +++++++++++----------- .../ExtraConstraintsWildcardInPatternSplice.stderr | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'testsuite/tests/partial-sigs') diff --git a/testsuite/tests/partial-sigs/should_compile/SplicesUsed.stderr b/testsuite/tests/partial-sigs/should_compile/SplicesUsed.stderr index 88fc8d50b9..ad78bc9729 100644 --- a/testsuite/tests/partial-sigs/should_compile/SplicesUsed.stderr +++ b/testsuite/tests/partial-sigs/should_compile/SplicesUsed.stderr @@ -1,23 +1,23 @@ [1 of 2] Compiling Splices ( Splices.hs, Splices.o ) [2 of 2] Compiling SplicesUsed ( SplicesUsed.hs, SplicesUsed.o ) -SplicesUsed.hs:7:16: warning: [-Wpartial-type-signatures (in -Wdefault)] +SplicesUsed.hs:7:15: warning: [-Wpartial-type-signatures (in -Wdefault)] • Found type wildcard ‘_’ standing for ‘Maybe Bool’ • In the type ‘_’ In the type signature: maybeBool :: (_) -SplicesUsed.hs:8:15: warning: [-Wpartial-type-signatures (in -Wdefault)] +SplicesUsed.hs:8:14: warning: [-Wpartial-type-signatures (in -Wdefault)] • Found type wildcard ‘_a’ standing for ‘_’ Where: ‘_’ is a rigid type variable bound by the inferred type of :: _ -> _ - at SplicesUsed.hs:8:15-22 + at SplicesUsed.hs:8:14-23 • In an expression type signature: _a -> _a In the expression: id :: _a -> _a In the expression: (id :: _a -> _a) (Just True :: Maybe _) • Relevant bindings include maybeBool :: Maybe Bool (bound at SplicesUsed.hs:8:1) -SplicesUsed.hs:8:27: warning: [-Wpartial-type-signatures (in -Wdefault)] +SplicesUsed.hs:8:26: warning: [-Wpartial-type-signatures (in -Wdefault)] • Found type wildcard ‘_’ standing for ‘Bool’ • In the first argument of ‘Maybe’, namely ‘_’ In the type ‘Maybe _’ @@ -25,7 +25,7 @@ SplicesUsed.hs:8:27: warning: [-Wpartial-type-signatures (in -Wdefault)] • Relevant bindings include maybeBool :: Maybe Bool (bound at SplicesUsed.hs:8:1) -SplicesUsed.hs:10:17: warning: [-Wpartial-type-signatures (in -Wdefault)] +SplicesUsed.hs:10:16: warning: [-Wpartial-type-signatures (in -Wdefault)] • Found type wildcard ‘_’ standing for ‘(Char, a)’ Where: ‘a’ is a rigid type variable bound by the inferred type of charA :: a -> (Char, a) @@ -33,7 +33,7 @@ SplicesUsed.hs:10:17: warning: [-Wpartial-type-signatures (in -Wdefault)] • In the type ‘a -> (_)’ In the type signature: charA :: a -> (_) -SplicesUsed.hs:13:14: warning: [-Wpartial-type-signatures (in -Wdefault)] +SplicesUsed.hs:13:13: warning: [-Wpartial-type-signatures (in -Wdefault)] • Found type wildcard ‘_’ standing for ‘a -> Bool’ Where: ‘a’ is a rigid type variable bound by the inferred type of filter' :: (a -> Bool) -> [a] -> [a] @@ -41,7 +41,7 @@ SplicesUsed.hs:13:14: warning: [-Wpartial-type-signatures (in -Wdefault)] • In the type ‘_ -> _ -> _’ In the type signature: filter' :: (_ -> _ -> _) -SplicesUsed.hs:13:14: warning: [-Wpartial-type-signatures (in -Wdefault)] +SplicesUsed.hs:13:13: warning: [-Wpartial-type-signatures (in -Wdefault)] • Found type wildcard ‘_’ standing for ‘[a]’ Where: ‘a’ is a rigid type variable bound by the inferred type of filter' :: (a -> Bool) -> [a] -> [a] @@ -49,7 +49,7 @@ SplicesUsed.hs:13:14: warning: [-Wpartial-type-signatures (in -Wdefault)] • In the type ‘_ -> _ -> _’ In the type signature: filter' :: (_ -> _ -> _) -SplicesUsed.hs:13:14: warning: [-Wpartial-type-signatures (in -Wdefault)] +SplicesUsed.hs:13:13: warning: [-Wpartial-type-signatures (in -Wdefault)] • Found type wildcard ‘_’ standing for ‘[a]’ Where: ‘a’ is a rigid type variable bound by the inferred type of filter' :: (a -> Bool) -> [a] -> [a] @@ -57,27 +57,27 @@ SplicesUsed.hs:13:14: warning: [-Wpartial-type-signatures (in -Wdefault)] • In the type ‘_ -> _ -> _’ In the type signature: filter' :: (_ -> _ -> _) -SplicesUsed.hs:16:3: warning: [-Wpartial-type-signatures (in -Wdefault)] +SplicesUsed.hs:16:2: warning: [-Wpartial-type-signatures (in -Wdefault)] • Found type wildcard ‘_’ standing for ‘Eq a’ Where: ‘a’ is a rigid type variable bound by the inferred type of foo :: Eq a => a -> a -> Bool - at SplicesUsed.hs:16:3-10 + at SplicesUsed.hs:16:2-11 • In the type signature: foo :: _ => _ -SplicesUsed.hs:16:3: warning: [-Wpartial-type-signatures (in -Wdefault)] +SplicesUsed.hs:16:2: warning: [-Wpartial-type-signatures (in -Wdefault)] • Found type wildcard ‘_’ standing for ‘a -> a -> Bool’ Where: ‘a’ is a rigid type variable bound by the inferred type of foo :: Eq a => a -> a -> Bool - at SplicesUsed.hs:16:3-10 + at SplicesUsed.hs:16:2-11 • In the type signature: foo :: _ => _ -SplicesUsed.hs:18:3: warning: [-Wpartial-type-signatures (in -Wdefault)] +SplicesUsed.hs:18:2: warning: [-Wpartial-type-signatures (in -Wdefault)] • Found type wildcard ‘_a’ standing for ‘Bool’ • In the type signature: bar :: _a -> _b -> (_a, _b) -SplicesUsed.hs:18:3: warning: [-Wpartial-type-signatures (in -Wdefault)] +SplicesUsed.hs:18:2: warning: [-Wpartial-type-signatures (in -Wdefault)] • Found type wildcard ‘_b’ standing for ‘_’ Where: ‘_’ is a rigid type variable bound by the inferred type of bar :: Bool -> _ -> (Bool, _) - at SplicesUsed.hs:18:3-10 + at SplicesUsed.hs:18:2-11 • In the type signature: bar :: _a -> _b -> (_a, _b) diff --git a/testsuite/tests/partial-sigs/should_fail/ExtraConstraintsWildcardInPatternSplice.stderr b/testsuite/tests/partial-sigs/should_fail/ExtraConstraintsWildcardInPatternSplice.stderr index 2426e4cd27..2a83a36cc2 100644 --- a/testsuite/tests/partial-sigs/should_fail/ExtraConstraintsWildcardInPatternSplice.stderr +++ b/testsuite/tests/partial-sigs/should_fail/ExtraConstraintsWildcardInPatternSplice.stderr @@ -1,5 +1,5 @@ -ExtraConstraintsWildcardInPatternSplice.hs:5:8: error: +ExtraConstraintsWildcardInPatternSplice.hs:5:6: error: • Found type wildcard ‘_’ standing for ‘_’ Where: ‘_’ is a rigid type variable bound by the inferred type of foo :: _ -> () -- cgit v1.2.1