Add ACCEPTS to tests equality with its own type #84

Closed
wants to merge 1 commit into
from
View
@@ -17,6 +17,16 @@ my class Signature {
self.ACCEPTS(%topic.Capture)
}
+ multi method ACCEPTS(Signature:D: Signature:D $topic) {
+ return False unless $topic.params == self.params;
+
+ for $topic.params Z self.params -> $t, $s {
+ return False unless $t.type ~~ $s.type;
+ }
+
+ return True;
+ }
+
method arity() {
self.count if nqp::isnull($!arity) || !$!arity.defined;
$!arity;
View
@@ -204,6 +204,7 @@ S03-smartmatch/hash-hash.t
S03-smartmatch/range-range.t
S03-smartmatch/regex-hash.t
S03-smartmatch/scalar-hash.t
+S03-smartmatch/signature-signature.t
S04-blocks-and-statements/let.t
S04-blocks-and-statements/pointy-rw.t
S04-blocks-and-statements/pointy.t