Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make sure we only assign the default value for Scalars

  • Loading branch information...
commit 1f57da5881e421615468981f349c8298d00c4164 1 parent eea1906
@lizmat lizmat authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  src/core/Variable.pm
View
3  src/core/Variable.pm
@@ -33,7 +33,8 @@ multi trait_mod:<is>(Variable:D $v, Mu:U $is ) {
);
}
multi trait_mod:<is>(Variable:D $v, :$default!) {
- $v.var = $default; # make sure we start with the default
+ # make sure we start with the default if a scalar
+ $v.var = $default if $v.var.VAR.WHAT ~~ Scalar;
nqp::getattr($v.var, $v.var.VAR.WHAT, '$!descriptor').set_default($default);
}
multi trait_mod:<is>(Variable:D $v, :$dynamic!) {
Please sign in to comment.
Something went wrong with that request. Please try again.