From 42f9c7d02d6062ce7216abc1489f7a48761cd574 Mon Sep 17 00:00:00 2001 From: Lei Zhu Date: Tue, 29 Dec 2020 19:37:21 +0800 Subject: =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=AF=B9=20doc.type.map=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E7=9A=84=E5=88=9D=E7=89=88=EF=BC=8C=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E5=A4=84=E7=90=86=E6=8E=A8=E5=AF=BC=20v1[1].bar1=20=E7=9A=84?= =?UTF-8?q?=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/definition/luadoc.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/definition') diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua index 1f3dae00..469c790d 100644 --- a/test/definition/luadoc.lua +++ b/test/definition/luadoc.lua @@ -253,3 +253,13 @@ function Generic(arg1) print(arg1) end local v1 = Generic("Foo") print(v1.) ]] + +TEST [[ +---@class Foo +local Foo = {} +function Foo:() end + +---@type table +local v1 +print(v1[1].) +]] -- cgit v1.2.3 From 573db3376fa2972cb7d9af0fa560d4e0395ce191 Mon Sep 17 00:00:00 2001 From: Lei Zhu Date: Mon, 4 Jan 2021 12:01:21 +0800 Subject: =?UTF-8?q?@type=20table=20=E6=94=AF=E6=8C=81=20for=20pairs()?= =?UTF-8?q?=E3=80=81ipairs()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/definition/luadoc.lua | 54 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'test/definition') diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua index 469c790d..3a6ff15d 100644 --- a/test/definition/luadoc.lua +++ b/test/definition/luadoc.lua @@ -263,3 +263,57 @@ function Foo:() end local v1 print(v1[1].) ]] + +TEST [[ +---@class Foo +local Foo = {} +function Foo:() end + +---@class Foo2 +local Foo2 = {} +function Foo2:bar1() end + +---@type Foo2 +local v1 +print(v1[1].) +]] + +--TODO 得扩展 simple 的信息才能识别这种情况了 +--TEST [[ +-----@class Foo +--local Foo = {} +--function Foo:bar1() end +-- +-----@class Foo2 +--local Foo2 = {} +--function Foo2:() end +-- +-----@type Foo2 +--local v1 +--print(v1.) +--]] + +TEST [[ +---@class Foo +local Foo = {} +function Foo:() end + +---@type table +local v1 +for i, v in ipairs(v1) do + print(v.) +end +]] + +TEST [[ +---@class Foo +local Foo = {} +function Foo:() end + +---@type table +local v1 +for k, v in pairs(v1) do + print(k.) + print(v.bar1) +end +]] -- cgit v1.2.3 From c57556e25cb02e01011272c305854d0f1c106e1c Mon Sep 17 00:00:00 2001 From: Lei Zhu Date: Mon, 4 Jan 2021 14:59:10 +0800 Subject: =?UTF-8?q?=E6=B7=BB=E5=8A=A0table<=20table<>>=E8=BF=99=E7=A7=8D?= =?UTF-8?q?=E5=B5=8C=E5=A5=97table=E7=9A=84=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/definition/luadoc.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/definition') diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua index 3a6ff15d..210f5a26 100644 --- a/test/definition/luadoc.lua +++ b/test/definition/luadoc.lua @@ -317,3 +317,16 @@ for k, v in pairs(v1) do print(v.bar1) end ]] + +TEST [[ +---@class Foo +local Foo = {} +function Foo:() end + +---@type table> +local v1 +for i, v in ipairs(v1) do + local v2 = v[1] + print(v2.) +end +]] -- cgit v1.2.3 From 39bbefd8b4c98be50955b2484af1a6b6f9541f54 Mon Sep 17 00:00:00 2001 From: Lei Zhu Date: Tue, 5 Jan 2021 16:50:34 +0800 Subject: =?UTF-8?q?=E5=8E=9F=E7=94=9FAPI=E4=B8=8D=E8=A6=81=E5=8E=BB?= =?UTF-8?q?=E5=88=A4=E5=90=8D=E5=AD=97=EF=BC=8C=E7=94=A8=20special=20?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=9D=A5=E5=88=A4=E6=96=AD=EF=BC=8C=E8=BF=99?= =?UTF-8?q?=E6=A0=B7=E6=94=AF=E6=8C=81=20local=20ipairs=20=3D=20ipairs=20?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/definition/luadoc.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'test/definition') diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua index 210f5a26..3c0c764b 100644 --- a/test/definition/luadoc.lua +++ b/test/definition/luadoc.lua @@ -300,6 +300,7 @@ function Foo:() end ---@type table local v1 +local ipairs = ipairs for i, v in ipairs(v1) do print(v.) end -- cgit v1.2.3 From 217aa4e586b1786bc6b82828279b745a29290f4d Mon Sep 17 00:00:00 2001 From: Lei Zhu Date: Tue, 5 Jan 2021 20:50:51 +0800 Subject: =?UTF-8?q?=E9=80=9A=E8=BF=87=E6=89=A9=E5=B1=95=20getArrayLevel=20?= =?UTF-8?q?=E6=9D=A5=E6=89=BE=E5=88=B0=E5=B1=82=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/definition/luadoc.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/definition') diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua index 3c0c764b..5315b5fd 100644 --- a/test/definition/luadoc.lua +++ b/test/definition/luadoc.lua @@ -331,3 +331,13 @@ for i, v in ipairs(v1) do print(v2.) end ]] + +TEST [[ +---@class Foo +local Foo = {} +function Foo:() end + +---@type table> +local v1 +print(v1[1][1].) +]] -- cgit v1.2.3