From f1f690e045edad5e117df7b6c8280659ea36ccbe Mon Sep 17 00:00:00 2001 From: Elizabeth Mattijsen Date: Thu, 16 Jan 2020 00:18:43 +0100 Subject: [PATCH] Make sure that Attribute.new.is_built defaults correctly When the "is built" trait was added, all calls in the bootstrap and the setting that created attributes, had the new "is_built" attribute also specified. That was in fact wrong. What *should* have been done, is to make sure the new "is_built" attribute would default to the value (implicitely) given by the "has_accessor" attribute. Only that would ensure that Attribute's contract would not be broken. This solves the ADT blocker (#3427) --- src/Perl6/bootstrap.c/BOOTSTRAP.nqp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Perl6/bootstrap.c/BOOTSTRAP.nqp b/src/Perl6/bootstrap.c/BOOTSTRAP.nqp index e7d0b497caf..ec725b96a6d 100644 --- a/src/Perl6/bootstrap.c/BOOTSTRAP.nqp +++ b/src/Perl6/bootstrap.c/BOOTSTRAP.nqp @@ -1435,8 +1435,9 @@ BEGIN { # Need new and accessor methods for Attribute in here for now. Attribute.HOW.add_method(Attribute, 'new', - nqp::getstaticcode(sub ($self, :$name!, :$type!, :$package!, :$inlined = 0, :$is_built = 0, :$has_accessor = 0, - :$positional_delegate = 0, :$associative_delegate = 0, *%other) { + nqp::getstaticcode(sub ($self, :$name!, :$type!, :$package!, + :$inlined = 0, :$has_accessor = 0, :$is_built = $has_accessor, + :$positional_delegate = 0, :$associative_delegate = 0, *%other) { my $attr := nqp::create($self); nqp::bindattr_s($attr, Attribute, '$!name', $name); nqp::bindattr($attr, Attribute, '$!type', nqp::decont($type));