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
Using a self parametric type with an interface seems to somehow inherit the record context from which a generic method is called.
-- Define an interface that uses self.-- Using self should automatically refine implementations to map self to the impl.localinterfaceContainernew: function(): selfend-- Calling Foo.new should return a Foo (that is, replace `self` with `Foo`)localrecordFooisContainerend-- Use another collaborating record to demonstrate the bug.localrecordSomeRecordupdate: function(self: SomeRecord)
endlocalfunctionfoo<CisContainer>(c: C)
end-- Calling foo, which expects a Container, from this outer scope works.localouterValue=Foo.new()
foo(outerValue) -- works!-- Calling foo from within SomeRecord.update does not work.functionSomeRecord:update()
localvalue=Foo.new()
foo(value) -- Doesn't work?-- ^ given type SomeRecord does not satisfy Container constraint in type variable Cend
The text was updated successfully, but these errors were encountered:
This one took a while to fix. Commit 365fbd3 should do it, at least for cases without generics. There is a pending test
showcasing the cases which are not covered by this commit.
Using a self parametric type with an interface seems to somehow inherit the record context from which a generic method is called.
The text was updated successfully, but these errors were encountered: