You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for a great issue report with a great reproducer!
For those interested to contribute, this should be super easy to fix: https://github.com/sorbet/sorbet/blob/master/dsl/ClassNew.cc is already handling Class.new, it should additionally handle Module.new.
The general case for this is going to be super tricky, If you see a def in a block, it's unclear what it is defined on since that can change at run time. Eg:
M1=Module.newdodefempty?'first'endenddefModule.new(&b)b.callallocateendM2=Module.newdodefempty?'second'endendObject.new.extend(M1).empty?# => "first"empty?# => "second"Object.new.extend(M2).empty?# => NoMethodError: private method `empty?' called for #<Object:0x00007f8098169cf0>
Input
→ View on sorbet.run
Observed output
Expected behavior
No errors.
The provided example is the minimal reproduction.
The real-world example involved
using(Module.new do ... end)and could be found here: https://github.com/palkan/rubanok/blob/b4431ac1e13600036315472f863a345675522677/lib/rubanok/rule.rb#L47-L65The text was updated successfully, but these errors were encountered: