Issue #16050 has been updated by jeremyevans0 (Jeremy Evans).

Status changed from Open to Rejected

I don't think this is a bug.  Just because `:@iv` is valid syntax does not imply that `:@` should also be valid syntax.  You should use a quoted symbol (note that `Symbol#inspect` quotes the symbol):

```ruby
:'@'
# => :"@"
'@'.to_sym
# => :"@"
```

----------------------------------------
Bug #16050: :@ is not parsed correctly
https://bugs.ruby-lang.org/issues/16050#change-80439

* Author: sawa (Tsuyoshi Sawada)
* Status: Rejected
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Symbol literal allows `@` as the first character:

```ruby
:@foo # => :@foo
```

Nevertheless, it does not allow `@` by itself:

```ruby
:@ # >> SyntaxError: `@' without identifiers is not allowed as an instance variable name
```

This resembles #10463, but while #10463 is related to placeholder in a method name, the issue here is related to instance variable name, so I think they are different issues.



-- 
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>