summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meta/template/file.lua10
-rw-r--r--meta/template/io.lua12
-rw-r--r--meta/template/os.lua20
-rw-r--r--meta/template/package.lua4
-rw-r--r--meta/template/utf8.lua2
-rw-r--r--script-beta/parser/luadoc.lua2
-rw-r--r--test-beta/hover/init.lua2
7 files changed, 26 insertions, 26 deletions
diff --git a/meta/template/file.lua b/meta/template/file.lua
index d648450d..e79c2255 100644
--- a/meta/template/file.lua
+++ b/meta/template/file.lua
@@ -11,9 +11,9 @@ local file = {}
---@alias exitcode | '"exit"'|'"signal"'
----@return boolean suc?
----@return exitcode exitcode?
----@return integer code?
+---@return boolean? suc
+---@return exitcode? exitcode
+---@return integer? code
function file:close() end
function file:flush() end
@@ -34,7 +34,7 @@ function file:read(...) end
---@param whence? seekwhence
---@param offset? integer
---@return integer offset
----@return string errmsg?
+---@return string? errmsg
function file:seek(whence, offset) end
---@alias vbuf
@@ -47,5 +47,5 @@ function file:setvbuf(mode, size) end
---@vararg string|number
---@return file?
----@return string errmsg?
+---@return string? errmsg
function file:write(...) end
diff --git a/meta/template/io.lua b/meta/template/io.lua
index 75ebf101..3669dd16 100644
--- a/meta/template/io.lua
+++ b/meta/template/io.lua
@@ -21,9 +21,9 @@ io = {}
---| '"a+b"'
---@param file? file*
----@return boolean suc?
----@return exitcode exitcode?
----@return integer code?
+---@return boolean? suc
+---@return exitcode? exitcode
+---@return integer? code
function io.close(file) end
function io.flush() end
@@ -40,7 +40,7 @@ function io.lines(filename, ...) end
---@param filename string
---@param mode openmode
---@return file*?
----@return string errmsg?
+---@return string? errmsg
function io.open(filename, mode) end
---@overload fun():file*
@@ -54,7 +54,7 @@ function io.output(file) end
---@param prog string
---@param mode? popenmode
---@return file*?
----@return string errmsg?
+---@return string? errmsg
function io.popen(prog, mode) end
---@vararg readmode
@@ -74,7 +74,7 @@ function io.tmpfile() end
function io.type(file) end
---@return file*
----@return string errmsg?
+---@return string? errmsg
function io.write(...) end
return io
diff --git a/meta/template/os.lua b/meta/template/os.lua
index d14e88f9..173900eb 100644
--- a/meta/template/os.lua
+++ b/meta/template/os.lua
@@ -17,13 +17,13 @@ function os.date(format, time) end
function os.difftime(t2, t1) end
---@param command string
----@return boolean suc?
----@return exitcode exitcode?
----@return integer code?
+---@return boolean? suc
+---@return exitcode? exitcode
+---@return integer? code
function os.execute(command) end
----@param code boolean|integer?
----@param close boolean?
+---@param code? boolean|integer
+---@param close? boolean
function os.exit(code, close) end
---@param varname string
@@ -32,13 +32,13 @@ function os.getenv(varname) end
---@param filename string
---@return boolean suc
----@return string errmsg?
+---@return string? errmsg
function os.remove(filename) end
---@param oldname string
---@param newname string
---@return boolean suc
----@return string errmsg?
+---@return string? errmsg
function os.rename(oldname, newname) end
---@alias localecategory
@@ -49,12 +49,12 @@ function os.rename(oldname, newname) end
---| '"numeric"'
---| '"time"'
----@param locale string|nil
----@param category localecategory?
+---@param locale string|nil
+---@param category? localecategory
---@return string localecategory
function os.setlocale(locale, category) end
----@param date table?
+---@param date? table
---@return integer
function os.time(date) end
diff --git a/meta/template/package.lua b/meta/template/package.lua
index bd5b0350..efe286af 100644
--- a/meta/template/package.lua
+++ b/meta/template/package.lua
@@ -25,8 +25,8 @@ function package.loadlib(libname, funcname) end
---@param path string
---@param sep? string
---@param rep? string
----@return string filename?
----@return string errmsg?
+---@return string? filename
+---@return string? errmsg
function package.searchpath(name, path, sep, rep) end
---@param module table
diff --git a/meta/template/utf8.lua b/meta/template/utf8.lua
index fe2db493..687a6b46 100644
--- a/meta/template/utf8.lua
+++ b/meta/template/utf8.lua
@@ -27,7 +27,7 @@ function utf8.codepoint(s, i, j, lax) end
---@param j? integer
---@param lax? boolean
---@return integer?
----@return integer errpos?
+---@return integer? errpos
function utf8.len(s, i, j, lax) end
---@param s string
diff --git a/script-beta/parser/luadoc.lua b/script-beta/parser/luadoc.lua
index b9f7430f..dfb4b96a 100644
--- a/script-beta/parser/luadoc.lua
+++ b/script-beta/parser/luadoc.lua
@@ -577,11 +577,11 @@ local function parseReturn()
if not result.start then
result.start = docType.start
end
- docType.name = parseName('doc.return.name', docType)
if checkToken('symbol', '?', 1) then
nextToken()
docType.optional = true
end
+ docType.name = parseName('doc.return.name', docType)
result.returns[#result.returns+1] = docType
if not checkToken('symbol', ',', 1) then
break
diff --git a/test-beta/hover/init.lua b/test-beta/hover/init.lua
index 2dbe3bbe..8bb20665 100644
--- a/test-beta/hover/init.lua
+++ b/test-beta/hover/init.lua
@@ -1275,7 +1275,7 @@ function f(x?: number, y?: boolean)
]]
TEST [[
----@return table first, string second?
+---@return table first, string? second
local function <?f?>(x, y)
end
]]