luau icon indicating copy to clipboard operation
luau copied to clipboard

Type functions cause crashes and other issues if used on a type that contains the function

Open JokeCommit opened this issue 4 months ago • 1 comments

Type functions seem to have issues when you use a type that a function is inside of. Here's a case that causes a crash 100% of the time:

--!strict
type function Type(t)
	return t
end

local Table = {}

function Table.Foo<T>(arg: T)
	return arg :: Type<T>
end

local test = Table.Foo(Table) --crashes upon typing

Here's a case that doesn't crash but causes a type error: Image Image

Type functions with containing types can be used for OOP. Here's what I was trying to do when I encountered this issue: Image

JokeCommit avatar Aug 23 '25 04:08 JokeCommit

Hi there! The crash has been confirmed to be fixed by a flag which was flipped last week, although the erroneous type errors are still present.

skanosue avatar Aug 25 '25 19:08 skanosue