Project

General

Profile

Actions

Bug #16932

closed

`defined?` on refined method call returns non-nil even before `using`

Added by nobu (Nobuyoshi Nakada) almost 4 years ago. Updated almost 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
2.8.0dev (2020-06-03T10:13:36Z master ee35a4dad3)
[ruby-core:98642]

Description

From 2.0 to master (ee35a4dad3), the second defined?(a.x) before using returns truthy value.

class A
end

a = A.new
p defined?(a.x) #=> nil (OK)

m = Module.new do
  refine(A) do
    def x
    end
  end
end

a.x rescue p $! #=> NoMethodError: undefined method `x'
p defined?(a.x) #=> "method" (NG)

using m
p defined?(a.x) #=> "method" (OK)
Actions #1

Updated by nobu (Nobuyoshi Nakada) almost 4 years ago

  • Status changed from Open to Closed

Applied in changeset git|8340c773e54feb399c9fab322e3ff6dd578ac04d.


Properly resolve refinements in defined? on method call [Bug #16932]

Actions

Also available in: Atom PDF

Like0
Like0