You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeT= { status: "A" } | { status: "B" }
localx: T= { status="A" }
-- Type Error: Type '{ status: "A" } | { status: "B" }' could not be converted into 'table'table.freeze(x)
The error is incorrect here -- we definitely passed a table; the table may be one of two types, but it is still a table.
Therefore, this code should not report any errors.
Note: this might be related to the comments described at
// CLI-114044 - The new solver does not yet support generic tables,
// which act, in an odd way, like generics that are constrained to
// the top table type. We do the best we can by modelling these
// functions using unconstrained generics. It's not quite right,
// but it'll be ok for now.
when creating the table.freeze type definitions, which is a tougher problem to solve. Maybe this is a red herring by me though, it was just my first look 🙃
The text was updated successfully, but these errors were encountered:
OverHash
changed the title
Type union of tables is not classes as table
New Solver has type union of tables not classed as table
Nov 24, 2024
OverHash
changed the title
New Solver has type union of tables not classed as table
New solver has type union of tables not classed as table
Nov 24, 2024
Consider the following code sample:
The error is incorrect here -- we definitely passed a table; the table may be one of two types, but it is still a table.
Therefore, this code should not report any errors.
Note: this might be related to the comments described at
luau/Analysis/src/BuiltinDefinitions.cpp
Lines 397 to 401 in d19a5f0
table.freeze
type definitions, which is a tougher problem to solve. Maybe this is a red herring by me though, it was just my first look 🙃The text was updated successfully, but these errors were encountered: