From ece9e50bee2ebfc33da0bf982bb9490f65922116 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Tue, 10 Sep 2024 10:57:30 -0300 Subject: [PATCH] pending test: detect mismatch in function generics See #801. --- spec/declaration/record_function_spec.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/spec/declaration/record_function_spec.lua b/spec/declaration/record_function_spec.lua index 75bd616f5..79b81cb64 100644 --- a/spec/declaration/record_function_spec.lua +++ b/spec/declaration/record_function_spec.lua @@ -94,6 +94,26 @@ describe("record function", function() { y = 5, msg = "different number of input arguments: got 2, expected 3" }, })) + pending("detect mismatch in function generics", util.check_type_error([[ + local type List2 = record + new: function(initialItems: {T}, u: U): List2 + end + + function List2.new(initialItems: {T}, u: U): List2 -- mismatched return type + end + + local type Fruit2 = enum + "apple" + "peach" + "banana" + end + + local type L2 = List2 + local lunchbox = L2.new({"apple", "peach"}, true) + ]], { + { msg = "type signature does not match declaration" } + })) + it("report error in return args correctly (regression test for #618)", util.check_warnings([[ local record R _current: R