File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -342,12 +342,19 @@ given $! { .message.say };
342
342
Type captures may be used at the same time as
343
343
L < type constraints|/type/Signature#Type_constraints > .
344
344
345
- = for code
345
+ = begin code
346
346
sub d(::T Numeric $x, T $y) {};
347
347
d(4, 5); # OK
348
348
d(4e0, 5e0); # OK
349
- d(4e0, 5); # Fails when binding $y
350
- d("four", "five"); # Fails when binding $x
349
+
350
+ try d(4e0, 5);
351
+ given $! { .message.say };
352
+ # OUTPUT: «Type check failed in binding to parameter '$y'; expected Num but got Int (5)»
353
+
354
+ try d("four", "five");
355
+ given $! { .message.say };
356
+ # OUTPUT: «Type check failed in binding to parameter '$x'; expected Numeric but got Str ("four")»
357
+ = end code
351
358
352
359
= head2 method sub_signature
353
360
You can’t perform that action at this time.
0 commit comments