[ruby-core:93353] [Ruby trunk Bug#15956] `{*nil}` causes confusing error message

From: tietew@...
Date: 2019-06-25 04:55:40 UTC
List: ruby-core #93353
Issue #15956 has been reported by Tietew (Toru Iwase).

----------------------------------------
Bug #15956: `{*nil}` causes confusing error message
https://bugs.ruby-lang.org/issues/15956

* Author: Tietew (Toru Iwase)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.7.0dev (2019-06-24T15:19:49Z trunk e09afd15b7) [x86_64-linux]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
```
$ ruby -e 'p({*nil})'
-e:1: syntax error, unexpected *, expecting '}'
p({*nil})
-e:1: Can't assign to nil
p({*nil})
```

First syntax error is intended.
But second error message `Can't assign to nil` is confusing.

This happens with `nil`, `true`, `false` and `self`.
Other identifiers including keywords don't.



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

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next