From c34c1a441ccd4670680cc97e90290d701ad85426 Mon Sep 17 00:00:00 2001
From: Father Chrysostomos
Date: Sun, 4 Jan 2015 11:53:31 -0800
Subject: [PATCH] Test predecence warning on new bitops
---
t/lib/warnings/op | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/t/lib/warnings/op b/t/lib/warnings/op
index 5e71000..bb0eb9e 100644
--- a/t/lib/warnings/op
+++ b/t/lib/warnings/op
@@ -1588,6 +1588,25 @@ $a = $b >= $c ^ $d;
$a = $b <= $c | $d;
$a = $b <=> $c & $d;
$a &= $b == $c; $a |= $b == $c; $a ^= $b == $c; # shouldn't warn
+{
+ use experimental 'bitwise';
+ $a = $b & $c == $d;
+ $a = $b ^ $c != $d;
+ $a = $b | $c > $d;
+ $a = $b < $c & $d;
+ $a = $b >= $c ^ $d;
+ $a = $b <= $c | $d;
+ $a = $b <=> $c & $d;
+ $a &= $b == $c; $a |= $b == $c; $a ^= $b == $c; # shouldn't warn
+ $a = $b &. $c == $d;
+ $a = $b ^. $c != $d;
+ $a = $b |. $c > $d;
+ $a = $b < $c &. $d;
+ $a = $b >= $c ^. $d;
+ $a = $b <= $c |. $d;
+ $a = $b <=> $c &. $d;
+ $a &.= $b == $c; $a |.= $b == $c; $a ^.= $b == $c; # shouldn't warn
+}
no warnings 'precedence';
$a = $b & $c == $d;
$a = $b ^ $c != $d;
@@ -1596,6 +1615,25 @@ $a = $b < $c & $d;
$a = $b >= $c ^ $d;
$a = $b <= $c | $d;
$a = $b <=> $c & $d;
+{
+ use experimental 'bitwise';
+ $a = $b & $c == $d;
+ $a = $b ^ $c != $d;
+ $a = $b | $c > $d;
+ $a = $b < $c & $d;
+ $a = $b >= $c ^ $d;
+ $a = $b <= $c | $d;
+ $a = $b <=> $c & $d;
+ $a &= $b == $c; $a |= $b == $c; $a ^= $b == $c; # shouldn't warn
+ $a = $b &. $c == $d;
+ $a = $b ^. $c != $d;
+ $a = $b |. $c > $d;
+ $a = $b < $c &. $d;
+ $a = $b >= $c ^. $d;
+ $a = $b <= $c |. $d;
+ $a = $b <=> $c &. $d;
+ $a &.= $b == $c; $a |.= $b == $c; $a ^.= $b == $c; # shouldn't warn
+}
EXPECT
Possible precedence problem on bitwise & operator at - line 3.
Possible precedence problem on bitwise ^ operator at - line 4.
@@ -1604,6 +1642,20 @@ Possible precedence problem on bitwise & operator at - line 6.
Possible precedence problem on bitwise ^ operator at - line 7.
Possible precedence problem on bitwise | operator at - line 8.
Possible precedence problem on bitwise & operator at - line 9.
+Possible precedence problem on bitwise & operator at - line 13.
+Possible precedence problem on bitwise ^ operator at - line 14.
+Possible precedence problem on bitwise | operator at - line 15.
+Possible precedence problem on bitwise & operator at - line 16.
+Possible precedence problem on bitwise ^ operator at - line 17.
+Possible precedence problem on bitwise | operator at - line 18.
+Possible precedence problem on bitwise & operator at - line 19.
+Possible precedence problem on bitwise &. operator at - line 21.
+Possible precedence problem on bitwise ^. operator at - line 22.
+Possible precedence problem on bitwise |. operator at - line 23.
+Possible precedence problem on bitwise &. operator at - line 24.
+Possible precedence problem on bitwise ^. operator at - line 25.
+Possible precedence problem on bitwise |. operator at - line 26.
+Possible precedence problem on bitwise &. operator at - line 27.
########
# op.c
use integer;
--
1.8.3.1