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

Wrong Type Hintings #240

Open
ayananerv opened this issue Oct 29, 2024 · 2 comments
Open

Wrong Type Hintings #240

ayananerv opened this issue Oct 29, 2024 · 2 comments
Labels
lsp Issue with language server integration

Comments

@ayananerv
Copy link

ayananerv commented Oct 29, 2024

vscode-zig version:

Zig Language v0.5.9

Issues:

I want a pointer with type *usize, so I allocated some memory with ArenaAllocator,. It should give me a buffer with type []usize, but the hinted result is []u8:

image

image

@Techatrix
Copy link
Collaborator

This is probably caused by zigtools/zls#1841

@Techatrix Techatrix added the lsp Issue with language server integration label Oct 29, 2024
@ayananerv
Copy link
Author

This is probably caused by zigtools/zls#1841

Wow you really nailed it!!!

My first allocated memory has a type of u8:

const buffer = try arena.alloc(u8, stat.size);

And the type deduction is u8

When I changed this line to const buffer = try arena.alloc(usize, stat.size);, all the left deductions are changed to usize!

I'm actually not familiar with vscode-zig and I just disabled zls in vscode a few days ago. It seems that this plugin depends on zls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lsp Issue with language server integration
Projects
None yet
Development

No branches or pull requests

2 participants