Issue #11534 has been reported by Tim Smith.

----------------------------------------
Bug #11534: Circular assignment / method shadowing unexpected behavior
https://bugs.ruby-lang.org/issues/11534

* Author: Tim Smith
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
def foo
  1
end

puts foo + 1

bar = foo + 1
puts bar

foo = foo + 1
puts foo

# EXPECTED
2
2
2

# ACTUAL
2
2
undefined method `+' for nil:NilClass (NoMethodError)



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