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

Z* and X** are non associative and should require parentheses in Rakudo #2164

Closed
p6rt opened this issue Sep 14, 2010 · 11 comments
Closed

Z* and X** are non associative and should require parentheses in Rakudo #2164

p6rt opened this issue Sep 14, 2010 · 11 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Sep 14, 2010

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

Searchable as RT77848$

@p6rt
Copy link
Author

p6rt commented Sep 14, 2010

From @masak

<moritz_> rakudo​: say [+] '08​:12​:23'.split('​:') Z* (60 X** reverse ^3)
<p6eval> rakudo c71489​: OUTPUT«29543␤»
<masak> rakudo​: say [+] '08​:12​:23'.split('​:') Z* 60 X** reverse ^3
<p6eval> rakudo c71489​: OUTPUT«29543␤»
<moritz_> std​: say [+] '08​:12​:23'.split('​:') Z* 60 X** reverse ^3
<p6eval> std 32123​: OUTPUT«�[31m===�[0mSORRY!�[31m===�[0m␤"Z*" and
"X**" are non-associative and require parens [...] Check failed␤FAILED
00​:01 117m␤»
<moritz_> that's what I thought
* masak submits rakudobug

@p6rt
Copy link
Author

p6rt commented Oct 22, 2011

From @coke

no change in the past year.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Oct 22, 2011

@coke - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Oct 5, 2012

From sohtil@gmail.com

A similar case for the operators X+> and ...​:

$ ../rakudo/install/bin/perl6

4 X+> 1...2
2 1

This is perl6 version 2012.09.1-7-gfb11f13 built on parrot 4.4.0 revision RELEASE_4_4_0

STD rejects this code​:

std​: 4 X+> 1...2
<p6eval> std 77327a4​: OUTPUT«�[31m===�[0mSORRY!�[31m===�[0m␤"X+>" and "..." are
non-associative and require parens at /tmp/zlLrFa_Dc2 line 1​:␤------> �[32m4 X+>
1...�[33m⏏�[31m2�[0m␤Check failed␤FAILED 00​:00 42m␤»

spectest added​:

commit a5a1b211da1b1a8c6837773fabde848af3b1a10d
Author​: Edwin Steiner <edwin.steiner@​gmx.net>
Date​: Fri Oct 5 23​:59​:24 2012 +0200

  Add test related to RT #​77848, 'X+>' must not associate with '...'.

diff --git a/S03-operators/precedence.t b/S03-operators/precedence.t

@p6rt
Copy link
Author

p6rt commented Jul 1, 2013

From @masak

<FROGGS> n​: say (-300...300 X+> -5...5)
<camelia> niecza v24-86-g39ab531​: OUTPUT«===SORRY!===␤␤"X+>" and "..."
are non-associative and require parens [...]
<FROGGS> is the latter a bug?
<jnthn> std​: say (-300...300 X+> -5...5)
<camelia> std d4cc5ab​: OUTPUT«===SORRY!===␤"..." and "X+>" are
non-associative and require parens [...]
<jnthn> r​: say (-300...300 X+> -5...5)
<camelia> rakudo 567941​: OUTPUT«-300 -299 -298 -297 -296 [...]
<jnthn> Probably legit.
<TimToady> a legit bug, I think jnthn++ means
* masak submits rakudobug

The bug? STD and Niecza reject the parse, but Rakudo accepts it. It shouldn't.

@p6rt
Copy link
Author

p6rt commented Nov 18, 2014

From @usev6

A typed exception X​::Syntax​::NonAssociative is now thrown.

$ perl6-m -e 'say [+] "08​:12​:23".split("​:") Z* 60 X** reverse ^3'
===SORRY!=== Error while compiling -e
Operators 'Z*' and 'X**' are non-associative and require parentheses
at -e​:1
------> say [+] "08​:12​:23".split("​:") Z* 60 X⏏** reverse ^3
  expecting any of​:
  postfix
  infix stopper
  infix or meta-infix

$ perl6 -e 'say 4 X+> 1...2'
===SORRY!=== Error while compiling -e
Operators 'X+>' and '...' are non-associative and require parentheses
at -e​:1
------> say 4 X+> 1.⏏..2
  expecting any of​:
  postfix
  dotty method or postfix

There are two (now passing) tests in S03-operators/precedence.t.

I'm closing this ticket now.

1 similar comment
@p6rt
Copy link
Author

p6rt commented Nov 18, 2014

From @usev6

A typed exception X​::Syntax​::NonAssociative is now thrown.

$ perl6-m -e 'say [+] "08​:12​:23".split("​:") Z* 60 X** reverse ^3'
===SORRY!=== Error while compiling -e
Operators 'Z*' and 'X**' are non-associative and require parentheses
at -e​:1
------> say [+] "08​:12​:23".split("​:") Z* 60 X⏏** reverse ^3
  expecting any of​:
  postfix
  infix stopper
  infix or meta-infix

$ perl6 -e 'say 4 X+> 1...2'
===SORRY!=== Error while compiling -e
Operators 'X+>' and '...' are non-associative and require parentheses
at -e​:1
------> say 4 X+> 1.⏏..2
  expecting any of​:
  postfix
  dotty method or postfix

There are two (now passing) tests in S03-operators/precedence.t.

I'm closing this ticket now.

@p6rt p6rt closed this as completed Nov 18, 2014
@p6rt
Copy link
Author

p6rt commented Nov 18, 2014

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

@p6rt
Copy link
Author

p6rt commented Nov 18, 2014

From @usev6

Rakudo gets it right now​:

$ perl6-m -e 'say (-300...300 X+> -5...5)'
===SORRY!=== Error while compiling -e
Operators '...' and 'X+>' are non-associative and require parentheses
at -e​:1
------> say (-300...300 X⏏+> -5...5)
  expecting any of​:
  postfix
  infix stopper
  infix or meta-infix

To me this looks like a duplicate of Ticket #​77848 (https://rt-archive.perl.org/perl6/Ticket/Display.html?id=77848) and there is a test for parsing "4 X+> 1...2". I'll merge both tickets.

If you think we should have a separate test for parsing "-300...300 X+> -5...5", please reopen the ticket.

1 similar comment
@p6rt
Copy link
Author

p6rt commented Nov 18, 2014

From @usev6

Rakudo gets it right now​:

$ perl6-m -e 'say (-300...300 X+> -5...5)'
===SORRY!=== Error while compiling -e
Operators '...' and 'X+>' are non-associative and require parentheses
at -e​:1
------> say (-300...300 X⏏+> -5...5)
  expecting any of​:
  postfix
  infix stopper
  infix or meta-infix

To me this looks like a duplicate of Ticket #​77848 (https://rt-archive.perl.org/perl6/Ticket/Display.html?id=77848) and there is a test for parsing "4 X+> 1...2". I'll merge both tickets.

If you think we should have a separate test for parsing "-300...300 X+> -5...5", please reopen the ticket.

@p6rt
Copy link
Author

p6rt commented Nov 18, 2014

@usev6 - Status changed from 'new' to 'open'

@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