Skip to content

Commit

Permalink
Clone attribute object if not instnatiating
Browse files Browse the repository at this point in the history
It makes sense to always install a copy of an attribute object on a
concretization, wether it's a result of instantiation or not. If the
attribute is not cloned then it could be shared among several type
objects with unpredictable consequences.
  • Loading branch information
vrurg committed Jan 2, 2020
1 parent 4c265c7 commit 9f2a2f6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Perl6/Metamodel/ParametricRoleHOW.nqp
Expand Up @@ -186,7 +186,7 @@ class Perl6::Metamodel::ParametricRoleHOW
# the concrete role.
for self.attributes($obj, :local(1)) {
$conc.HOW.add_attribute($conc,
$_.is_generic ?? $_.instantiate_generic($type_env) !! $_);
$_.is_generic ?? $_.instantiate_generic($type_env) !! nqp::clone($_));
}

# Go through methods and instantiate them; we always do this
Expand Down

0 comments on commit 9f2a2f6

Please sign in to comment.