Luau regression causes it to not realize methods are defined when they really are

There was a recent Luau regression causing it to flag method calls that were technically sound. I haven’t done enough investigation to find out what FFlag causes the issue, but I have a minimum repro.

--!strict

local C = {}
C.__index = C

function C.new(): C
	local self = setmetatable({}, C)
	self:update()
	return self
end

export type C = typeof(C.new())

function C.update(self: C) end

The self:update() line here should not be flagged as incorrect, and it actually wasn’t before a few days ago - but now it is.

Moving the update definition above new fixes the problem, leading me to believe that something might have happened with bidirectional typechecking(?), sealed tables(?), or any number of other things. This might actually be intended behavior if some sort of temporal analysis was added, but it seems incorrect.

The issue still occurs as of March 8th, 2022 on Roblox Studio version 0.516.0.5160305 (32bit). I have these FFlags set:

{
	"DFFlagDisableDPIScale": false,
	"DFFlagVariableDPIScale2": true,
	"FFlagStudioFixHighDpiQml": true,
	"FFlagStudioWindowsDpiScale": true
}

Thanks for the report! We’ll follow up when we have an update for you.

1 Like

Luau team is working on an different typechecking implementation that doesn’t suffer from the order in which expressions are defined.

Unfortunately, until that one is completed, this isn’t something we’re planning to fix in the old implementation.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.