Skip to content

Commit e66a8ab

Browse files
committed
LuaLS#3014. Fixed parsing of ... Symbol but still separated 2 dots .., added changelog.
1 parent f4a69bc commit e66a8ab

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

changelog.md

+9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
## Unreleased
44
<!-- Add all new changes here. They will be moved under a version at release -->
5+
* `CHG` [#3014] Generic pattern now supports definition after capture
6+
```lua
7+
---@generic T
8+
---@param t `T`.Cat
9+
---@return T
10+
local function f(t) end
11+
12+
local t = f('Smile') --> t is `Smile.Cat`
13+
```
514

615
## 3.13.5
716
`2024-12-20`

script/parser/luadoc.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,13 @@ EChar <- 'a' -> ea
5454
/ ([0-9] [0-9]? [0-9]?) -> Char10
5555
/ ('u{' {X16*} '}') -> CharUtf8
5656
Symbol <- ({} {
57-
[:|,;<>()?+#{}.*]
57+
[:|,;<>()?+#{}*]
5858
/ '[]'
5959
/ '...'
6060
/ '['
6161
/ ']'
6262
/ '-' !'-'
63+
/ '.' !'..'
6364
} {})
6465
-> Symbol
6566
]], {

test/definition/luadoc.lua

+4-4
Original file line numberDiff line numberDiff line change
@@ -375,12 +375,12 @@ print(v1.<?bar1?>)
375375
]]
376376

377377
TEST [[
378-
---@class n.Foo*
378+
---@class n.Foo.2
379379
local Foo = {}
380380
function Foo:bar1() end
381381
382382
---@generic T
383-
---@param arg1 n.`T`*
383+
---@param arg1 n.`T`.2
384384
---@return T
385385
function Generic(arg1) print(arg1) end
386386
@@ -389,12 +389,12 @@ print(v1.<?bar1?>)
389389
]]
390390

391391
TEST [[
392-
---@class n.Foo*
392+
---@class n.Foo.2
393393
local Foo = {}
394394
function Foo:<!bar1!>() end
395395
396396
---@generic T
397-
---@param arg1 n.`T`*
397+
---@param arg1 n.`T`.2
398398
---@return T
399399
function Generic(arg1) print(arg1) end
400400

0 commit comments

Comments
 (0)