my $inner = Metamodel::ClassHOW.new_type(name => 'Inner');
$inner.^compose;
my $outer = Metamodel::ClassHOW.new_type(name => 'Outer');
my $attr = Attribute.new(name => '$!inner', type => $inner, package => $outer, :has_accessor);
$outer.^add_attribute($attr);
$outer.^compose;
say $inner.WHICH eq $outer.^attributes[0].type.WHICH; # True
say $inner === $outer.^attributes[0].type; # True
say $inner ~~ $outer.^attributes[0].type; # False ???
# Type check failed in assignment to $!inner; expected Inner but got Inner.new ???
say $outer.new(inner => $inner.new);
For smartmatch to be True and for type check to be passed.
Smartmatch fails and type check fails too.
Run the code above.
perl6 -v): This is Rakudo version 2018.12 built on MoarVM version 2018.12This is because there's a decont missing in the metamodel: if you bind to $attr it works as expected.
Testing a fix now
Fixed with bf0dbbe6d2
Not sure where tests for this should live. In roast? or in rakudo? @jnthn?
Most helpful comment
Fixed with bf0dbbe6d2