From 96b320247788163f7d014404b7b1f089aed82dff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Sun, 23 Oct 2022 02:21:17 +0800 Subject: infer type by function as parameters resolve #1153 --- changelog.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'changelog.md') diff --git a/changelog.md b/changelog.md index 2329cdca..2ce0f9c3 100644 --- a/changelog.md +++ b/changelog.md @@ -46,6 +46,18 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. print(obj.initValue) --> `obj.initValue` is integer ``` +* `CHG` [#1153] infer type by generic parameters or returns of function + ```lua + ---@generic T + ---@param f fun(x: T) + ---@return T[] + local function x(f) end + + ---@type fun(x: integer) + local cb + + local arr = x(cb) --> `arr` is inferred as `integer[]` + ``` * `FIX` [#1567] * `FIX` [#1593] * `FIX` [#1595] @@ -56,6 +68,7 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`. * `FIX` [#1640] * `FIX` [#1642] +[#1153]: https://github.com/sumneko/lua-language-server/issues/1153 [#1177]: https://github.com/sumneko/lua-language-server/issues/1177 [#1458]: https://github.com/sumneko/lua-language-server/issues/1458 [#1557]: https://github.com/sumneko/lua-language-server/issues/1557 -- cgit v1.2.3