From 155ee2059dd18d805140b87901d01ff79257ed60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 29 Nov 2019 16:38:07 +0800 Subject: =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=83=A8=E5=88=86library?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test-beta/hover/init.lua | 855 ++++++++++++++++++++++++----------------------- 1 file changed, 435 insertions(+), 420 deletions(-) (limited to 'test-beta/hover/init.lua') diff --git a/test-beta/hover/init.lua b/test-beta/hover/init.lua index 744d2328..6d268cc8 100644 --- a/test-beta/hover/init.lua +++ b/test-beta/hover/init.lua @@ -217,16 +217,31 @@ local obj: class { } ]] -TEST[[ -local fs = require 'bee.filesystem' -local = fs.current_path() +--TEST[[ +--local fs = require 'bee.filesystem' +--local = fs.current_path() +--]] +--"local root: bee::filesystem" + +TEST [[ +() +]] +[[ +function print(...) +]] + +TEST [[ +string.() +]] +[[ +function string.sub(string, i: integer, j: integer) + -> string ]] -"local root: *bee::filesystem" TEST[[ -('xx'):() +('xx'):() ]] -[[function *string:yy() +[[function string:sub(i: integer, j: integer) -> any]] TEST [[ @@ -526,417 +541,417 @@ local = '\a' ]] [[local x: string = "\007"]] -TEST[[ ----@class Class -local = class() -]] -[[ -local x: *Class {} -]] - -TEST[[ ----@class Class - = class() -]] -[[ -global x: *Class {} -]] - -TEST[[ -local t = { - ---@class Class - = class() -} -]] -[[ -field x: *Class {} -]] - -TEST[[ ----@type Class -local = class() -]] -[[ -local x: *Class {} -]] - -TEST[[ ----@type Class - = class() -]] -[[ -global x: *Class {} -]] - -TEST[[ -local t = { - ---@type Class - = class() -} -]] -[[ -field x: *Class {} -]] - -TEST[[ ----@type A|B|C -local = class() -]] -[[ -local x: *A|B|C {} -]] - -TEST[[ ----@class Class -local = { - b = 1 -} -]] -[[ -local x: *Class { - b: number = 1, -} -]] - -TEST [[ ----@class Class -local mt = {} - ----@param t Class -function f() -end -]] -[[ -local t: *Class {} -]] - -TEST [[ ----@class Class -local mt = {} - ----@param t Class -function f(t) - print() -end -]] -[[ -local t: *Class {} -]] - -TEST [[ ----@class Class -local mt = {} - ----@param t Class -function f(t) -end - -f() -]] -[[ -global s: *Class {} -]] - -TEST [[ ----@class Class - ----@param k Class -for in pairs(t) do -end -]] -[[ -local k: *Class {} -]] - -TEST [[ ----@class Class - ----@param v Class -for k, in pairs(t) do -end -]] -[[ -local v: *Class {} -]] - -TEST [[ ----@return A|B ----@return C -local function () -end -]] -[[ -function f() - -> A|B, C -]] - -TEST [[ ----@generic T ----@param x T ----@return T -local function f(x) -end - -local = f(1) -]] -[[ -local r: number -]] - -TEST [[ ----@param x number ----@param y boolean -local function (x, y) -end -]] -[[ -function f(x: number, y: boolean) -]] - -TEST [[ ----@vararg Class -local function f(...) - local _, = ... -end -f(1, 2, 3) -]] -[[ -local x: *Class = 2 -]] - -TEST [[ ----@vararg Class -local function f(...) - local _, = ... -end -]] -[[ -local x: *Class {} -]] - -TEST [[ ----@type string[] -local -]] -[[ -local x: { - [*integer]: string, -} -]] - -TEST [[ ----@type (string|boolean)[] -local -]] -[[ -local x: { - [*integer]: string|boolean, -} -]] - -TEST [[ ----@type string[] -local t -local = t[1] -]] -[[ -local x: string -]] - -TEST [[ ----@type string[] -local t -for _, in ipairs(t) do -end -]] -[[ -local x: string -]] - -TEST [[ ----@type string[] -local t -for _, in pairs(t) do -end -]] -[[ -local x: string -]] - -TEST [[ ----@type string[] -local t -for , v in pairs(t) do -end -]] -[[ -local k: integer -]] - -TEST [[ ----@type table -local -]] -[[ -local x: { - [*ClassA]: ClassB, -} -]] - -TEST [[ ----@type table -local t -for _, in pairs(t) do -end -]] -[[ -local x: *ClassB -]] - -TEST [[ ----@type table -local t -for , v in pairs(t) do -end -]] -[[ -local k: *ClassA -]] - -TEST [[ ----@type fun(x: number, y: number):boolean -local -]] -[[ -function f(x: number, y: number) - -> boolean -]] - -TEST [[ ----@type fun(x: number, y: number):boolean -local f -f() -]] -[[ -global a: number -]] - -TEST [[ ----@type fun(x: number, y: number):boolean -local f -local = f() -]] -[[ -local r: boolean -]] - -TEST [[ ----@param f fun():void -function t() end -]] -[[ -function () - -> void -]] - -TEST [[ ----@type fun(a:any, b:any) -local f -local t = {f = f} -t:() -]] -[[ -function f(b: any) - -> any -]] - -TEST [[ ----@param names string[] -local function f() -end -]] -[[ -local names: { - [*integer]: string, -} -]] - -TEST [[ ----@return any -function () - ---@type integer - local a - return a -end -]] -[[ -function f() - -> any -]] - -TEST [[ ----@return any -function f() - ---@type integer - local a - return a -end - -local = f() -]] -[[ -local x: any -]] - -TEST [[ -local = 1 -]] -[[ -local x : number = 1 -]] - -TEST [[ ----@param x number {optional = 'after'} ----@param y boolean {optional = 'self'} ----@param z string -function (x, y, z) end -]] -[=[ -function f([x: number [, y: boolean], z: string]) -]=] - -TEST [[ ----@return string {name = 'key'} ----@return string {name = 'value'} -function () end -]] -[=[ -function f() - -> key: string, value: string -]=] - -TEST [[ ----@return {name = 'x', optional = 'after'} ----@return string {name = 'y', optional = 'self'} ----@return string {name = 'z'} -function () end -]] -[=[ -function f() - -> [x: any [, y: string], z: string] -]=] - -TEST [[ ----@return {name = 'x', optional = 'after'} ----@return string {name = 'y', optional = 'self'} ----@return string {name = 'z'} -function f() - return function (a, b) - end -end - - = f() -]] -[=[ -function f2(a: any, b: any) -]=] +--TEST[[ +-----@class Class +--local = class() +--]] +--[[ +--local x: *Class {} +--]] +-- +--TEST[[ +-----@class Class +-- = class() +--]] +--[[ +--global x: *Class {} +--]] +-- +--TEST[[ +--local t = { +-- ---@class Class +-- = class() +--} +--]] +--[[ +--field x: *Class {} +--]] +-- +--TEST[[ +-----@type Class +--local = class() +--]] +--[[ +--local x: *Class {} +--]] +-- +--TEST[[ +-----@type Class +-- = class() +--]] +--[[ +--global x: *Class {} +--]] +-- +--TEST[[ +--local t = { +-- ---@type Class +-- = class() +--} +--]] +--[[ +--field x: *Class {} +--]] +-- +--TEST[[ +-----@type A|B|C +--local = class() +--]] +--[[ +--local x: *A|B|C {} +--]] +-- +--TEST[[ +-----@class Class +--local = { +-- b = 1 +--} +--]] +--[[ +--local x: *Class { +-- b: number = 1, +--} +--]] +-- +--TEST [[ +-----@class Class +--local mt = {} +-- +-----@param t Class +--function f() +--end +--]] +--[[ +--local t: *Class {} +--]] +-- +--TEST [[ +-----@class Class +--local mt = {} +-- +-----@param t Class +--function f(t) +-- print() +--end +--]] +--[[ +--local t: *Class {} +--]] +-- +--TEST [[ +-----@class Class +--local mt = {} +-- +-----@param t Class +--function f(t) +--end +-- +--f() +--]] +--[[ +--global s: *Class {} +--]] +-- +--TEST [[ +-----@class Class +-- +-----@param k Class +--for in pairs(t) do +--end +--]] +--[[ +--local k: *Class {} +--]] +-- +--TEST [[ +-----@class Class +-- +-----@param v Class +--for k, in pairs(t) do +--end +--]] +--[[ +--local v: *Class {} +--]] +-- +--TEST [[ +-----@return A|B +-----@return C +--local function () +--end +--]] +--[[ +--function f() +-- -> A|B, C +--]] +-- +--TEST [[ +-----@generic T +-----@param x T +-----@return T +--local function f(x) +--end +-- +--local = f(1) +--]] +--[[ +--local r: number +--]] +-- +--TEST [[ +-----@param x number +-----@param y boolean +--local function (x, y) +--end +--]] +--[[ +--function f(x: number, y: boolean) +--]] +-- +--TEST [[ +-----@vararg Class +--local function f(...) +-- local _, = ... +--end +--f(1, 2, 3) +--]] +--[[ +--local x: *Class = 2 +--]] +-- +--TEST [[ +-----@vararg Class +--local function f(...) +-- local _, = ... +--end +--]] +--[[ +--local x: *Class {} +--]] +-- +--TEST [[ +-----@type string[] +--local +--]] +--[[ +--local x: { +-- [*integer]: string, +--} +--]] +-- +--TEST [[ +-----@type (string|boolean)[] +--local +--]] +--[[ +--local x: { +-- [*integer]: string|boolean, +--} +--]] +-- +--TEST [[ +-----@type string[] +--local t +--local = t[1] +--]] +--[[ +--local x: string +--]] +-- +--TEST [[ +-----@type string[] +--local t +--for _, in ipairs(t) do +--end +--]] +--[[ +--local x: string +--]] +-- +--TEST [[ +-----@type string[] +--local t +--for _, in pairs(t) do +--end +--]] +--[[ +--local x: string +--]] +-- +--TEST [[ +-----@type string[] +--local t +--for , v in pairs(t) do +--end +--]] +--[[ +--local k: integer +--]] +-- +--TEST [[ +-----@type table +--local +--]] +--[[ +--local x: { +-- [*ClassA]: ClassB, +--} +--]] +-- +--TEST [[ +-----@type table +--local t +--for _, in pairs(t) do +--end +--]] +--[[ +--local x: *ClassB +--]] +-- +--TEST [[ +-----@type table +--local t +--for , v in pairs(t) do +--end +--]] +--[[ +--local k: *ClassA +--]] +-- +--TEST [[ +-----@type fun(x: number, y: number):boolean +--local +--]] +--[[ +--function f(x: number, y: number) +-- -> boolean +--]] +-- +--TEST [[ +-----@type fun(x: number, y: number):boolean +--local f +--f() +--]] +--[[ +--global a: number +--]] +-- +--TEST [[ +-----@type fun(x: number, y: number):boolean +--local f +--local = f() +--]] +--[[ +--local r: boolean +--]] +-- +--TEST [[ +-----@param f fun():void +--function t() end +--]] +--[[ +--function () +-- -> void +--]] +-- +--TEST [[ +-----@type fun(a:any, b:any) +--local f +--local t = {f = f} +--t:() +--]] +--[[ +--function f(b: any) +-- -> any +--]] +-- +--TEST [[ +-----@param names string[] +--local function f() +--end +--]] +--[[ +--local names: { +-- [*integer]: string, +--} +--]] +-- +--TEST [[ +-----@return any +--function () +-- ---@type integer +-- local a +-- return a +--end +--]] +--[[ +--function f() +-- -> any +--]] +-- +--TEST [[ +-----@return any +--function f() +-- ---@type integer +-- local a +-- return a +--end +-- +--local = f() +--]] +--[[ +--local x: any +--]] +-- +--TEST [[ +--local = 1 +--]] +--[[ +--local x : number = 1 +--]] +-- +--TEST [[ +-----@param x number {optional = 'after'} +-----@param y boolean {optional = 'self'} +-----@param z string +--function (x, y, z) end +--]] +--[=[ +--function f([x: number [, y: boolean], z: string]) +--]=] +-- +--TEST [[ +-----@return string {name = 'key'} +-----@return string {name = 'value'} +--function () end +--]] +--[=[ +--function f() +-- -> key: string, value: string +--]=] +-- +--TEST [[ +-----@return {name = 'x', optional = 'after'} +-----@return string {name = 'y', optional = 'self'} +-----@return string {name = 'z'} +--function () end +--]] +--[=[ +--function f() +-- -> [x: any [, y: string], z: string] +--]=] +-- +--TEST [[ +-----@return {name = 'x', optional = 'after'} +-----@return string {name = 'y', optional = 'self'} +-----@return string {name = 'z'} +--function f() +-- return function (a, b) +-- end +--end +-- +-- = f() +--]] +--[=[ +--function f2(a: any, b: any) +--]=] -- cgit v1.2.3