DonIsaac / zlint

A linter for the Zig programming language
MIT License
24 stars 1 forks source link

lint for `var` with a numeric literal without a type #27

Open paperdave opened 3 weeks ago

paperdave commented 3 weeks ago

A common compile error I run into that a linter could catch faster than the non-incremental compiler.

Outside of comptime, this code is invalid.

pub fn etc() void {
  var hello = 0; // fail

  comptime { var goodbye = 0; } // ok
}

const y = brk: {
  var y = 0; // ok
  y = 1;
  break :brk y;  
};