mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
Apply explicit error type
This commit is contained in:
parent
78d12762a9
commit
f51c8f26c1
@ -316,7 +316,7 @@ pub fn formatType(
|
|||||||
options: FormatOptions,
|
options: FormatOptions,
|
||||||
out_stream: var,
|
out_stream: var,
|
||||||
max_depth: usize,
|
max_depth: usize,
|
||||||
) !void {
|
) @TypeOf(out_stream).Error!void {
|
||||||
if (comptime std.mem.eql(u8, fmt, "*")) {
|
if (comptime std.mem.eql(u8, fmt, "*")) {
|
||||||
try out_stream.writeAll(@typeName(@TypeOf(value).Child));
|
try out_stream.writeAll(@typeName(@TypeOf(value).Child));
|
||||||
try out_stream.writeAll("@");
|
try out_stream.writeAll("@");
|
||||||
@ -1472,19 +1472,19 @@ test "enum" {
|
|||||||
try testFmt("E.Two", "{}", .{inst});
|
try testFmt("E.Two", "{}", .{inst});
|
||||||
}
|
}
|
||||||
|
|
||||||
// test "struct.self-referential" {
|
test "struct.self-referential" {
|
||||||
// const S = struct {
|
const S = struct {
|
||||||
// const SelfType = @This();
|
const SelfType = @This();
|
||||||
// a: ?*SelfType,
|
a: ?*SelfType,
|
||||||
// };
|
};
|
||||||
|
|
||||||
// var inst = S{
|
var inst = S{
|
||||||
// .a = null,
|
.a = null,
|
||||||
// };
|
};
|
||||||
// inst.a = &inst;
|
inst.a = &inst;
|
||||||
|
|
||||||
// try testFmt("S{ .a = S{ .a = S{ .a = S{ ... } } } }", "{}", .{inst});
|
try testFmt("S{ .a = S{ .a = S{ .a = S{ ... } } } }", "{}", .{inst});
|
||||||
// }
|
}
|
||||||
|
|
||||||
test "struct.zero-size" {
|
test "struct.zero-size" {
|
||||||
const A = struct {
|
const A = struct {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user