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

The string-oriented bitwise ops generate Parrot strings (instead of Rakudo strings) in Rakudo #1162

Closed
p6rt opened this issue Jul 24, 2009 · 9 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 24, 2009

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

Searchable as RT67852$

@p6rt
Copy link
Author

p6rt commented Jul 24, 2009

From @masak

<moritz_> rakudo​: say ('r' ~& 's').PARROT
<p6eval> rakudo e989e6​: OUTPUT«String␤»
<moritz_> rakudo​: say 's'.PARROT
<p6eval> rakudo e989e6​: OUTPUT«Str␤»
<moritz_> I wonder if we can find a bug related to that.
<masak> try doing .trans on both.
<masak> rakudo​: "".trans()
<p6eval> rakudo e989e6​: ( no output )
<masak> rakudo​: ("r" ~& "s").trans()
<p6eval> rakudo e989e6​: OUTPUT«too few arguments passed (1) - 3 params
expected [...]
<masak> I had a feeling that'd blow up. :)
<moritz_> :)
<masak> anyway, that's a bug.
* masak submits
<moritz_> right, .trans is aslo defined on parrot strings
<masak> but differently.
<moritz_> right
<moritz_> so it'll pick up the wrong candidate if it's not a Perl 6 Str

@p6rt
Copy link
Author

p6rt commented Jul 24, 2009

From @kyleha

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

commit 8579d5842f0fa3907dc40cf7f9747019fdf4670c
Author​: kyle <kyle@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Fri Jul 24 20​:19​:49 2009 +0000

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

Inline Patch
diff --git a/t/spec/S03-operators/bit.t b/t/spec/S03-operators/bit.t
index 514d215..56500dc 100644
--- a/t/spec/S03-operators/bit.t
+++ b/t/spec/S03-operators/bit.t
@@ -4,7 +4,7 @@ use Test;
 
 # Mostly copied from Perl 5.8.4 s t/op/bop.t
 
-plan 22;
+plan 24;
 
 # test the bit operators '&', '|', '^', '+<', and '+>'
 
@@ -98,5 +98,9 @@ plan 22;
 #if ("ok \xFF\x{FF}\n" ~& "ok 41\n" eq "ok 41\n") { say "ok 19" } else { say "not ok 19" }
 #if ("ok \x{FF}\xFF\n" ~& "ok 42\n" eq "ok 42\n") { say "ok 20" } else { say "not ok 20" }
 
-
-
+# RT #67852
+{
+    lives_ok { 'normal'.trans() }, 'can .trans() on normal string';
+    #?rakudo todo 'RT #67852'
+    lives_ok { ('bit' ~& 'wise').trans() }, 'can .trans() on bitwise result';
+}

@p6rt
Copy link
Author

p6rt commented Jul 24, 2009

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

@p6rt
Copy link
Author

p6rt commented Feb 2, 2010

From @kyleha

This is an automatically generated mail to inform you that tests are now available in at least one of these files​: t/spec/S03-operators/bit.t, t/spec/integration/real-strings.t

commit 5ae130e70da1e0276ef5350a8b93f3605dd3cead
Author​: moritz <moritz@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Sat Nov 14 19​:47​:18 2009 +0000

  [t/spec] move tests for RT #​67852 to integration/real-strings.t
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;29088 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S03-operators/bit.t b/t/spec/S03-operators/bit.t
index fde6101..410ae9c 100644
--- a/t/spec/S03-operators/bit.t
+++ b/t/spec/S03-operators/bit.t
@@ -4,7 +4,7 @@ use Test;
 
 # Mostly copied from Perl 5.8.4 s t/op/bop.t
 
-plan 24;
+plan 22;
 
 # test the bit operators '&', '|', '^', '+<', and '+>'
 
@@ -98,11 +98,4 @@ plan 24;
 #if ("ok \xFF\x{FF}\n" ~& "ok 41\n" eq "ok 41\n") { say "ok 19" } else { say "not ok 19" }
 #if ("ok \x{FF}\xFF\n" ~& "ok 42\n" eq "ok 42\n") { say "ok 20" } else { say "not ok 20" }
 
-# RT #67852
-{
-    lives_ok { 'normal'.trans() }, 'can .trans() on normal string';
-    #?rakudo todo 'RT #67852'
-    lives_ok { ('bit' ~& 'wise').trans() }, 'can .trans() on bitwise result';
-}
-
 # vim: ft=perl6
diff --git a/t/spec/integration/real-strings.t b/t/spec/integration/real-strings.t
index 9707aee..6a01298 100644
--- a/t/spec/integration/real-strings.t
+++ b/t/spec/integration/real-strings.t
@@ -58,6 +58,12 @@ is "helo".lc.trans(("aeiou" => "AEIOU")),   'hElO', '.flip.trans (RT 66300)';
     is $x, +%*VM.keys, '%*VM.kv is self-consistent';
 }
 
+# RT #67852
+{
+    lives_ok { 'normal'.trans() }, 'can .trans() on normal string';
+    #?rakudo todo 'RT 67852'
+    lives_ok { ('bit' ~& 'wise').trans() }, 'can .trans() on bitwise result';
+}
 done_testing;
 
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Jul 28, 2010

From @felliott

Hello,

Attached is a patch that I think fixes this bug. With it, make spectest
ran clean and the fudged test in t/spec/integration/real-strings.t passed.

Cheers,
Fitz Elliott

@p6rt
Copy link
Author

p6rt commented Jul 28, 2010

From @felliott

0001-return-Perl6-strings-from-bitwise-ops.patch
From b895280a8b4bd88cb21fdf93f84077302c36def2 Mon Sep 17 00:00:00 2001
From: Fitz Elliott <felliott@virginia.edu>
Date: Tue, 27 Jul 2010 23:27:29 -0400
Subject: [PATCH] return Perl6 strings from bitwise ops

---
 src/core/operators.pm |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/core/operators.pm b/src/core/operators.pm
index 8b21c12..83487ee 100644
--- a/src/core/operators.pm
+++ b/src/core/operators.pm
@@ -86,15 +86,15 @@ our multi sub infix:��+>��($a, $b) {
 }
 
 our multi sub infix:<~|>($a, $b) {
-    pir::bors__SSS($a, $b);
+    ~pir::bors__SSS($a, $b);
 }
 
 our multi sub infix:<~&>($a, $b) {
-    pir::bands__SSS($a, $b);
+    ~pir::bands__SSS($a, $b);
 }
 
 our multi sub infix:<~^>($a, $b) {
-    pir::bxors__SSS($a, $b);
+    ~pir::bxors__SSS($a, $b);
 }
 
 our sub all(*@items) {
-- 
1.7.2

@p6rt
Copy link
Author

p6rt commented Sep 11, 2011

From @bbkr

NOM​: there is some regression, trans is NYI in this branch.

bbkr​:nom bbkr$ ./perl6 -e '("bit" ~& "wise").trans()'
Method 'trans' not found for invocant of class 'Str'

@p6rt
Copy link
Author

p6rt commented Nov 29, 2011

From @moritz

The bit ops now generate real Perl 6 Str objects, and .trans is back.
Test is passing, closing ticket.

@p6rt
Copy link
Author

p6rt commented Nov 29, 2011

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

@p6rt p6rt closed this as completed Nov 29, 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