Skip to content

Commit

Permalink
merge 改叫 partial
Browse files Browse the repository at this point in the history
  • Loading branch information
sumneko committed Apr 18, 2024
1 parent 3767771 commit e1e7926
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# changelog

## 3.7.5
* `NEW` alias and enums supports attribute `merge`
* `NEW` alias and enums supports attribute `partial`
```lua
---@alias Animal Cat

---@alias(merge) Animal Dog
---@alias(partial) Animal Dog

---@type Animal
local animal --> animal is `Cat|Dog` here
Expand All @@ -19,7 +19,7 @@
FATAL = 2,
}

---@enum(key, merge) ErrorCodes
---@enum(key, partial) ErrorCodes
local codes2 = {
WARN = 3,
INFO = 4,
Expand Down
2 changes: 1 addition & 1 deletion script/core/diagnostics/duplicate-doc-alias.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ return function (uri, callback)
finish = otherDoc.finish,
uri = guide.getUri(otherDoc),
}
merged[name] = merged[name] or vm.docHasAttr(otherDoc, 'merge')
merged[name] = merged[name] or vm.docHasAttr(otherDoc, 'partial')
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions test/diagnostics/duplicate-doc-alias.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ TEST [[

TEST [[
---@alias A integer
---@alias(merge) A integer
---@alias(partial) A integer
---@enum B
---@enum(merge) B
---@enum(partial) B
---@enum(key) C
---@enum(key, merge) C
---@enum(key, partial) C
]]
2 changes: 1 addition & 1 deletion test/type_inference/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4338,7 +4338,7 @@ local <?x?> = f()

TEST 'boolean|number' [[
---@alias A number
---@alias(merge) A boolean
---@alias(partial) A boolean
---@type A
local <?x?>
Expand Down

0 comments on commit e1e7926

Please sign in to comment.