zig icon indicating copy to clipboard operation
zig copied to clipboard

Improve 'slice of single-item pointer' error message

Open hazeycode opened this issue 3 years ago • 1 comments

Offer a correct explicit coercion syntax to help the user avoid other footgunnable workarounds when they encounter this error.

Arguably, there's no need for this if we allowed explicit coercion using slice syntax [0..] or similar (also see https://github.com/ziglang/zig/issues/8197 and https://github.com/ziglang/zig/issues/3156) but this provides immediate value to users today per the status quo.

hazeycode avatar Feb 18 '23 13:02 hazeycode

Fixed up to only emit note when the user has typed foo[0..] or foo[0..1], otherwise behaves as before. Thanks to @InKryption for the help with this!

hazeycode avatar Feb 19 '23 02:02 hazeycode