Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assert() "Cannot assign unknown to parameter <T>?." #1306

Closed
flrgh opened this issue Jul 8, 2022 · 3 comments
Closed

assert() "Cannot assign unknown to parameter <T>?." #1306

flrgh opened this issue Jul 8, 2022 · 3 comments
Labels
bug Something isn't working
Milestone

Comments

@flrgh
Copy link
Contributor

flrgh commented Jul 8, 2022

version 3.4.2

Describe the bug

I believe this is a general issue, but I'll describe it as it pertains to assert, since that is a concrete example.

To Reproduce

local value
assert(value, "assertion failed")

This yields a diagnostic warning:

Cannot assign unknown to parameter <T>?

Expected behavior

This seems unexpected to me, since a generic type param (<T>) should theoretically accept any type, especially since the parameter is optional. Is it a bug or expected behavior?

I'd prefer not to disable this diagnostic, because it is helpful in other cases where there is a real type mismatch.


lua-language-server.log
neovim-lsp.log
Screenshot from 2022-07-14 11-44-17

Screenshot from 2022-07-14 11-55-01

@sumneko
Copy link
Collaborator

sumneko commented Jul 11, 2022

I cannot reproduce this

@sumneko sumneko added the Info Needed More information is required label Jul 11, 2022
@flrgh
Copy link
Contributor Author

flrgh commented Jul 11, 2022

Gotcha, I'll add a full config+log later this week.

@flrgh
Copy link
Contributor Author

flrgh commented Jul 14, 2022

@sumneko added some logs. The diagnostic code that is raised is param-type-mismatch.

@sumneko sumneko added bug Something isn't working and removed Info Needed More information is required labels Jul 15, 2022
@sumneko sumneko modified the milestone: 3.5.0 Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants