Open
Description
Currently, if writing:
sub foo(Num() $n is rw) { $n++ }
Then we can call it successfully like this:
my $x = 1e0;
foo($x);
dd $x; # Num $x = 2e0
However, if the coercion is applied, such as in this case:
my $x = 1;
foo($x);
Then it binds the result of the coercion to $n
in foo
, resulting in an error since ++
is being done on an immutable value. This is almost certainly the result of not having considered how this interaction should work.