diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/crossfile/hover.lua | 2 | ||||
-rw-r--r-- | test/diagnostics/type-check.lua | 34 | ||||
-rw-r--r-- | test/type_inference/init.lua | 22 |
3 files changed, 56 insertions, 2 deletions
diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index 08cde574..b9ffd59b 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -811,7 +811,7 @@ food.secondField = 2 }, hover = [[ ```lua -(field) Food.firstField: number = 0 +(field) Food.firstField: number ```]]} TEST {{ path = 'a.lua', content = '', }, { diff --git a/test/diagnostics/type-check.lua b/test/diagnostics/type-check.lua index 30e727d3..295fb32d 100644 --- a/test/diagnostics/type-check.lua +++ b/test/diagnostics/type-check.lua @@ -212,6 +212,40 @@ local y TEST [[ ---@class A +local m + +m.x = 1 + +---@type A +local t + +<!t.x!> = true +]] + +TEST [[ +---@class A +local m + +---@type integer +m.x = 1 + +<!m.x!> = true +]] + +TEST [[ +---@class A +local mt + +---@type integer +mt.x = 1 + +function mt:init() + <!self.x!> = true +end +]] + +TEST [[ +---@class A ---@field x integer ---@type A diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua index 3a7b1227..b448e837 100644 --- a/test/type_inference/init.lua +++ b/test/type_inference/init.lua @@ -2675,7 +2675,7 @@ local t local <?x?> = t.x ]] -TEST 'integer' [[ +TEST 'integer|unknown' [[ local function f() return GG end @@ -2719,3 +2719,23 @@ end local <?n?> = f() ]] + +TEST 'integer' [[ +---@class A +---@field x integer +local m + +m.<?x?> = true + +print(m.x) +]] + +TEST 'integer' [[ +---@class A +---@field x integer +local m + +m.x = true + +print(m.<?x?>) +]] |