You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. <sisar> r: my Bool $x; say $x++;
<p6eval> rakudo 3a0e40: OUTPUT«Type check failed in assignment to
'$x'; expected 'Bool' but got 'Int' in sub postfix:<++> at
src/gen/CORE.setting:1342 in block <anon> at /tmp/yS4FLnf7uE:1»
Expected output: True
2. <sisar> r: my Bool $x; say --$x;
<p6eval> rakudo 3a0e40: OUTPUT«Type check failed in assignment to
'$x'; expected 'Bool' but got 'Int' in sub prefix:<--> at
src/gen/CORE.setting:1338 in block <anon> at /tmp/ripRnRlVUe:1»
Expected output: False
S03:539 covers postfix:<++> on Bools. (just before postfix:<++> on
Any/Numeric/Cool is described)
Also:
<sisar> pmichaud: note that the bug only occurs when $x is
uninitialized. The spec is silent(?) on incrementing uninitialized
Bool variables.
<pmichaud> sisar: I'm expecting uninitialized Bool to work like
uninitialized Numeric
<pmichaud> principle of least surprise :)
Now fixed in f798fb1, with spectests added to S03-
operators/autoincrement.t .
Note that the expected output of the first example of the original ticket
is wrong; postincrement should return the value of $x before the
increment takes place (i.e., False). It returns False and not Bool in
order to remain analogous with what happens when postincrementing Int
(returns 0, not Int -- see S03.)
Migrated from rt.perl.org#113816 (status was 'resolved')
Searchable as RT113816$
The text was updated successfully, but these errors were encountered: