File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -582,8 +582,8 @@ Defined as:
582
582
583
583
Returns the type constraint for the keys of the invocant. For
584
584
normal hashes the method returns the coercion type C < (Str(Any)) >
585
- while for L < object hashes |/type/Hash#Object_hashes_and_type_constraints >
586
- the type used in the declaration of the C < Hash > is returned.
585
+ while for L < non-string keys |/type/Hash#Non-string_keys >
586
+ hashes the type used in the declaration of the C < Hash > is returned.
587
587
588
588
my %h1 = 'apples' => 3, 'oranges' => 7; # (no key type specified)
589
589
say %h1.keyof; # OUTPUT: «(Str(Any))»
@@ -594,6 +594,10 @@ the type used in the declaration of the C<Hash> is returned.
594
594
CATCH { default { put .^name, ': ', .Str } };
595
595
# OUTPUT: «X::TypeCheck::Binding: Type check failed in binding to key; expected Str but got Int (3)»
596
596
597
+ my %h3{Int}; # (this time, keys must be of type Int)
598
+ %h3{42} = 4096;
599
+ say %h3.keyof; # (Int)
600
+
597
601
= head2 method of
598
602
599
603
Defined as:
You can’t perform that action at this time.
0 commit comments