diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2022-09-09 02:28:56 -0400 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-09-10 01:55:52 +0300 |
| commit | 5b9c5191ab919f4166a9e0c4486bd57bb2533791 (patch) | |
| tree | fd45835c1c92cb296354109968c9c0045b0f018c /src/type.zig | |
| parent | 8e631ee3e7b4e7b4466c0efafaffb4151447785f (diff) | |
| download | zig-5b9c5191ab919f4166a9e0c4486bd57bb2533791.tar.gz zig-5b9c5191ab919f4166a9e0c4486bd57bb2533791.zip | |
type: print comptime on fn type params
This avoids the following confusing error message:
error: expected type 'fn(i32, i32) void', found 'fn(i32, i32) void'
Diffstat (limited to 'src/type.zig')
| -rw-r--r-- | src/type.zig | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/type.zig b/src/type.zig index 0d48c5e46a..ec7e155d4e 100644 --- a/src/type.zig +++ b/src/type.zig @@ -2042,6 +2042,9 @@ pub const Type = extern union { try writer.writeAll("fn("); for (fn_info.param_types) |param_ty, i| { if (i != 0) try writer.writeAll(", "); + if (fn_info.paramIsComptime(i)) { + try writer.writeAll("comptime "); + } if (std.math.cast(u5, i)) |index| if (@truncate(u1, fn_info.noalias_bits >> index) != 0) { try writer.writeAll("noalias "); }; |
