-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.
Milestone
Description
Zig Version
0.12.0-dev.2158+4f2009de1
Steps to Reproduce and Observed Behavior
I noticed while using zls a few pointer captures which don't account for capturing by reference. All of the following code snippets incorrectly highlight the asterisk instead of the identifier:
switch (undefined) {
.a => |*ident| {},
// ^ unused capture
// ^^^^^ range should be here
}
if (undefined) |*foo| {} else |err| {}
// ^ unused capture
while (undefined) |*foo| {} else |err| {}
// ^ unused capture
// EDITED here, removed incorrect by ref captureI have a PR in the works which I'll submit soon.
Thanks to @Techatrix for helping me discover some of these in the zls discord. I originally only noticed that the switch pointer capture was off and he helped spot the others.
Expected Behavior
correct ranges for unused captures
Techatrix
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.