luau icon indicating copy to clipboard operation
luau copied to clipboard

Self-bound types produced with the `index<>` type function and `typeof` being used recursively, crashing the new solver

Open nothing1649 opened this issue 11 months ago • 0 comments

As of version 0.658, the following two cases crash the new solver, regardless of strict mode being used. Due to typeof being used recursively this should produce a type error instead, however it crashes instead:

--!strict
local propertyKeys:{propertyKey} = nil::never
--InternalCompilerError - ConstraintSolver::unblock encountered a self-bound type!
type propertyKey = index<typeof(propertyKeys), number>

Changing the case slightly results in a different error (possibly the same underlying cause?):

--!strict
--InternalCompilerError - Luau::follow detected a Type cycle!!
local propertyKeys:{propertyKey} = nil::never
type propertyKey = index<typeof(propertyKeys), number>
local propertyKey:propertyKey = propertyKeys
if propertyKey then end

nothing1649 avatar Jan 30 '25 21:01 nothing1649