Project

General

Profile

Actions

Bug #20111

closed

`defined?` returns `expression` for assignment operators combined with fully qualified constants

Added by andrykonchin (Andrew Konchin) 11 months ago. Updated 9 months ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:115991]

Description

defined? doesn't consider &&=, ||= and other ...= operators as assignment:

defined?(A::B += 1) # => "expression"
defined?(A::B &&= true) # => "expression"
defined?(A::B ||= true) # => "expression"

But considers as assignment ordinal assignment:

defined?(A::B = 1) # => "assignment"

Wondering if it's expected behaviour.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like1Like0Like1