# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #116230]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=116230 >


<doy> r: role Foo { }; class Bar { has Foo $.foo; method baz { my $foo
= $!foo; my $replacement = Foo.new; say $replacement.defined; say
$foo.defined; $foo //= $replacement; say $foo.defined } }; Bar.new.baz
<p6eval> rakudo 930369: OUTPUT«True␤False␤False␤»
<doy> role type constraints seem to break things
* masak submits rakudobug
<masak> r: role Foo {}; my $x = Foo; $x //= Foo.new; say $x.defined
<p6eval> rakudo 930369: OUTPUT«False␤»
<masak> r: role Foo {}; say Foo.new.defined
<p6eval> rakudo 930369: OUTPUT«True␤»
<masak> yeah. definitely something wrong there.
<masak> r: role Foo {}; my $x = Foo; $x = $x // Foo.new; say $x.defined
<p6eval> rakudo 930369: OUTPUT«False␤»

It is my expectation that when something undefined occurs on the lhs
of the infix:<//> operator, the rhs should be the result.

Reply via email to