Project

General

Profile

Actions

Bug #16389

closed

Unexpected tINTEGER in conditional expression

Added by codinganarchy (Matthew Tanous) over 4 years ago. Updated over 4 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.6.4p104 (2019-08-28 revision 67798) [x86_64-darwin18]
[ruby-core:96057]

Description

I'm not sure that this is a bug, or simply an unexpected result of operator precedence, but I am seeing a result that appears to me to be an issue.

When putting a conditional expression after a command call using unless, I am seeing a syntax error when I believe the syntax should be valid. In particular:

def foo
    puts "This method just has to exist"
end

foo unless (@bar&.nil? && @baz&.> 15)

This producessyntax error, unexpected tINTEGER, expecting ')' following the &.> safe navigation. I would not expect a syntax error here.

This seems a strange result to me, as foo unless (@bar&.nil? and @baz&.> 15) appears to work as expected, producing no syntax error.

Please let me know if I am missing something in either my expectation or the issue report. Thanks!

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0