Variable should not be inferred as string just because it's concatenated with one #680
Labels
bug
Something isn't working
feat/LuaCats Annotations
Related to Lua Language Server Annotations (LuaCats)
Describe the bug
If I declare a variable and put a
---@type Whatever
comment on it marking it as aWhatever
-typed variable, and then later concatenate that variable with a string, the IDE thinks the variable is typed asstring|Whatever
, even ifWhatever
has a__concat
metamethod. I'm not necessarily asking for analysis of metatables/methods, but if I have a variable that's explicitly marked as being a specific type, concatenating it with a string shouldn't widen it tostring|Whatever
, as it doesn't need to be a string to be concatenated with one.To Reproduce
Steps to reproduce the behavior:
test
variable declared inTestClass:new
Expected behavior
The
test
variable should still be typed asWhatever
despite being concatenated with a string.Screenshots

Environment (please complete the following information):
Provide logs
https://hastebin.com/atuyasuzup.log
The text was updated successfully, but these errors were encountered: