Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smartmatch fail in some compositions #803

Closed
p6rt opened this issue Mar 19, 2009 · 12 comments
Closed

smartmatch fail in some compositions #803

p6rt opened this issue Mar 19, 2009 · 12 comments

Comments

@p6rt
Copy link

p6rt commented Mar 19, 2009

Migrated from rt.perl.org#64002 (status was 'resolved')

Searchable as RT64002$

@p6rt
Copy link
Author

p6rt commented Mar 19, 2009

From daniel@ruoso.com

role Foo {};
role Bar {};
role SigType does Foo does Bar {};

say SigType ~~ Foo; # this was supposed to be true
say Foo ~~ SigType; # this is false

but it is returning false in both...

daniel

@p6rt
Copy link
Author

p6rt commented Jul 29, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S14-roles/composition.t

commit 2968c8e7f200768949d786c46e0e094d95dec82d
Author​: kyle <kyle@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Wed Jul 29 01​:18​:51 2009 +0000

  [t/spec] Test for RT #​64002
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;27788 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S14-roles/composition.t b/t/spec/S14-roles/composition.t
index 85235ae..57798e7 100644
--- a/t/spec/S14-roles/composition.t
+++ b/t/spec/S14-roles/composition.t
@@ -1,6 +1,6 @@
 use v6;
 use Test;
-plan 11;
+plan 19;
 
 # L<S14/Roles/"Roles may be composed into a class at compile time">
 
@@ -48,6 +48,18 @@ is $y.mA2,      'mA2',      'Can call mixed in method (two roles) 2';
 is $y.mB1,      'mB1',      'Can call mixed in method (two roles) 3';
 is $y.mB2,      'mB2',      'Can call mixed in method (two roles) 4';
 
+ok C2 ~~ rA, 'class matches first role';
+ok C2 ~~ rB, 'class matches second role';
+ok rA !~~ C2, 'first role does not match class';
+ok rB !~~ C2, 'second role does not match class';
+
+role RT64002 does rA does rB {}
+#?rakudo 2 todo 'RT #64002'
+ok RT64002 ~~ rA, 'role matches first role it does';
+ok RT64002 ~~ rB, 'role matches second role it does';
+ok rA !~~ RT64002, 'role not matched by first role it does';
+ok rB !~~ RT64002, 'role not matched by second role it does';
+
 {
     class D1 does rA {
         method mA1 {

@p6rt
Copy link
Author

p6rt commented Jul 29, 2009

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jan 12, 2010

From @masak

This be Rakudo db84bc, running on Parrot r43174.

$ perl6 -e 'class A {}; say A.new ~~ A'
1

$ perl6 -e 'class A {}; say A.new !~~ A'
0

$ perl6 -e 'role A {}; class B does A {}; say B.new ~~ A'
1

$ perl6 -e 'role A {}; class B does A {}; say B.new !~~ A'
1

@p6rt
Copy link
Author

p6rt commented Jan 15, 2010

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S03-operators/smartmatch.t

commit 1547137afde1072821951f94e003ecbfa5364748
Author​: kyle <kyle@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Fri Jan 15 17​:56​:36 2010 +0000

  [t/spec] Test for RT 72048​: !~~ of role on instance is always true
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;29535 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S03-operators/smartmatch.t b/t/spec/S03-operators/smartmatch.t
index 5daa44c..7c6189e 100644
--- a/t/spec/S03-operators/smartmatch.t
+++ b/t/spec/S03-operators/smartmatch.t
@@ -353,7 +353,7 @@ my %hash5 = ( "foo" => 1, "bar" => 1, "gorch" => Mu, "baz" => Mu );
     ok (Chihuahua ~~ Dog), "chihuahua isa dog";
     ok (Something ~~ SomeRole), 'something does dog';
     ok !(Chihuahua ~~ Cat), "chihuahua is not a cat";
-};
+}
 
 # TODO:
 # Signature Signature
@@ -471,6 +471,16 @@ eval_lives_ok 'class A { method foo { return "" ~~ * } }; A.new.foo',
 
 }
 
+# RT 72048
+{
+    role RT72048_role {}
+    class RT72048_class does RT72048_role {}
+
+    ok RT72048_class.new ~~ RT72048_role, 'class instance matches role';
+    #?rakudo todo 'RT 72048: !~~ of role on instance is always true'
+    nok RT72048_class.new !~~ RT72048_role, 'class instance !!matches role';
+}
+
 done_testing();
 
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Jan 15, 2010

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Mar 23, 2010

From @moritz

The test (now in S03-smartmatch/disorganized.t) passes, so I'm closing
this ticket.

@p6rt
Copy link
Author

p6rt commented Mar 23, 2010

@moritz - Status changed from 'open' to 'resolved'

@p6rt
Copy link
Author

p6rt commented Jul 5, 2010

@pmichaud - Status changed from 'resolved' to 'open'

@p6rt
Copy link
Author

p6rt commented Jul 5, 2010

From @pmichaud

The bug resurfaces after the merge of the closure branch, so reopening
this ticket until it can be resolved again.

Pm

@p6rt
Copy link
Author

p6rt commented Jul 18, 2010

From @moritz

Tests pass again, closing ticket again.

@p6rt
Copy link
Author

p6rt commented Jul 18, 2010

@moritz - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Jul 18, 2010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant