mirror of
https://github.com/luau-lang/rfcs.git
synced 2025-05-04 10:43:48 +01:00
Fix wrongly sectioned failure case for setmetatable
This commit is contained in:
parent
61793d0a72
commit
087c3d208d
1 changed files with 1 additions and 2 deletions
|
@ -22,8 +22,6 @@ local clock = {}
|
||||||
type Identity = setmetatable<{ time: number }, { __index: typeof(clock) }>
|
type Identity = setmetatable<{ time: number }, { __index: typeof(clock) }>
|
||||||
```
|
```
|
||||||
|
|
||||||
If the second argument of the type function isn't a table, then it should error.
|
|
||||||
|
|
||||||
### `getmetatable` Type Function
|
### `getmetatable` Type Function
|
||||||
|
|
||||||
[Issue #1435](https://github.com/luau-lang/luau/issues/1435) is caused by a lack of special behavior for `getmetatable` when the type's metatable has a `__metatable` field. This is fixable in a variety of ways, however a type function has multiple benefits and exposes more type-level expression for users. It fits in nicely with the new solver, as type functions are a cleaner alternative to magic functions.
|
[Issue #1435](https://github.com/luau-lang/luau/issues/1435) is caused by a lack of special behavior for `getmetatable` when the type's metatable has a `__metatable` field. This is fixable in a variety of ways, however a type function has multiple benefits and exposes more type-level expression for users. It fits in nicely with the new solver, as type functions are a cleaner alternative to magic functions.
|
||||||
|
@ -45,6 +43,7 @@ type Identity = setmetatable<{
|
||||||
|
|
||||||
When a non-table type (number, boolean) is passed into the type function, it should result in an error. This includes classes.
|
When a non-table type (number, boolean) is passed into the type function, it should result in an error. This includes classes.
|
||||||
If the type is an intersection or union of tables, then the metatable should be applied to every component type.
|
If the type is an intersection or union of tables, then the metatable should be applied to every component type.
|
||||||
|
If the second argument of the type function isn't a table, then it should error.
|
||||||
|
|
||||||
### `getmetatable` Type Function
|
### `getmetatable` Type Function
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue