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

Basic string concat type inference is missing #2037

Closed
stylpe opened this issue Mar 27, 2023 · 0 comments
Closed

Basic string concat type inference is missing #2037

stylpe opened this issue Mar 27, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@stylpe
Copy link

stylpe commented Mar 27, 2023

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, Hover

Expected Behaviour

Two string vars or a string var and a string literal being concatenated should get the result inferred to also be a string.

Actual Behaviour

It infers unknown.

Reproduction steps

image
image

Additional Notes

I'm guessing #680 maybe took away too much? It seems reasonable to infer string as the result type when both the sources are also pure strings (or possibly other basic types too). And maybe there are also other operators where this is the case.

I'd say it doesn't need to be a goal to support every weird corner case like if one variable is ´string|CustomType´ or accounting for metatable shenanigans, but the straightforward basic cases should be supported.

Log File

No response

@sumneko sumneko added the bug Something isn't working label Mar 29, 2023
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