diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-07-06 22:54:12 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-07-06 22:54:12 +0800 |
commit | 353caabfce0ee23644d3d74cbcbfcce3fbb32b73 (patch) | |
tree | 6ae1c4f20c95676181cd7cbf064e87c7250ce3b1 /test | |
parent | 26e0310a410820650832f8576154c9b7ee183324 (diff) | |
download | lua-language-server-353caabfce0ee23644d3d74cbcbfcce3fbb32b73.zip |
binary operator
Diffstat (limited to 'test')
-rw-r--r-- | test/type_inference/init.lua | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua index f31a8777..7bb39f19 100644 --- a/test/type_inference/init.lua +++ b/test/type_inference/init.lua @@ -3418,3 +3418,120 @@ TEST 'A' [[ local a local <?b?> = #a ]] + +TEST 'A' [[ +---@class A +---@operator add: A + +---@type A +local a +local <?b?> = a + 1 +]] + +TEST 'A' [[ +---@class A +---@operator sub: A + +---@type A +local a +local <?b?> = a - 1 +]] + +TEST 'A' [[ +---@class A +---@operator mul: A + +---@type A +local a +local <?b?> = a * 1 +]] + +TEST 'A' [[ +---@class A +---@operator div: A + +---@type A +local a +local <?b?> = a / 1 +]] + +TEST 'A' [[ +---@class A +---@operator mod: A + +---@type A +local a +local <?b?> = a % 1 +]] + +TEST 'A' [[ +---@class A +---@operator pow: A + +---@type A +local a +local <?b?> = a ^ 1 +]] + +TEST 'A' [[ +---@class A +---@operator idiv: A + +---@type A +local a +local <?b?> = a // 1 +]] + +TEST 'A' [[ +---@class A +---@operator band: A + +---@type A +local a +local <?b?> = a & 1 +]] + +TEST 'A' [[ +---@class A +---@operator bor: A + +---@type A +local a +local <?b?> = a | 1 +]] + +TEST 'A' [[ +---@class A +---@operator bxor: A + +---@type A +local a +local <?b?> = a ~ 1 +]] + +TEST 'A' [[ +---@class A +---@operator shl: A + +---@type A +local a +local <?b?> = a << 1 +]] + +TEST 'A' [[ +---@class A +---@operator shr: A + +---@type A +local a +local <?b?> = a >> 1 +]] + +TEST 'A' [[ +---@class A +---@operator concat: A + +---@type A +local a +local <?b?> = a .. 1 +]] |