codeql icon indicating copy to clipboard operation
codeql copied to clipboard

Ruby: Add type row for extends calls

Open hmac opened this issue 2 years ago • 0 comments

A call to extend M adds all the instance methods of module M as class methods to the receiver. For example:

module A
  def f; end
end

class B
  extend A
end

B.f # => targets A.f

To model this, we generate a typeModel row of the form

A, B!,

which can be interpreted as "the class B is an instance of the module A". This is not strictly true, but means that class method calls on B which are defined in A will be dispatched correctly.

hmac avatar Jan 12 '24 15:01 hmac