"Unknown type conversion variable" #2207
-
I frequently run into the issue of being unable to cast fields when calling constructors of a base class from a derived one, and I'm not sure if I'm doing something wrong. Here's a case that (I think) should work, however it doesn't. As a result I also get the diagnostic for wrong return type afterwards. ---@class MyClass
local MyClass = {}
---@class MyDerivedClass : MyClass
local MyDerivedClass = {}
---@return MyClass
function MyClass.Create()
return {}
end
---@return MyDerivedClass
function MyDerivedClass.Create()
local instance = MyClass.Create() ---@cast instance MyDerivedClass
return instance
end The code is of course for demonstration purposes of the issue and not a functional OOP example. Would like to know if I'm doing something wrong or if this is a bug. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
That's odd, I copied your example and everything seems to be working: Perhaps something in your configuration is acting up? |
Beta Was this translation helpful? Give feedback.
-
This can be tracked in #2326. |
Beta Was this translation helpful? Give feedback.
This can be tracked in #2326.