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

Can't mix in True or False as ($value but True) #983

Closed
p6rt opened this issue May 9, 2009 · 6 comments
Closed

Can't mix in True or False as ($value but True) #983

p6rt opened this issue May 9, 2009 · 6 comments

Comments

@p6rt
Copy link

p6rt commented May 9, 2009

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

Searchable as RT65514$

@p6rt
Copy link
Author

p6rt commented May 9, 2009

From @moritz

This works fine​:

$ ./perl6 -e 'enum A <b c>; ("abc" but c).uc.say'
ABC

This doesn't

$ >./perl6 -e '("abc" but Bool​::True).uc.say'
The but operator can only be used with a role or enum value on the right
hand side

So it seems that Bool isn't a real Enum somehow. This needs to be fixed.

Cheers,
Moritz

@p6rt
Copy link
Author

p6rt commented Oct 11, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S02-builtin_data_types/bool.t

commit 6830b4069cc912139a59426d92589d5e81e22e31
Author​: kyle <kyle@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Sun Oct 11 22​:25​:46 2009 +0000

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

Inline Patch
diff --git a/t/spec/S02-builtin_data_types/bool.t b/t/spec/S02-builtin_data_types/bool.t
index 25e6db9..95d408e 100644
--- a/t/spec/S02-builtin_data_types/bool.t
+++ b/t/spec/S02-builtin_data_types/bool.t
@@ -1,12 +1,9 @@
 use v6;
-
 use Test;
-
+plan *;
 
 # L<S12/Enums/"Two built-in enums are">
 
-plan 24;
-
 # tests True and False are Bool's
 isa_ok(Bool::True, Bool);
 isa_ok(Bool::False, Bool);
@@ -56,5 +53,13 @@ is(++$bool, Bool::True, 'Increment of Bool::True still produces Bool::True');
 is(--$bool, Bool::False, 'Decrement of Bool::True produces Bool::False');
 is(--$bool, Bool::False, 'Decrement of Bool::False produces Bool::False');
 
+# RT #65514
+{
+    #?rakudo 2 skip 'RT #65514 mix in bool with "but"'
+    ok (0 but Bool::True), 'Bool::True works with "but"';
+    is ('RT65514' but Bool::False), 'RT65514', 'Bool::False works with "but"';
+}
+
+done_testing;
 
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Oct 11, 2009

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

@p6rt
Copy link
Author

p6rt commented Jun 5, 2010

From @jnthn

On Sat May 09 04​:31​:06 2009, moritz wrote​:

This works fine​:

$ ./perl6 -e 'enum A <b c>; ("abc" but c).uc.say'
ABC

This doesn't

$ >./perl6 -e '("abc" but Bool​::True).uc.say'
The but operator can only be used with a role or enum value on the right
hand side

You can now write this; it works for now thanks to the chunk of S14
about how to handle non-roles on the RHS, which are independent of
whether it's an enum value or not. It works, and passes the tests that
were attached to the ticket, plus I wrote a couple of extra tests too.
Doubtless there'll still be some issues in this area, but it's a step
forward. :-)

Thanks,

Jonathan

@p6rt
Copy link
Author

p6rt commented Jun 5, 2010

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

@p6rt p6rt closed this as completed Jun 5, 2010
@p6rt
Copy link
Author

p6rt commented Jun 5, 2010

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S02-builtin_data_types/bool.t

commit 73e1a1a4627cb62445ffc7409e755ea71002c05b
Author​: jnthn <jnthn@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Sat Jun 5 20​:49​:32 2010 +0000

  [t/spec] Unfudge tests for RT#​65514 and add a couple of extra ones for it too.
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;31133 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S02-builtin_data_types/bool.t b/t/spec/S02-builtin_data_types/bool.t
index 08c8c27..a402335 100644
--- a/t/spec/S02-builtin_data_types/bool.t
+++ b/t/spec/S02-builtin_data_types/bool.t
@@ -1,6 +1,6 @@
 use v6;
 use Test;
-plan 37;
+plan 39;
 
 #L<S12/Enumerations/"Two built-in enumerations are">
 
@@ -67,8 +67,9 @@ is(--$bool, Bool::False, 'Decrement of Bool::False produces Bool::False');
 
 # RT #65514
 {
-    #?rakudo 2 skip 'RT #65514 mix in bool with "but"'
     ok (0 but Bool::True), 'Bool::True works with "but"';
+    is (0 but Bool::True), 0, 'Bool::True works with "but"';
+    ok !('RT65514' but Bool::False), 'Bool::False works with "but"';
     is ('RT65514' but Bool::False), 'RT65514', 'Bool::False works with "but"';
 }
 

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