luau icon indicating copy to clipboard operation
luau copied to clipboard

[New solver] Blocked type trying to implement linked lists

Open imnerolin opened this issue 9 months ago • 0 comments

type node<T> = {
	value: T,
	_next: node<T>?
}

type llist<T> = {
	_head: node<T>?
}

local ll = {} :: llist<string>

local cur = ll._head
while cur do
	print(cur.value) -- line 33
	cur = cur._next -- line 34
end

on cur.value:

Type Error: (33,8) Key 'value' is missing from '(buffer | class | function | number | string | table | thread | true) & *blocked-133627*' in the type '((buffer | class | function | number | string | table | thread | true) & *blocked-133627*) | node'

on cur._next:

Type Error: (34,8) Key '_next' is missing from '(buffer | class | function | number | string | table | thread | true) & *blocked-133627*' in the type '((buffer | class | function | number | string | table | thread | true) & *blocked-133627*) | node'

imnerolin avatar Mar 16 '25 18:03 imnerolin