[ruby-core:93927] [Ruby master Feature#15990] "else if" causes confusing syntax error

From: viko@...
Date: 2019-07-26 03:47:05 UTC
List: ruby-core #93927
Issue #15990 has been updated by viko (Viko Viko).


Sorry for the delay, but that isn't actually a helpful error message in this case. Certainly it's an improvement, but it still doesn't actually explain the issue. Is there some reason your proposal in #2 isn't possible?

----------------------------------------
Feature #15990: "else if" causes confusing syntax error
https://bugs.ruby-lang.org/issues/15990#change-80056

* Author: viko (Viko Viko)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
```ruby
if false
  puts 'false'
else if true
  puts 'true'
end
```

This fails with "syntax error: unexpected end-of-input, expecting end". `else if` isn't `elsif`, of course, but if a file contains `else if` (especially on one line, though I don't know how easy that would be to track) and fails to parse, it is probably worth noting, especially since this kind of syntax error can't easily be traced back to a particular line.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next