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

Type Inference fails for selective import #149

Open
Maxi937 opened this issue Feb 22, 2025 · 0 comments
Open

Type Inference fails for selective import #149

Maxi937 opened this issue Feb 22, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@Maxi937
Copy link

Maxi937 commented Feb 22, 2025

Describe the bug

Issue
v-analyzer is unable to infer that mystr will be of type string. The compiler has no issue and the program does run correctly.
Image

Note
removing the selective import results in the type being inferred correctly:
Image

Expected Behavior

V-Analyzer should be able to infer a type that comes from a selective import

Current Behavior

No Error is raised and the program does run correctly, however the type of the result of the selective import function call is unknown. This means there is no auto complete.

Reproduction Steps

  1. v init a new project
  2. cd src
  3. create a new dir - "somemodule"
  4. inside "somemodule", create a file "mymodule.v"
  5. mymodule.v - add a module declaration "module somemodule"
  6. mymodule.v - create a public function (my_method) that returns some value
  7. main.v - import your function via a selctive import - import somemodule { my_method }
  8. call my_method and assign it to a value - the type of this value will not be inferred

Possible Solution

No response

Additional Information/Context

Folder Structure
Image

somemodule.v
Image

main.v
Image

Environment details (v doctor output)

Image

Editor name

VsCode

v-analyzer Version

0.0.5.ef4243a

VS Code Extension Version

0.0.2

@Maxi937 Maxi937 added the bug Something isn't working label Feb 22, 2025
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

1 participant