You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just did some testings, seems need to add a ? when declaration a function param to be of nil type 😕
Then LuaLS can type narrow the function signature correctly:
---@parambazstring|number---@paramquxstring|number---@returnstring---@overloadfun(text: string|number, title?: nil):nil ### add `?` to `title`---@overloadfun(text?: nil, title: string|number):nil ### add `?` to `text`---@overloadfun(text?: nil, title?: nil):nil ### add `?` to both `text` and `title`functionFoo.Bar(baz, qux)
ifnotbazornotquxthenreturnnilendreturn'SomeString'endlocala=Foo.Bar('Baz', 'Qux') -- **string** => it's corrects nowlocala=Foo.Bar('Baz', nil) -- nillocala=Foo.Bar('Baz') -- nillocala=Foo.Bar(nil, 'Qux') -- nillocala=Foo.Bar(nil, nil) -- nillocala=Foo.Bar() -- nil
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
Windows
What is the issue affecting?
Type Checking
Expected Behaviour
Actual Behaviour
Reproduction steps
Additional Notes
It seems to match the
'strings'
can benil
First input example
![image](https://private-user-images.githubusercontent.com/3426850/339020982-883ab347-6a70-479b-842d-92600db0fe24.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIxMzE0NjAsIm5iZiI6MTcyMjEzMTE2MCwicGF0aCI6Ii8zNDI2ODUwLzMzOTAyMDk4Mi04ODNhYjM0Ny02YTcwLTQ3OWItODQyZC05MjYwMGRiMGZlMjQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcyOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MjhUMDE0NjAwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MDQzMTdkNGEyYzBiOTk5YmRmMmJiYTQ2N2M1Y2YxZjJiZTQ5OTg5MjljN2FiOTI5MjM3MzQyZGFhMzlkOGRlNyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.XJo3pgVlke5YVCcSBceUz5v9gtLj52pfSZGt_-rYQp0)
Last input example
![image](https://private-user-images.githubusercontent.com/3426850/339021138-541bf359-ce53-4b0e-936c-712fea31960f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIxMzE0NjAsIm5iZiI6MTcyMjEzMTE2MCwicGF0aCI6Ii8zNDI2ODUwLzMzOTAyMTEzOC01NDFiZjM1OS1jZTUzLTRiMGUtOTM2Yy03MTJmZWEzMTk2MGYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcyOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MjhUMDE0NjAwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZTRkNmUyYmI3MDAwYzM1MzU5ZjcyYzg0YzRiZTIzMjkzMWFlNzFjYzg5MGVmNTZiYmFhZGY3N2VkN2EwNmVjNSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.kEMtiHfLGLrGt6mjpiXhvi-tO8LJMET_7W5nv7SS9es)
Log File
No response
The text was updated successfully, but these errors were encountered: