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

Undefined field with "string" type hinted variables #566

Closed
Avril112113 opened this issue Jun 21, 2021 · 0 comments
Closed

Undefined field with "string" type hinted variables #566

Avril112113 opened this issue Jun 21, 2021 · 0 comments
Labels
bug Something isn't working priority.high A high priority topic

Comments

@Avril112113
Copy link

Avril112113 commented Jun 21, 2021

Describe the bug
With a variable or function parameter that has been given typing info to be a "string", undefined field warnings show for any field access on that variable/paremter.
I have been unable to find a test case with other built-in types, but it works as expected for custom types

To Reproduce
Steps to reproduce the behavior:

  1. In code, access any field on a "string" typed variable
  2. "Undefined field" warning will show up on that field

Code shown in below screenshot

---@type string
local strTyped
print(strTyped:lower())
print(strTyped:len())
print(strTyped.upper(strTyped))

-- Working as expected
local strInferred = "Foo"
print(strInferred:lower())
print(strInferred:len())
print(strInferred.upper(strInferred))

Expected behavior
"Undefined field" to not show up on "string" typed variable fields that do exist.

Screenshots
image

Environment (please complete the following information):

  • OS: Windows
  • Client: VSCode

Additional context
This is using the new 2.0.0 version of the extension.

Provide logs
https://pastebin.com/8s8sNPJC
There seems to be 2 of the same erros in the log that could be related at lines 3392 and 3589
Apologies for the long log file...

@sumneko sumneko added bug Something isn't working priority.high A high priority topic labels Jun 21, 2021
sumneko added a commit that referenced this issue Jun 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority.high A high priority topic
Projects
None yet
Development

No branches or pull requests

2 participants