summaryrefslogtreecommitdiff
path: root/ext/B
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2010-11-30 05:54:23 -0800
committerFather Chrysostomos <sprout@cpan.org>2010-11-30 08:43:28 -0800
commit6b7c6d9593471bad3cd6ea2eb3e51ebf08acad3a (patch)
tree5e1f08931d926c67334b73e06a730d049533a0ed /ext/B
parentd9a4b459f94297889956ac3adc42707365f274c2 (diff)
downloadperl-6b7c6d9593471bad3cd6ea2eb3e51ebf08acad3a.tar.gz
[perl #77762] Constant assignment warning
With this patch: $ ./perl -we 'sub A () {1}; if (0) {my $foo = A or die}' $ ./perl -we 'sub A () {1}; if (0) {my $foo = 1 or die}' Found = in conditional, should be == at -e line 1. Since the value of a constant may not be known at the time the program is written, it should be perfectly acceptable to do a constant assign- ment in a conditional.
Diffstat (limited to 'ext/B')
-rw-r--r--ext/B/t/optree_constants.t20
-rw-r--r--ext/B/t/optree_samples.t4
2 files changed, 12 insertions, 12 deletions
diff --git a/ext/B/t/optree_constants.t b/ext/B/t/optree_constants.t
index f293228892..c0f49328ab 100644
--- a/ext/B/t/optree_constants.t
+++ b/ext/B/t/optree_constants.t
@@ -110,12 +110,12 @@ for $func (sort keys %$want) {
3 <1> leavesub[2 refs] K/REFC,1 ->(end)
- <\@> lineseq KP ->3
1 <;> dbstate(main 833 (eval 44):1) v ->2
-2 <\$> const[$want->{$func}[0] $want->{$func}[1]] s ->3
+2 <\$> const[$want->{$func}[0] $want->{$func}[1]] s* ->3
EOT_EOT
3 <1> leavesub[2 refs] K/REFC,1 ->(end)
- <\@> lineseq KP ->3
1 <;> dbstate(main 833 (eval 44):1) v ->2
-2 <\$> const($want->{$func}[0] $want->{$func}[1]) s ->3
+2 <\$> const($want->{$func}[0] $want->{$func}[1]) s* ->3
EONT_EONT
}
@@ -143,14 +143,14 @@ checkOptree ( name => 'myyes() as coderef',
# 2 <;> nextstate(main 2 -e:1) v:>,<,%,{ ->3
# 5 <@> print vK ->6
# 3 <0> pushmark s ->4
-# 4 <$> const[SPECIAL sv_yes] s ->5
+# 4 <$> const[SPECIAL sv_yes] s* ->5
EOT_EOT
# 6 <@> leave[1 ref] vKP/REFC ->(end)
# 1 <0> enter ->2
# 2 <;> nextstate(main 2 -e:1) v:>,<,%,{ ->3
# 5 <@> print vK ->6
# 3 <0> pushmark s ->4
-# 4 <$> const(SPECIAL sv_yes) s ->5
+# 4 <$> const(SPECIAL sv_yes) s* ->5
EONT_EONT
@@ -167,14 +167,14 @@ checkOptree ( name => 'myno() as coderef',
# 2 <;> nextstate(main 2 -e:1) v:>,<,%,{ ->3
# 5 <@> print vK ->6
# 3 <0> pushmark s ->4
-# 4 <$> const[SPECIAL sv_no] s ->5
+# 4 <$> const[SPECIAL sv_no] s* ->5
EOT_EOT
# 6 <@> leave[1 ref] vKP/REFC ->(end)
# 1 <0> enter ->2
# 2 <;> nextstate(main 2 -e:1) v:>,<,%,{ ->3
# 5 <@> print vK ->6
# 3 <0> pushmark s ->4
-# 4 <$> const(SPECIAL sv_no) s ->5
+# 4 <$> const(SPECIAL sv_no) s* ->5
EONT_EONT
@@ -224,10 +224,10 @@ EOT_EOT
# 8 <@> prtf sK ->9
# 2 <0> pushmark s ->3
# 3 <$> const(PV "myint %d mystr %s myfl %f pi %f\n") s ->4
-# 4 <$> const(IV 42) s ->5
-# 5 <$> const(PV "hithere") s ->6
-# 6 <$> const(NV 1.414213) s ->7
-# 7 <$> const(NV 3.14159) s ->8
+# 4 <$> const(IV 42) s* ->5
+# 5 <$> const(PV "hithere") s* ->6
+# 6 <$> const(NV 1.414213) s* ->7
+# 7 <$> const(NV 3.14159) s* ->8
EONT_EONT
if($] < 5.009) {
diff --git a/ext/B/t/optree_samples.t b/ext/B/t/optree_samples.t
index e61c970cdf..4e25676b04 100644
--- a/ext/B/t/optree_samples.t
+++ b/ext/B/t/optree_samples.t
@@ -616,14 +616,14 @@ checkOptree ( name => '-e use constant j => qq{junk}; print j',
# 1 <0> enter
# 2 <;> nextstate(main 71 -e:1) v:>,<,%,{
# 3 <0> pushmark s
-# 4 <$> const[PV "junk"] s
+# 4 <$> const[PV "junk"] s*
# 5 <@> print vK
# 6 <@> leave[1 ref] vKP/REFC
EOT_EOT
# 1 <0> enter
# 2 <;> nextstate(main 71 -e:1) v:>,<,%,{
# 3 <0> pushmark s
-# 4 <$> const(PV "junk") s
+# 4 <$> const(PV "junk") s*
# 5 <@> print vK
# 6 <@> leave[1 ref] vKP/REFC
EONT_EONT