Open funwolf7 opened 1 year ago
This is fixed under an experimental flag LuauInstantiateInSubtyping
.
To enable it, add LUAU_FASTFLAG(LuauInstantiateInSubtyping)
to your .cpp file and set FFlag::LuauInstantiateInSubtyping.value = true;
once, before initializing Luau.
If you union a table (whether it is an array or dictionary) containing a generic function, then it causes a type error when you attempt to convert it to anything else, even to a variable with the exact same type. Intersection works without issue.
Here is a simple repro code. I use the
?
to union it with nil, but any other type causes the error. I have tested it using the latest release of luau-analyze.Without the
?
, this code gives no type errors.This makes working with typechecking very difficult, as many objects I use make use of generic functions to enhance typechecking. I am unable to union any of these objects due to this bug.