Skip to content

Commit

Permalink
LuaLS#3014. Fixed parsing of ... Symbol but still separated 2 dots …
Browse files Browse the repository at this point in the history
…`..`, added changelog.
  • Loading branch information
TIMONz1535 committed Dec 29, 2024
1 parent f4a69bc commit e66a8ab
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
9 changes: 9 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

## Unreleased
<!-- Add all new changes here. They will be moved under a version at release -->
* `CHG` [#3014] Generic pattern now supports definition after capture
```lua
---@generic T
---@param t `T`.Cat
---@return T
local function f(t) end

local t = f('Smile') --> t is `Smile.Cat`
```

## 3.13.5
`2024-12-20`
Expand Down
3 changes: 2 additions & 1 deletion script/parser/luadoc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@ EChar <- 'a' -> ea
/ ([0-9] [0-9]? [0-9]?) -> Char10
/ ('u{' {X16*} '}') -> CharUtf8
Symbol <- ({} {
[:|,;<>()?+#{}.*]
[:|,;<>()?+#{}*]
/ '[]'
/ '...'
/ '['
/ ']'
/ '-' !'-'
/ '.' !'..'
} {})
-> Symbol
]], {
Expand Down
8 changes: 4 additions & 4 deletions test/definition/luadoc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -375,12 +375,12 @@ print(v1.<?bar1?>)
]]

TEST [[
---@class n.Foo*
---@class n.Foo.2
local Foo = {}
function Foo:bar1() end
---@generic T
---@param arg1 n.`T`*
---@param arg1 n.`T`.2
---@return T
function Generic(arg1) print(arg1) end
Expand All @@ -389,12 +389,12 @@ print(v1.<?bar1?>)
]]

TEST [[
---@class n.Foo*
---@class n.Foo.2
local Foo = {}
function Foo:<!bar1!>() end
---@generic T
---@param arg1 n.`T`*
---@param arg1 n.`T`.2
---@return T
function Generic(arg1) print(arg1) end
Expand Down

0 comments on commit e66a8ab

Please sign in to comment.