'$type_constraint_obj' => \$type_constraint_obj,
'$type_constraint' => \(
$type_constraint_obj
- ? $type_constraint_obj->_compiled_type_constraint
- : undef
+ ? $type_constraint_obj->_compiled_type_constraint
+ : undef
+ ),
+ (
+ $type_constraint_obj
+ ? %{ $type_constraint_obj->inline_environment }
+ : ()
),
};
}
'$defaults' => \$defaults,
'@type_constraints' => \@type_constraints,
'@type_constraint_bodies' => \@type_constraint_bodies,
+ ( map { %{ $_->inline_environment } } @type_constraints ),
};
}
&& $self->type_parameter->can_be_inlined;
}
+sub inline_environment {
+ my $self = shift;
+
+ return {
+ %{ $self->parameterized_from->inline_environment },
+ %{ $self->type_parameter->inline_environment },
+ };
+}
+
sub _inline_check {
my $self = shift;
isa => $type,
)
);
+
$class->add_attribute(
collection => (
traits => ['Array'],
- is => 'ro',
isa => 'ArrayRef[' . $type->name . ']',
default => sub { [] },
handles => { add_to_collection => 'push' },
$anon_class->new( simple => $accept );
},
undef,
- "no exception passing $described to constructor"
+ "no exception passing $described to constructor with $name"
);
is(
$anon_class->new()->add_to_collection($accept);
},
undef,
- "no exception passing $described to constructor"
+ "no exception passing $described to native trait push method with $name"
);
}
exception {
$anon_class->new( simple => $reject );
},
- "got exception passing $described to constructor"
+ "got exception passing $described to constructor with $name"
);
ok(
exception {
$anon_class->new()->add_to_collection($reject);
},
- "got exception passing $described to constructor"
+ "got exception passing $described to native trait push method with $name"
);
}
}