From 2bcfe19e18d2d0cbf3873153fdc9eae9134418e5 Mon Sep 17 00:00:00 2001 From: Arnaud Spiwack <arnaud.spiwack@tweag.io> Date: Fri, 22 Sep 2023 16:19:22 +0200 Subject: [PATCH] fixup! Linear let and where bindings --- compiler/GHC/Hs/Binds.hs | 2 +- .../linear/should_fail/LinearLet10.stderr | 6 +---- .../linear/should_fail/LinearLet2.stderr | 13 ++-------- .../linear/should_fail/LinearLet3.stderr | 12 +++------ .../linear/should_fail/LinearLet4.stderr | 12 +++------ .../linear/should_fail/LinearLet5.stderr | 12 +++------ .../linear/should_fail/LinearLet7.stderr | 26 +++---------------- .../linear/should_fail/LinearLet9.stderr | 26 +++---------------- .../patsyn/should_fail/UnliftedPSBind.stderr | 3 +-- .../patsyn/should_fail/unboxed-bind.stderr | 3 +-- .../tests/typecheck/should_fail/T13075.stderr | 4 +-- .../tests/typecheck/should_fail/T2806.stderr | 3 +-- .../tests/typecheck/should_fail/T6078.stderr | 3 +-- .../typecheck/should_fail/tcfail203.stderr | 24 ++++++----------- 14 files changed, 37 insertions(+), 112 deletions(-) diff --git a/compiler/GHC/Hs/Binds.hs b/compiler/GHC/Hs/Binds.hs index 28f3002dd8e..5bc45f4dbc8 100644 --- a/compiler/GHC/Hs/Binds.hs +++ b/compiler/GHC/Hs/Binds.hs @@ -537,7 +537,7 @@ ppr_monobind :: forall idL idR. ppr_monobind (PatBind { pat_lhs = pat, pat_mult = mult_ann, pat_rhs = grhss }) = ppr_mult_ann @idL mult_ann - $$ pprPatBind pat grhss + <+> pprPatBind pat grhss ppr_monobind (VarBind { var_id = var, var_rhs = rhs }) = sep [pprBndr CasePatBind var, nest 2 $ equals <+> pprExpr (unLoc rhs)] ppr_monobind (FunBind { fun_id = fun, diff --git a/testsuite/tests/linear/should_fail/LinearLet10.stderr b/testsuite/tests/linear/should_fail/LinearLet10.stderr index 6cef1fe32dc..34294f2e440 100644 --- a/testsuite/tests/linear/should_fail/LinearLet10.stderr +++ b/testsuite/tests/linear/should_fail/LinearLet10.stderr @@ -3,8 +3,4 @@ LinearLet10.hs:7:12: error: [GHC-83865] • Expected kind ‘GHC.Types.Multiplicity’, but ‘Int’ has kind ‘*’ • In the type ‘Int’ In a pattern binding: y = x - In the expression: - let - %Int - y = x - in y + In the expression: let %Int y = x in y diff --git a/testsuite/tests/linear/should_fail/LinearLet2.stderr b/testsuite/tests/linear/should_fail/LinearLet2.stderr index a1e969f745a..d442c84c26d 100644 --- a/testsuite/tests/linear/should_fail/LinearLet2.stderr +++ b/testsuite/tests/linear/should_fail/LinearLet2.stderr @@ -2,14 +2,5 @@ LinearLet2.hs:5:7: error: [GHC-18872] • Couldn't match type ‘Many’ with ‘One’ arising from multiplicity of ‘y’ - • In the expression: - let - %1 - y = x - in (y, y) - In an equation for ‘f’: - f x - = let - %1 - y = x - in (y, y) + • In the expression: let %1 y = x in (y, y) + In an equation for ‘f’: f x = let %1 y = x in (y, y) diff --git a/testsuite/tests/linear/should_fail/LinearLet3.stderr b/testsuite/tests/linear/should_fail/LinearLet3.stderr index f16e1c4c322..e4e43dfc773 100644 --- a/testsuite/tests/linear/should_fail/LinearLet3.stderr +++ b/testsuite/tests/linear/should_fail/LinearLet3.stderr @@ -4,16 +4,12 @@ LinearLet3.hs:5:7: error: [GHC-18872] arising from multiplicity of ‘z’ • In the expression: let - %1 - y = x - %1 - z = y + %1 y = x + %1 z = y in (y, y) In an equation for ‘f’: f x = let - %1 - y = x - %1 - z = y + %1 y = x + %1 z = y in (y, y) diff --git a/testsuite/tests/linear/should_fail/LinearLet4.stderr b/testsuite/tests/linear/should_fail/LinearLet4.stderr index 5691620d6e5..9ba84fa3516 100644 --- a/testsuite/tests/linear/should_fail/LinearLet4.stderr +++ b/testsuite/tests/linear/should_fail/LinearLet4.stderr @@ -4,16 +4,12 @@ LinearLet4.hs:7:7: error: [GHC-18872] arising from multiplicity of ‘y’ • In the expression: let - %1 - y = x - %'Many - z = y + %1 y = x + %'Many z = y in (z, z) In an equation for ‘f’: f x = let - %1 - y = x - %'Many - z = y + %1 y = x + %'Many z = y in (z, z) diff --git a/testsuite/tests/linear/should_fail/LinearLet5.stderr b/testsuite/tests/linear/should_fail/LinearLet5.stderr index bc9f7d2a90e..662a33e350e 100644 --- a/testsuite/tests/linear/should_fail/LinearLet5.stderr +++ b/testsuite/tests/linear/should_fail/LinearLet5.stderr @@ -4,16 +4,12 @@ LinearLet5.hs:5:7: error: [GHC-18872] arising from multiplicity of ‘y’ • In the expression: let - %1 - y = x - %1 - z = y + %1 y = x + %1 z = y in (z, y) In an equation for ‘f’: f x = let - %1 - y = x - %1 - z = y + %1 y = x + %1 z = y in (z, y) diff --git a/testsuite/tests/linear/should_fail/LinearLet7.stderr b/testsuite/tests/linear/should_fail/LinearLet7.stderr index 0c4c71a77e3..260ca28b7ab 100644 --- a/testsuite/tests/linear/should_fail/LinearLet7.stderr +++ b/testsuite/tests/linear/should_fail/LinearLet7.stderr @@ -3,29 +3,11 @@ LinearLet7.hs:6:14: error: [GHC-18872] • Couldn't match type ‘Many’ with ‘One’ arising from multiplicity of ‘g’ • In a pattern binding: g = \ y -> g y - In the expression: - let - %1 - g = \ y -> ... - in g x - In an equation for ‘f’: - f x - = let - %1 - g = ... - in g x + In the expression: let %1 g = \ y -> ... in g x + In an equation for ‘f’: f x = let %1 g = ... in g x LinearLet7.hs:6:14: error: [GHC-18872] • Couldn't match type ‘Many’ with ‘One’ arising from a non-linear pattern - • In the expression: - let - %1 - g = \ y -> ... - in g x - In an equation for ‘f’: - f x - = let - %1 - g = ... - in g x + • In the expression: let %1 g = \ y -> ... in g x + In an equation for ‘f’: f x = let %1 g = ... in g x diff --git a/testsuite/tests/linear/should_fail/LinearLet9.stderr b/testsuite/tests/linear/should_fail/LinearLet9.stderr index 360b046ae20..813531df69c 100644 --- a/testsuite/tests/linear/should_fail/LinearLet9.stderr +++ b/testsuite/tests/linear/should_fail/LinearLet9.stderr @@ -2,17 +2,8 @@ LinearLet9.hs:11:14: error: [GHC-18872] • Couldn't match type ‘Many’ with ‘One’ arising from a non-linear pattern - • In the expression: - let - %1 - !(f, b) = ((\ y -> ...), b) - in (f x, b) - In an equation for ‘k’: - k x - = let - %1 - !(f, b) = ... - in (f x, b) + • In the expression: let %1 !(f, b) = ((\ y -> ...), b) in (f x, b) + In an equation for ‘k’: k x = let %1 !(f, b) = ... in (f x, b) LinearLet9.hs:11:16: error: [GHC-18872] • Couldn't match type ‘Many’ with ‘One’ @@ -31,17 +22,8 @@ LinearLet9.hs:11:19: error: [GHC-18872] LinearLet9.hs:18:14: error: [GHC-18872] • Couldn't match type ‘Many’ with ‘One’ arising from a non-linear pattern - • In the expression: - let - %1 - !(Just y) = x - in y - In an equation for ‘i’: - i x - = let - %1 - !(Just y) = x - in y + • In the expression: let %1 !(Just y) = x in y + In an equation for ‘i’: i x = let %1 !(Just y) = x in y LinearLet9.hs:21:3: error: [GHC-18872] • Couldn't match type ‘Many’ with ‘One’ diff --git a/testsuite/tests/patsyn/should_fail/UnliftedPSBind.stderr b/testsuite/tests/patsyn/should_fail/UnliftedPSBind.stderr index 6b4f1d80430..3f76e344e44 100644 --- a/testsuite/tests/patsyn/should_fail/UnliftedPSBind.stderr +++ b/testsuite/tests/patsyn/should_fail/UnliftedPSBind.stderr @@ -2,5 +2,4 @@ UnliftedPSBind.hs:12:9: error: [GHC-21030] [-Wunbanged-strict-patterns (in -Wextra), Werror=unbanged-strict-patterns] Pattern bindings containing unlifted types should use an outermost bang pattern: - Many - P x = P 4# + Many P x = P 4# diff --git a/testsuite/tests/patsyn/should_fail/unboxed-bind.stderr b/testsuite/tests/patsyn/should_fail/unboxed-bind.stderr index cd528c54792..53a8eb7a793 100644 --- a/testsuite/tests/patsyn/should_fail/unboxed-bind.stderr +++ b/testsuite/tests/patsyn/should_fail/unboxed-bind.stderr @@ -2,5 +2,4 @@ unboxed-bind.hs:11:11: error: [GHC-21030] [-Wunbanged-strict-patterns (in -Wextra), Werror=unbanged-strict-patterns] Pattern bindings containing unlifted types should use an outermost bang pattern: - Many - P arg = x + Many P arg = x diff --git a/testsuite/tests/typecheck/should_fail/T13075.stderr b/testsuite/tests/typecheck/should_fail/T13075.stderr index 286054d9ce6..9075f399f4b 100644 --- a/testsuite/tests/typecheck/should_fail/T13075.stderr +++ b/testsuite/tests/typecheck/should_fail/T13075.stderr @@ -1,5 +1,3 @@ T13075.hs:5:1: error: [GHC-48099] - Top-level strict bindings aren't allowed: - Many - !(Just x) = Nothing + Top-level strict bindings aren't allowed: Many !(Just x) = Nothing diff --git a/testsuite/tests/typecheck/should_fail/T2806.stderr b/testsuite/tests/typecheck/should_fail/T2806.stderr index 803ce205903..79a80337c34 100644 --- a/testsuite/tests/typecheck/should_fail/T2806.stderr +++ b/testsuite/tests/typecheck/should_fail/T2806.stderr @@ -2,5 +2,4 @@ T2806.hs:13:11: warning: [GHC-21030] [-Wunbanged-strict-patterns (in -Wextra)] Pattern bindings containing unlifted types should use an outermost bang pattern: - Many - (I# _x) = 4 + Many (I# _x) = 4 diff --git a/testsuite/tests/typecheck/should_fail/T6078.stderr b/testsuite/tests/typecheck/should_fail/T6078.stderr index 155ece8f37b..24a6f29a15c 100644 --- a/testsuite/tests/typecheck/should_fail/T6078.stderr +++ b/testsuite/tests/typecheck/should_fail/T6078.stderr @@ -1,6 +1,5 @@ T6078.hs:8:10: error: [GHC-20036] You can't mix polymorphic and unlifted bindings: - Many - ip1p@(Ptr ip1) = Ptr ip0 `plusPtr` len + Many ip1p@(Ptr ip1) = Ptr ip0 `plusPtr` len Suggested fix: Add a type signature. diff --git a/testsuite/tests/typecheck/should_fail/tcfail203.stderr b/testsuite/tests/typecheck/should_fail/tcfail203.stderr index dae2d897669..85d791c39b7 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail203.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail203.stderr @@ -2,47 +2,39 @@ tcfail203.hs:29:11: warning: [GHC-21030] [-Wunbanged-strict-patterns (in -Wextra)] Pattern bindings containing unlifted types should use an outermost bang pattern: - Many - (I# x) = 5 + Many (I# x) = 5 tcfail203.hs:32:11: warning: [GHC-21030] [-Wunbanged-strict-patterns (in -Wextra)] Pattern bindings containing unlifted types should use an outermost bang pattern: - Many - (b, I# x) = (True, 5) + Many (b, I# x) = (True, 5) tcfail203.hs:35:11: warning: [GHC-21030] [-Wunbanged-strict-patterns (in -Wextra)] Pattern bindings containing unlifted types should use an outermost bang pattern: - Many - (# b, I# x #) = (# True, 5 #) + Many (# b, I# x #) = (# True, 5 #) tcfail203.hs:38:11: warning: [GHC-21030] [-Wunbanged-strict-patterns (in -Wextra)] Pattern bindings containing unlifted types should use an outermost bang pattern: - Many - (# b, x #) = (# True, 5# #) + Many (# b, x #) = (# True, 5# #) tcfail203.hs:41:11: warning: [GHC-21030] [-Wunbanged-strict-patterns (in -Wextra)] Pattern bindings containing unlifted types should use an outermost bang pattern: - Many - (I# !x) = 5 + Many (I# !x) = 5 tcfail203.hs:44:11: warning: [GHC-21030] [-Wunbanged-strict-patterns (in -Wextra)] Pattern bindings containing unlifted types should use an outermost bang pattern: - Many - (b, !(I# x)) = (True, 5) + Many (b, !(I# x)) = (True, 5) tcfail203.hs:47:11: warning: [GHC-21030] [-Wunbanged-strict-patterns (in -Wextra)] Pattern bindings containing unlifted types should use an outermost bang pattern: - Many - (# b, !(I# x) #) = (# True, 5 #) + Many (# b, !(I# x) #) = (# True, 5 #) tcfail203.hs:50:11: warning: [GHC-21030] [-Wunbanged-strict-patterns (in -Wextra)] Pattern bindings containing unlifted types should use an outermost bang pattern: - Many - (# b, !x #) = (# True, 5# #) + Many (# b, !x #) = (# True, 5# #) -- GitLab