This repository has been archived by the owner on Feb 3, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge branch 'multis'
- Loading branch information
Showing
3 changed files
with
76 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #! nqp | ||
|
|
||
| say("1..5"); | ||
|
|
||
| our multi sub foo(Float $f) { | ||
| say("ok 1"); | ||
| } | ||
|
|
||
| our multi sub foo(NQP::Grammar $f) { | ||
| say("ok 2"); | ||
| } | ||
|
|
||
| our multi sub foo($def) { | ||
| say($def); | ||
| } | ||
|
|
||
| foo(42.01); | ||
| foo(NQP::Grammar.new); | ||
| foo("ok 3"); | ||
|
|
||
| class Foo { | ||
| our multi method bar(Float $f) { | ||
| say("ok 4"); | ||
| }; | ||
|
|
||
| our multi method bar($f) { | ||
| say($f); | ||
| }; | ||
| }; | ||
|
|
||
| my $f := Foo.new; | ||
| $f.bar(43.5 - 0.5); | ||
| $f.bar("ok 5"); | ||
|
|