Skip to content

Commit 8cac1b2

Browse files
committed
make examples compile
1 parent 8e4234a commit 8cac1b2

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

doc/Language/typesystem.pod6

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ C<trusts>. A forward declaration of the tuested class may be required.
197197
method change { $!a!A::foo = 42; self }
198198
};
199199
say B.new.change;
200-
OUTPUT«B.new(a => A.new(foo => 42))␤»
200+
# OUTPUT«B.new(a => A.new(foo => 42))␤»
201201
202202
TODO
203203
@@ -259,6 +259,7 @@ Stringification of the symbol will provide the key of the enum-pair.
259259
Comparing symbols will use type information and the value of the enum-pair. As
260260
value types C<Numerical> an C<Str> are supported.
261261
262+
enum Names ( name1 => 1, name2 => 2 );
262263
sub same(Names $a, Names $b){
263264
$a eqv $b
264265
}
@@ -312,32 +313,38 @@ Returns the list of enum-pairs. Works both on the enum type and any key.
312313
313314
Returns the key of an enum-pair.
314315
316+
=for code :skip-test
315317
say g.key; # OUTPUT«g␤»
316318
317319
=head4 method value
318320
319321
Returns the value of an enum-pair.
320322
323+
=for code :skip-test
321324
say g.value; # OUTPUT«1␤»
322325
323326
=head4 method pair
324327
325328
Defined as:
326329
330+
=for code :skip-test
327331
method pair(::?CLASS:D:)
328332
329333
Returns a C<Pair> of the enum-pair.
330334
335+
=for code :skip-test
331336
say g.pair; # OUTPUT«g => 1␤»
332337
333338
=head4 method kv
334339
335340
Defined as:
336341
342+
=for code :skip-test
337343
multi method kv(::?CLASS:D:)
338344
339345
Returns a list with key and value of the enum-pair.
340346
347+
=for code :skip-test
341348
say g.kv; # OUTPUT«(g 1)␤»
342349
343350
@@ -383,6 +390,8 @@ will be checked against the given code object.
383390
384391
subset Positive of Int where * > -1;
385392
my Positive $i = 1;
386-
$i = -42; # OUTPUT«Type check failed in assignment to $i; expected Positive but got Int (-42)␤ …»
393+
$i = -42;
394+
CATCH { default { put .^name,': ', .Str } }
395+
# OUTPUT«X::TypeCheck::Assignment: Type check failed in assignment to $i; expected Positive but got Int (-42)␤ …»
387396
388397
=end pod

0 commit comments

Comments
 (0)