diff --git a/spec/lax/lax_spec.lua b/spec/lax/lax_spec.lua index f3047374b..e36b8d5b1 100644 --- a/spec/lax/lax_spec.lua +++ b/spec/lax/lax_spec.lua @@ -43,4 +43,17 @@ describe("lax mode", function() { msg = "x" }, { msg = "y" }, })) + + it("performs emptytable key-value inference as normal", util.lax_check([[ + local t = {} + + local s = "str" + + t[s] = 9 + + for k, v in pairs(t) do + print(k, v) + end + ]], {})) + end) diff --git a/tl.lua b/tl.lua index b18dfb7d1..220df52d8 100644 --- a/tl.lua +++ b/tl.lua @@ -8503,7 +8503,7 @@ a.types[i], b.types[i]), } function TypeChecker:assert_is_a(w, t1, t2, ctx, name) t1 = resolve_tuple(t1) t2 = resolve_tuple(t2) - if self.feat_lax and (is_unknown(t1) or is_unknown(t2)) then + if self.feat_lax and (is_unknown(t1) or t2.typename == "unknown") then return true end diff --git a/tl.tl b/tl.tl index 35f6ce292..0ae28817e 100644 --- a/tl.tl +++ b/tl.tl @@ -8503,7 +8503,7 @@ do function TypeChecker:assert_is_a(w: Where, t1: Type, t2: Type, ctx?: string | Node, name?: string): boolean t1 = resolve_tuple(t1) t2 = resolve_tuple(t2) - if self.feat_lax and (is_unknown(t1) or is_unknown(t2)) then + if self.feat_lax and (is_unknown(t1) or t2 is UnknownType) then return true end