Skip to content

Commit 6678d94

Browse files
authored
Merge pull request #3362 from carsakiller/3357-string-match-returns
fix: string.match and string.gmatch may return string|number|nil
2 parents f3b91ad + 7baf2e0 commit 6678d94

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<!-- Add all new changes here. They will be moved under a version at release -->
55
* `FIX` Correct `math.type` meta return annotation to use `nil` instead of the string literal `'nil'`
66
* `FIX` Fix initial `nameStyle.config` not getting loaded in the appropriate workspace.
7+
* `FIX` string.match and string.gmatch may return `string|integer?` [#3357](https://github.com/LuaLS/lua-language-server/issues/3357)
78

89
## 3.18.2
910
* `CHG` `duplicate-set-field` diagnostic now supports linked suppression: when any occurrence of a duplicate field is suppressed with `---@diagnostic disable` or `---@diagnostic disable-next-line`, all warnings for that field name will be suppressed

meta/template/string.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ function string.format(s, ...) end
5555
---#if VERSION <= 5.3 then
5656
---@param s string|number
5757
---@param pattern string|number
58-
---@return fun():string, ...
58+
---@return fun():string|integer?, ...
5959
---@nodiscard
6060
function string.gmatch(s, pattern) end
6161
---#else
6262
---@param s string|number
6363
---@param pattern string|number
6464
---@param init? integer
65-
---@return fun():string, ...
65+
---@return fun():string|integer?, ...
6666
function string.gmatch(s, pattern, init) end
6767
---#end
6868

@@ -91,7 +91,7 @@ function string.lower(s) end
9191
---@param s string|number
9292
---@param pattern string|number
9393
---@param init? integer
94-
---@return any ...
94+
---@return string|integer? ...
9595
---@nodiscard
9696
function string.match(s, pattern, init) end
9797

0 commit comments

Comments
 (0)