luau icon indicating copy to clipboard operation
luau copied to clipboard

Incorrect "Recursive type being used with different parameters" error

Open centau opened this issue 2 years ago • 1 comments

Came across a very odd type error in my codebase, managed to create a minimal reproduction below:

image

Changing the Bar type so that the metatable field is not casted to another typedef removes the error.

image

Repositioning the Baz type to above the Bar type also removes the error.

image

All examples were tested in strict mode.

Code:

type Foo = Baz<unknown>

export type Bar<T> = typeof((setmetatable({}, {} :: BarMetatable)))
type BarMetatable = {}

type Baz<T> = { T }

centau avatar May 08 '23 00:05 centau

This is already fixed in the new solver.

andyfriesen avatar May 19 '23 19:05 andyfriesen