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

Syntax error with &.< in combination with other operators #3763

Closed
Papierkorb opened this issue Mar 28, 2016 · 1 comment
Closed

Syntax error with &.< in combination with other operators #3763

Papierkorb opened this issue Mar 28, 2016 · 1 comment
Labels
Milestone

Comments

@Papierkorb
Copy link

Hello,

while testing my Ruby 2.3 application with JRuby master I noticed it throwing a syntax error when using &. on an operator.

Example code

# Test case giving unexpected behaviour:
{ foo: 1 }.reject{|_, value| false || value&.<(0)}
#=> SyntaxError: unexpected tLPAREN

# Removing the `false ||`
{ foo: 1 }.reject{|_, value| value&.<(0)}
#=> { foo: 1 } # This one works!

# Adding parantheses
{ foo: 1 }.reject{|_, value| false || (value&.<(0))}
#=> { foo: 1 } # This one works too!

On MRI 2.3.0p0 all reject lines give the same, expected result. On JRuby, the first line fails with a SyntaxError.

Environment

Expected Behavior

All lines return { foo: 1 }

Actual Behavior

The first gives a SyntaxError

@enebo
Copy link
Member

enebo commented Mar 29, 2016

reduced to eliminate block:

false||value&.<(0)

@enebo enebo added the parser label Mar 29, 2016
@enebo enebo added this to the JRuby 9.1.0.0 milestone Mar 29, 2016
@enebo enebo closed this as completed in f2ab40c Mar 29, 2016
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

2 participants