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

@Papierkorb Papierkorb commented Mar 28, 2016

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 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 in f2ab40c Mar 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.