Skip to content

Commit 2d99f06

Browse files
committed
Update Parameter.sub_signature and add example
1 parent 6f9e67e commit 2d99f06

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

doc/Type/Parameter.pod6

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,21 @@ d("four", "five"); # Fails when binding $x
311311
312312
=head2 method sub_signature
313313
314+
Defined as:
315+
316+
method sub_signature(Parameter:D: --> Signature:_)
317+
314318
If the parameter has a
315319
L<sub-signature|/type/Signature#Sub-signatures>,
316-
returns a C<Signature> object for it. Otherwise returns C<Any>.
320+
returns a C<Signature> object for it. Otherwise returns C<Signature>.
321+
322+
B<Note:> Before Rakudo version 2020.08 the return value for a parameter
323+
with no sub-signature was C<Any>.
324+
325+
=for code
326+
my Signature $sig = :(@array ($first, *@rest), @other);
327+
say $sig.params[0].sub_signature; # OUTPUT:«($first, *@rest)␤»
328+
say $sig.params[1].sub_signature; # OUTPUT:«(Signature)␤»
317329
318330
=head2 method prefix
319331

0 commit comments

Comments
 (0)