Skip to content

Wrong error location when .? is misplaced in for (...) |*x| body #10674

@fogti

Description

@fogti

Zig Version

0.9.0-dev.c9ae24503dc8da2e59f46619695bf4eb863fb3ac

Steps to Reproduce

test "x" {
  var items = [_]u8 { 1, 2, 3 };
  for (items) |*i| {
    i.?.* = 1;
  }
}

Expected Behavior

./src/main.zig:7:5: error: expected optional type, found '*u8'
    i.?.* = 1;
    ^

Actual Behavior

./src/main.zig:6:17: error: expected optional type, found '*u8'
  for (items) |*i| {
                ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorstage1The process of building from source via WebAssembly and the C backend.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions