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
local function createMyObject()
local vehicle = {} ---@class Vehicle
vehicle.mySuperObject = vehicle
function vehicle:getVehicle()
return vehicle
end
function vehicle:getVehicleAndSomethingElse()
return vehicle, true
end
return vehicle
end
local function createMyObjectSubClass()
local car = {} ---@class Car : Vehicle
function car:getVehicle()
return car
end
function car:getVehicleAndSomethingElse() -- Illegal override of "getVehicleAndSomethingElse". Type mismatch. Required: 'fun(): Vehicle, true' Found: 'fun(): Car, true'
return car, true
end
function car:getVehicleAndSomethingElse()
return car.mySuperObject, true
end
return car
end
What happens?
The first override of getVehicleAndSomethingElse gets an error, while the getVehicle override doesn't while they effectively have the same signature except for one returning multiple values.
What were you expecting to happen?
The first override of getVehicleAndSomethingElse to correctly resolve its type inheritance.
Any other comments?
This might be related to #44, but might also be an addition to it. Using something similar to #44's example will also only give the incorrect 'Illegal override' on the getStringAndSomethingElse method.
function vehicle:getString()
return string.upper("a")
end
function vehicle:getStringAndSomethingElse()
return string.upper("a"), true
end
function car:getString()
return "A"
end
function car:getStringAndSomethingElse()
return "A", true
end
The text was updated successfully, but these errors were encountered:
Environment
What are the steps to reproduce this issue?
What happens?
The first override of
getVehicleAndSomethingElse
gets an error, while thegetVehicle
override doesn't while they effectively have the same signature except for one returning multiple values.What were you expecting to happen?
The first override of
getVehicleAndSomethingElse
to correctly resolve its type inheritance.Any other comments?
This might be related to #44, but might also be an addition to it. Using something similar to #44's example will also only give the incorrect 'Illegal override' on the
getStringAndSomethingElse
method.The text was updated successfully, but these errors were encountered: