Classes dont inherits metamethods properly
kithf opened this issue · comments
kithf commented
Seems that when the child extend the parent, it does some strange things?
Tested on https://yuescript.org/try/ and LuaJIT 2.1.0-beta3 results are the same.
Code to reproduce:
class A
<tostring>: => return "321"
class B extends A
a, b = A!, B!
print tostring a -- 312
print tostring b -- table: ...
print getmetatable(b).__tostring, -- function: ...
getmetatable(b).__tostring(b) -- 312
Li Jin commented
It's the Lua rule that only does raw-get to access the metamethods. I updated the generated codes to insert super metamethods into derived class object.