summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/vm/operator.lua4
-rw-r--r--test/type_inference/init.lua7
2 files changed, 11 insertions, 0 deletions
diff --git a/script/vm/operator.lua b/script/vm/operator.lua
index 69340648..de2c3243 100644
--- a/script/vm/operator.lua
+++ b/script/vm/operator.lua
@@ -95,6 +95,10 @@ function vm.runOperator(op, exp, value)
local node = vm.compileNode(exp)
local result
for c in node:eachObject() do
+ if c.type == 'string'
+ or c.type == 'doc.type.string' then
+ c = vm.declareGlobal('type', 'string')
+ end
if c.type == 'global' and c.cate == 'type' then
---@cast c vm.global
for _, set in ipairs(c:getSets(uri)) do
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index 11004e23..8607625e 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -3594,3 +3594,10 @@ local t
local <?x?> = t.n
]]
+
+TEST 'string' [[
+---@class string
+---@operator mod: string
+
+local <?b?> = '' % 1
+]]