Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Make (Array|Hash).WHAT return something sensible for specifically typ…

…ed case

jnthn++, TimToady++ for guidance
  • Loading branch information...
commit 13f2f970c2913917d7126929e6591dc47c1ece3c 1 parent da63d08
lizmat authored August 19, 2013
4  src/core/Array.pm
@@ -184,7 +184,9 @@ class Array { # declared in BOOTSTRAP
184 184
     }
185 185
     method PARAMETERIZE_TYPE(Mu $t, |c) {
186 186
         if c.elems == 0 {
187  
-            self but TypedArray[$t.WHAT]
  187
+            my $what := self but TypedArray[$t.WHAT];
  188
+            $what.HOW.set_name(self, "Array[{$t.HOW.name(self)}]");
  189
+            $what;
188 190
         }
189 191
         else {
190 192
             die "Can only type-constraint Array with [ValueType]"
8  src/core/Hash.pm
@@ -346,10 +346,14 @@ my class Hash { # declared in BOOTSTRAP
346 346
     }
347 347
     method PARAMETERIZE_TYPE(Mu $t, |c) {
348 348
         if c.elems == 0 {
349  
-            self but TypedHash[$t.WHAT]
  349
+            my $what := self but TypedHash[$t.WHAT];
  350
+            $what.HOW.set_name(self, "Hash[{$t.HOW.name(self)}]");
  351
+            $what;
350 352
         }
351 353
         elsif c.elems == 1 {
352  
-            self but TypedHash[$t.WHAT, c[0]]
  354
+            my $what := self but TypedHash[$t.WHAT, c[0]];
  355
+            $what.HOW.set_name(self, "Hash[{$t.HOW.name(self)},{c[0].HOW.name(self)}]");
  356
+            $what;
353 357
         }
354 358
         else {
355 359
             die "Can only type-constraint Hash with [ValueType] or [ValueType,KeyType]";

0 notes on commit 13f2f97

Please sign in to comment.
Something went wrong with that request. Please try again.