Skip to content

Commit 8945820

Browse files
committed
update CHANGELOG.md
1 parent 7363845 commit 8945820

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

CHANGELOG.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,76 @@
22

33
# 0.8.1 (unreleased)
44

5+
`CHG` Generic constraint (StrTplRef) removes the protection for string:
6+
```lua
7+
---@generic T: string -- need to remove `: string`
8+
---@param a `T`
9+
---@return T
10+
local function class(a)
11+
end
12+
13+
---@class A
14+
15+
lcoal A = class("A") -- error
16+
```
17+
18+
`NEW` Explicitly declared `Tuple` are immutable.
19+
```lua
20+
---@type [1, 2]
21+
local a = {1, 2}
22+
23+
a[1] = 3 -- error
24+
```
25+
26+
`FIX` Hover `function` now can show the corresponding doc comment.
27+
28+
`NEW` Added the configuration item `classDefaultCall`, which is used to declare a method with the specified name as the default `__call` for a class. The effect is equivalent to `---@overload fun()`, but with a lower priority. If an explicitly declared `---@overload fun()` exists, `classDefaultCall` will have no effect on the class.
29+
30+
```json
31+
{
32+
"runtime": {
33+
"classDefaultCall": {
34+
"functionName": "__init",
35+
"forceNonColon": true,
36+
"forceReturnSelf": true
37+
}
38+
},
39+
}
40+
```
41+
42+
```lua
43+
---@class MyClass
44+
local M = {}
45+
46+
-- `functionName` is `__init`, so the call will be treated as `__init`
47+
function M:__init(a)
48+
-- `forceReturnSelf` is `true`, so the call will return `self`. even if the method does not return `self` or returns some other value.
49+
end
50+
51+
52+
-- `forceNonColon` is `true`, so the call can be called without `:` and without passing `self`
53+
-- `forceReturnSelf` is `true`, so the call will return `self`
54+
A = M() -- `A` is `MyClass`
55+
```
56+
57+
58+
`NEW` Added `docBaseConstMatchBaseType` configuration item, default is `false`. Base constant types defined in doc can match base types, allowing int to match `---@alias id 1|2|3`, same for string.
59+
60+
```json
61+
{
62+
"strict": {
63+
"docBaseConstMatchBaseType": true
64+
},
65+
}
66+
```
67+
68+
`FIX` When `enum` is used as a function parameter, it is treated as a value rather than the `enum` itself.
69+
70+
`FIX` When the expected type of a table field is a function, function completion is available.
71+
72+
`NEW` `inlay_hint` params hint can now jump to the actual type definition.
73+
74+
575
# 0.8.0
676

777
`NEW` Implement `std.Unpack` type for better type inference of the `unpack` function, and `std.Rawget` type for better type inference of the `rawget` function

0 commit comments

Comments
 (0)