Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refining a property unintentionally blocks assignment in that scope. #1566

Open
imnerolin opened this issue Dec 15, 2024 · 0 comments
Open
Labels
bug Something isn't working new solver This issue is specific to the new solver.

Comments

@imnerolin
Copy link

-------- dummy case --------
type foo = {
	b: number?
}

local function baz(a: foo)
	if a.b then return end
	a.b = 5 -- number cannot be converted to nil
end

-------- my case --------
function mod.load(chunk: chunk)
	if chunk.loaded then
		return
	end
	local loadedInfo = {parts = {}}
	chunk.loaded = loadedInfo -- loadedInfo cannot be converted to nil

it does the same with booleans (true cannot be converted to false)

@imnerolin imnerolin added the bug Something isn't working label Dec 15, 2024
@aatxe aatxe added the new solver This issue is specific to the new solver. label Dec 16, 2024
@aatxe aatxe changed the title [NEW SOLVER] issue when adding a value to a table if the value is nil (type unioned with nil) Refining a property unintentionally blocks assignment in that scope. Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working new solver This issue is specific to the new solver.
Development

No branches or pull requests

2 participants