Ziggit

Why doesn't ZLS give errors for incorrect usage of function? (opens in new tab)

I have this minimal working example with just doing zig init and changing main.zig to this. const std = @import("std"); const Allocator = std.mem.Allocator; const MyType = struct { const Self = @This(); pub fn init(a: Allocator, somedata: usize) Self { _ = a; _ = somedata; return Self{}; } }; pub fn main(init: std.process.Init) !void { // incorrect usage of MyType.init, missing arg somedata const my_instance = MyType.init(init.gpa); _ = my_instance; } And when I run :lua vim.diagnostic.open_f...

Read the original article
Sign in to keep reading the full article.

Keyboard Shortcuts

Navigation

Next / previous post
j/k
Open post
oorEnter
Preview post
v

Post Actions

Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Save / unsave
s

Recommendations

Add interest / feed
Enter
Not interested
x

Go to

Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Discover
gb
Search
/

General

Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help