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

junctions reporting true & false, not collapsing #2917

Closed
p6rt opened this issue Oct 15, 2012 · 7 comments
Closed

junctions reporting true & false, not collapsing #2917

p6rt opened this issue Oct 15, 2012 · 7 comments
Labels
JVM Related to Rakudo-JVM

Comments

@p6rt
Copy link

p6rt commented Oct 15, 2012

Migrated from rt.perl.org#115270 (status was 'open')

Searchable as RT115270$

@p6rt
Copy link
Author

p6rt commented Oct 15, 2012

From @masak

<flussence> oh btw, I found this while you were away :)
<flussence> echo -e 'my \\a = any set <1 2 3>; \n say 1 ~~ a' | perl6
<moritz> Segmentation fault (core dumped)
<flussence> works fine if you omit the \n, though.
<masak> has it been RT'd?
<flussence> I've been too busy trying to break rakudo to file bugs :P
* masak submits rakudobug

@p6rt
Copy link
Author

p6rt commented Aug 2, 2013

From @coke

On Mon Oct 15 04​:19​:04 2012, masak wrote​:

<flussence> oh btw, I found this while you were away :)
<flussence> echo -e 'my \\a = any set <1 2 3>; \n say 1 ~~ a' | perl6
<moritz> Segmentation fault (core dumped)
<flussence> works fine if you omit the \n, though.
<masak> has it been RT'd?
<flussence> I've been too busy trying to break rakudo to file bugs :P
* masak submits rakudobug

Alternatively, it also explodes on the JVM​:

$ echo -e 'my \\a = any set <1 2 3>; \n say 1 ~~ a' | ./perl6

my \a = any set <1 2 3>;
any(3, 2, 1)
say 1 ~~ a
scgethandle can only operate on an SCRef
java.lang.RuntimeException​: java.lang.Exception​: Cannot understand '- QAST​::CompUnit'
java.lang.RuntimeException​: java.lang.ClassCastException​: __P6opaque__18 cannot be cast to
org.perl6.nqp.runtime.EvalResult
Cannot stringify this

And without the \n :

$ echo -e 'my \\a = any set <1 2 3>; say 1 ~~ a' | ./perl6

my \a = any set <1 2 3>; say 1 ~~ a
True
True

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Aug 2, 2013

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

@p6rt
Copy link
Author

p6rt commented Apr 14, 2015

From @FROGGS

moar seems happy now​:

$ echo -e 'my \\a = any set <1 2 3>; \n say 1 ~~ a' | ./perl6-m
any(set(1, 2, 3))
0

JVM still broken here, I changed the REPL's ">" to "%" to not treat it as a replied msg​:
$ echo -e 'my \\a = any set <1 2 3>; \n say 1 ~~ a' | ./perl6-j
% my \a = any set <1 2 3>;
any(set(3, 1, 2))
% say 1 ~~ a
Method 'gist' not found for invocant of class 'BOOTInt'

@p6rt
Copy link
Author

p6rt commented Aug 3, 2015

From @coke

On Tue Apr 14 13​:00​:36 2015, FROGGS.de wrote​:

moar seems happy now​:

$ echo -e 'my \\a = any set <1 2 3>; \n say 1 ~~ a' | ./perl6-m
any(set(1, 2, 3))
0

JVM still broken here, I changed the REPL's ">" to "%" to not treat it
as a replied msg​:
$ echo -e 'my \\a = any set <1 2 3>; \n say 1 ~~ a' | ./perl6-j
% my \a = any set <1 2 3>;
any(set(3, 1, 2))
% say 1 ~~ a
Method 'gist' not found for invocant of class 'BOOTInt'

Behavior has changed slightly on JVM -

$ echo -e 'my \\a = any set <1 2 3>; \n say 1 ~~ a' | ./perl6-m

any(set(1, 3, 2))
False

$ echo -e 'my \\a = any set <1 2 3>; \n say 1 ~~ a' | ./perl6-j

any(set(3, 1, 2))
False
True

The ~~ check on the JVM outputs both False & True (as opposed to the moar version, which only outputs False)

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Apr 7, 2016

From @peschwa

On Mon Aug 03 13​:26​:14 2015, coke wrote​:

On Tue Apr 14 13​:00​:36 2015, FROGGS.de wrote​:

moar seems happy now​:

$ echo -e 'my \\a = any set <1 2 3>; \n say 1 ~~ a' | ./perl6-m
any(set(1, 2, 3))
0

JVM still broken here, I changed the REPL's ">" to "%" to not treat
it
as a replied msg​:
$ echo -e 'my \\a = any set <1 2 3>; \n say 1 ~~ a' | ./perl6-j
% my \a = any set <1 2 3>;
any(set(3, 1, 2))
% say 1 ~~ a
Method 'gist' not found for invocant of class 'BOOTInt'

Behavior has changed slightly on JVM -

$ echo -e 'my \\a = any set <1 2 3>; \n say 1 ~~ a' | ./perl6-m

any(set(1, 3, 2))
False

$ echo -e 'my \\a = any set <1 2 3>; \n say 1 ~~ a' | ./perl6-j

any(set(3, 1, 2))
False
True

The ~~ check on the JVM outputs both False & True (as opposed to the
moar version, which only outputs False)

The actual problem here seems to be that the REPL on R-J somehow deems it necessary to output the return value of a outputting sub that takes a Junction somewhere in it's argument list​:

$ ./perl6-j
To exit type 'exit' or '^D'

say 1 ~~ any set <1 2 3>
False
True
say any set < 1 2 3 >
any(set(2, 3, 1))
True
say any 1
any(1)
print any 1
any(1)True
note any 1
any(1)
True
note any False
any(False)
True
say 1, any 1
1any(1)
True

@p6rt p6rt added the JVM Related to Rakudo-JVM label Jan 5, 2020
usev6 added a commit to usev6/rakudo that referenced this issue May 1, 2021
As described in Raku/old-issue-tracker#2917
the REPL failed badly (segfaulting) when smartmatching against a
junction that contains a set:

  $ echo -e 'my \\a = any set <1 2 3>; \n say 1 ~~ a' | perl6
  Segmentation fault (core dumped)

[The newline was essential to provoke the crash.]

The problem has been fixed a long time ago (the exact commit is
unknown), but we didn't have a regression test, yet.
@usev6
Copy link

usev6 commented May 2, 2021

Nowadays this works on the JVM backend, too:

> my \a = any set <1 2 3>;
any(Set(1 2 3))
> say 1 ~~ a
False
> 

Test added with rakudo/rakudo@45e8e8d987, I'm closing this issue.

@usev6 usev6 closed this as completed May 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JVM Related to Rakudo-JVM
Projects
None yet
Development

No branches or pull requests

2 participants