Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix subtypes of definite types
Fixes subtype Foo of Str:D; failing with
"Cannot find method 'nominalize'"
  • Loading branch information
niner committed Oct 22, 2015
1 parent f45ed86 commit 416b5aa
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Perl6/Metamodel/DefiniteHOW.nqp
Expand Up @@ -23,7 +23,7 @@ class Perl6::Metamodel::DefiniteHOW
#~ does Perl6::Metamodel::REPRComposeProtocol
#~ does Perl6::Metamodel::InvocationProtocol
{
my $archetypes := Perl6::Metamodel::Archetypes.new(:definite);
my $archetypes := Perl6::Metamodel::Archetypes.new(:definite, :nominalizable(1));
method archetypes() {
$archetypes
}
Expand Down Expand Up @@ -82,6 +82,13 @@ class Perl6::Metamodel::DefiniteHOW
#~ @parents
#~ }

method nominalize($obj) {
my $base_type := $obj.HOW.base_type($obj);
$base_type.HOW.archetypes.nominal ??
$base_type !!
$base_type.HOW.nominalize($base_type)
}

#~ # Should have the same methods of the base type that we refine.
#~ # (For the performance win, work out a way to steal its method cache.)
method find_method($definite_type, $name) {
Expand Down

0 comments on commit 416b5aa

Please sign in to comment.