Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Before composition, typecheck against added roles
Previously: my $type = Metamodel::ClassHOW.new_type(); $type.^add_role(Positional); say $type ~~ Positional; Would produce `False`, because we didn't put together the set of roles to type check against until class composition time. While it's true that we cannot resolve transitive roles and parameterizations until that time, it's reasonable enough to answer "yes" to the roles we have been explicitly told about before composition time. This came up because of a regression in Spit as reported in #2056. The previous Scalar assignment code would in some cases not enforce type checks properly in the presence of uncomposed types. When we switched away from the pile of C code that repeated (sort of) the type checking logic and towards using nqp::istype, we lost this bug. However, the module relied on it. Thankfully, we can avoid breaking the module by applying this quite reasonable change to Rakudo.
- Loading branch information