Skip to content

Commit 2a28c82

Browse files
committed
Fix #1724
Provide valid example of Type/Signature.pod6, X«Constraining signatures of Callables|Callable (constrain)»
1 parent 72d3b67 commit 2a28c82

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

doc/Type/Signature.pod6

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,14 @@ a L<Signature> literal right after the parameter (no whitespace allowed):
286286
f(&g);
287287
# OUTPUT: «ten10␤»
288288
289-
This shorthand syntax is available only for parameters with the `&` sigil. For
289+
This shorthand syntax is available only for parameters with the C<&> sigil. For
290290
others, you need to use the long version:
291291
292-
sub f($c: where .signature ~~ :(Int, Str)) { say $c(10, 'ten') };
293-
sub g(Num $i, Str $s) { $s ~ $i };
294-
f(&g);
295-
# OUTPUT: «ten10␤»
292+
sub f($c where .signature ~~ :(Int, Str)) { say $c(10, 'ten') }
293+
sub g(Num $i, Str $s) { $s ~ $i }
294+
sub h(Int $i, Str $s) { $s ~ $i }
295+
# f(&g); # Constraint type check failed
296+
f(&h); # OUTPUT: «ten10␤»
296297
297298
=head3 X«Constraining Return Types|-->;returns»
298299

0 commit comments

Comments
 (0)