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

Smartmatching against a type yields an Int, not a Bool in Rakudo #1449

Closed
p6rt opened this issue Dec 20, 2009 · 10 comments
Closed

Smartmatching against a type yields an Int, not a Bool in Rakudo #1449

p6rt opened this issue Dec 20, 2009 · 10 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Dec 20, 2009

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

Searchable as RT71462$

@p6rt
Copy link
Author

p6rt commented Dec 20, 2009

From @masak

<masak> rakudo​: say (* ~~ Whatever).WHAT
<p6eval> rakudo 8dc189​: Int()␤
<masak> Int!?
<masak> can I submit this as a bug?
<masak> rakudo​: say ("OH HAI" ~~ Str).WHAT
<p6eval> rakudo 8dc189​: Int()␤
* masak submits rakudobug

@p6rt
Copy link
Author

p6rt commented Dec 28, 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 077e91aaf96664bf4de7492b76eaf5980f6a6656
Author​: kyle <kyle@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Mon Dec 28 22​:33​:22 2009 +0000

  [t/spec] Test for RT 71462​: Smartmatch a type yields Int, not Bool
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;29408 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 af6876a..2129c0b 100644
--- a/t/spec/S02-builtin_data_types/bool.t
+++ b/t/spec/S02-builtin_data_types/bool.t
@@ -66,6 +66,9 @@ is(--$bool, Bool::False, 'Decrement of Bool::False produces Bool::False');
     is Bool::False.key, 'False', 'Bool::False.key works (is "False")';
 }
 
+#?rakudo todo 'RT 71462: Smartmatch a type yields Int, not a Bool'
+isa_ok ('RT71462' ~~ Str), Bool;
+
 done_testing;
 
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Dec 28, 2009

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

@p6rt
Copy link
Author

p6rt commented Jun 26, 2010

From @pmichaud

Now fixed in a579f8e. Closing ticket.

Pm

1 similar comment
@p6rt
Copy link
Author

p6rt commented Jun 26, 2010

From @pmichaud

Now fixed in a579f8e. Closing ticket.

Pm

@p6rt
Copy link
Author

p6rt commented Jun 26, 2010

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

@p6rt
Copy link
Author

p6rt commented Dec 27, 2010

From @masak

On Sat Jun 26 11​:43​:15 2010, pmichaud wrote​:

Now fixed in a579f8e. Closing ticket.

Pm

<masonkramer> How do I see if a thing does Callable?
<masak> rakudo​: sub foo {}; say &foo ~~ Callable
<p6eval> rakudo cae7f9​: OUTPUT«1␤»
<masak> rakudo​: sub foo {}; say &foo.^does(Callable)
<p6eval> rakudo cae7f9​: OUTPUT«1␤»
<masonkramer> Ahh, yep that's what I wanted
<masonkramer> by the way, shouldn't smartmatch always return Bools?
<masak> there's no such rule.
<masak> smartmatching on a regex, for example, returns a Match object.
<masonkramer> Right...right
<masonkramer> I would've expected Bool here though, just because I'm asking a yes or no
question
<masak> I'd say it's a bug too.
<masak> but I think it's been reported already.
* masak checks
<masak> yep -- http://rt.perl.org/rt3/Ticket/Display.html?id=71462
<masak> but it's been resolved... hm.
<masak> rakudo​: say (* ~~ Whatever).WHAT
<p6eval> rakudo cae7f9​: OUTPUT«Bool()␤»
<masak> rakudo​: say ("OH HAI" ~~ Str).WHAT
<p6eval> rakudo cae7f9​: OUTPUT«Bool()␤»
<masak> those cases are indeed fixed.
<masak> this does not happen often.
* masak reopens ticket because C<&foo ~~ Callable> yields an Int
<masak> masonkramer++

@p6rt
Copy link
Author

p6rt commented Dec 27, 2010

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

@p6rt
Copy link
Author

p6rt commented Jan 14, 2011

From @Kodiologist

As of Rakudo 7fd3dea4a4d2, this should be fixed for good. Note that
before this change, some cases which appeared to be returning Bools were
actually returning Parrot Booleans.

See S03-smartmatch/any-type.t (roast 2167a018e61) for tests.

@p6rt
Copy link
Author

p6rt commented Jan 14, 2011

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

@p6rt p6rt closed this as completed Jan 14, 2011
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant