ziglang/vscode-zig

type hints is incorrect

yar999 opened this issue · 1 comments

vscode: 1.89.0
vscode-zig: v0.5.7
os: MacOS 14.4.1 (23E224)

a[1..4] should be a pointer *const [3]i32, not a slice []i32, As shown in the attached screenshot

const std = @import("std");

pub fn main() !void {
    const a = [_]i32{ 1, 2, 3, 4, 5 };
    const b = a[1..4]; // it should be a pointer *const [3]i32, not a slice []i32
    std.debug.print("{}\n", .{@TypeOf(b)});
    var end: usize = 0;
    end = 4;
    const c = a[1..end];
    std.debug.print("{}\n", .{@TypeOf(c)});
}

hints

This issue is already being tracked by ZLS in zigtools/zls#1230