From 5cd171f682ec7f80459741c381a7ca52c1ea1aaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 3 Nov 2021 16:15:45 +0800 Subject: check await cross linked callback --- test/diagnostics/init.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'test/diagnostics') diff --git a/test/diagnostics/init.lua b/test/diagnostics/init.lua index a46a6dd7..57c28bbb 100644 --- a/test/diagnostics/init.lua +++ b/test/diagnostics/init.lua @@ -1388,3 +1388,23 @@ function F() f() end ]] + +TEST [[ +local function f(cb) + cb() +end + +(function () ---@async + return nil +end) +]] + +TEST [[ +local function f(cb) + pcall(cb) +end + +(function () ---@async + return nil +end) +]] -- cgit v1.2.3 From 7b76328600dd9bc5206f38a549da9e4f99c9ff84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 3 Nov 2021 17:29:18 +0800 Subject: #687 `---@nodiscard` --- test/diagnostics/init.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/diagnostics') diff --git a/test/diagnostics/init.lua b/test/diagnostics/init.lua index 57c28bbb..d1d0f68f 100644 --- a/test/diagnostics/init.lua +++ b/test/diagnostics/init.lua @@ -1408,3 +1408,22 @@ end return nil end) ]] + +TEST [[ +---@nodiscard +local function f() + return 1 +end + + +]] + + +TEST [[ +---@nodiscard +local function f() + return 1 +end + +X = f() +]] -- cgit v1.2.3 From 34e9d5a1d5ec20ef180dfcc8085c6c3747d67a2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 3 Nov 2021 17:54:20 +0800 Subject: pass test --- test/diagnostics/init.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'test/diagnostics') diff --git a/test/diagnostics/init.lua b/test/diagnostics/init.lua index d1d0f68f..d6a1327c 100644 --- a/test/diagnostics/init.lua +++ b/test/diagnostics/init.lua @@ -306,7 +306,7 @@ Instance = _G[InstanceName] ]] TEST [[ -(''):sub(1, 2) +local _ = (''):sub(1, 2) ]] TEST [=[ @@ -431,7 +431,7 @@ f(1, 2, 3, 4) ]] TEST [[ -next({}, 1, ) +local _ = next({}, 1, ) print(1, 2, 3, 4, 5) ]] @@ -463,7 +463,7 @@ f(1, 2, 3) ]] TEST [[ -() +local _ = () ]] TEST [[ @@ -1353,8 +1353,8 @@ f() TEST [[ ---@type file* local f -f:read '*a' -f:read('*a') +local _ = f:read '*a' +local _ = f:read('*a') ]] TEST [[ -- cgit v1.2.3