Skip to content

Commit d119258

Browse files
committed
补充测试和更新说明
1 parent b203674 commit d119258

File tree

3 files changed

+40
-2
lines changed

3 files changed

+40
-2
lines changed

changelog.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,37 @@
11
# changelog
22

33
## 3.7.5
4+
* `NEW` alias and enums supports attribute `merge`
5+
```lua
6+
---@alias Animal Cat
7+
8+
---@alias(merge) Animal Dog
9+
10+
---@type Animal
11+
local animal --> animal is `Cat|Dog` here
12+
```
13+
14+
```lua
15+
---@enum(key) ErrorCodes
16+
local codes1 = {
17+
OK = 0,
18+
ERROR = 1,
19+
FATAL = 2,
20+
}
21+
22+
---@enum(key, merge) ErrorCodes
23+
local codes2 = {
24+
WARN = 3,
25+
INFO = 4,
26+
}
27+
28+
---@type ErrorCodes
29+
local code
30+
31+
code = 'ERROR' --> OK
32+
code = 'WARN' --> OK
33+
34+
```
435
* `FIX` rename in library files
536

637
## 3.7.4

script/parser/luadoc.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,7 @@ local docSwitch = util.switch()
10261026
local result = {
10271027
type = 'doc.alias',
10281028
}
1029-
result.docAttr = parseDocAttr()
1029+
result.docAttr = parseDocAttr(result)
10301030
result.alias = parseName('doc.alias.name', result)
10311031
if not result.alias then
10321032
pushWarning {

test/type_inference/init.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4335,4 +4335,11 @@ end
43354335
43364336
local <?x?> = f()
43374337
]=]
4338-
--
4338+
4339+
TEST 'boolean|number' [[
4340+
---@alias A number
4341+
---@alias(merge) A boolean
4342+
4343+
---@type A
4344+
local <?x?>
4345+
]]

0 commit comments

Comments
 (0)