From b88f14bf53e6c53f1d6e1ee274fc1a26a1afb639 Mon Sep 17 00:00:00 2001 From: ffrostfall <80861876+ffrostfall@users.noreply.github.com> Date: Tue, 4 Feb 2025 00:55:23 -0500 Subject: [PATCH] Specify 2nd argument failure case for setmetatable --- docs/metatable-type-functions.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/metatable-type-functions.md b/docs/metatable-type-functions.md index 767b4f8..3744a4b 100644 --- a/docs/metatable-type-functions.md +++ b/docs/metatable-type-functions.md @@ -22,6 +22,8 @@ local 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 [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.