luau-lang / luau

A fast, small, safe, gradually typed embeddable scripting language derived from Lua
https://luau.org
MIT License
3.98k stars 373 forks source link

`any` as generic `T` incompatible with `{T}` in new type solver's strict mode #1268

Closed Ketasaja closed 2 months ago

Ketasaja commented 4 months ago
--!strict
function f<T>(a : {T}, b : T)
end

f({}, nil :: any) -- TypeError: Type 'number' could not be converted into 'number' in an invariant context

table.insert({} :: {any}, nil :: any) -- TypeError: None of the overloads for function that accept 2 arguments are compatible.

Tested on 0.627, with no errors in non-strict mode.

Ketasaja commented 2 months ago

Fixed as of 0.635.