Skip to content

Instantly share code, notes, and snippets.

@Mouq
Created March 12, 2015 04:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mouq/1420b193252f0cbaec31 to your computer and use it in GitHub Desktop.
Save Mouq/1420b193252f0cbaec31 to your computer and use it in GitHub Desktop.
diff --git a/src/Perl6/Metamodel/BOOTSTRAP.nqp b/src/Perl6/Metamodel/BOOTSTRAP.nqp
index 4b2a7f3..3f1fd5f 100644
--- a/src/Perl6/Metamodel/BOOTSTRAP.nqp
+++ b/src/Perl6/Metamodel/BOOTSTRAP.nqp
@@ -563,16 +563,25 @@ my class Binder {
# Otherwise, go by sigil to pick the correct default type of value.
else {
+ my $nom_type := nqp::getattr($param, Parameter, '$!nominal_type');
if $flags +& $SIG_ELEM_ARRAY_SIGIL {
- my $result := nqp::create(Array);
+ my $nom_subtype := $nom_type.of;
+ my $type := $nom_subtype =:= Mu
+ ?? Array
+ !! Array.HOW.parameterize(Array, $nom_subtype);
+ my $result := nqp::create($type);
nqp::bindattr($result, List, '$!flattens', nqp::p6bool(1));
$result
}
elsif $flags +& $SIG_ELEM_HASH_SIGIL {
- nqp::create(Hash)
+ my $nom_subtype := $nom_type.of;
+ my $type := $nom_subtype =:= Mu
+ ?? Hash
+ !! Hash.HOW.parameterize(Hash, $nom_subtype);
+ nqp::create($type)
}
else {
- nqp::getattr($param, Parameter, '$!nominal_type');
+ $nom_type
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment