zig icon indicating copy to clipboard operation
zig copied to clipboard

Add block expression return type doc

Open shaneikennedy opened this issue 3 years ago • 7 comments

Addresses #11112

Add doc on default return type for block expressions, with test case. I'm not sure it's the most appropriate test case (comparing void to void) but couldn't think of something better, if you have any ideas add them here and I'm happy to fix this up 👍

shaneikennedy avatar Aug 19 '22 19:08 shaneikennedy

Maybe try expect(@TypeOf(x) == void); is better.... lmk what you prefer

shaneikennedy avatar Aug 20 '22 01:08 shaneikennedy

Maybe try expect(@TypeOf(x) == void); is better.... lmk what you prefer

I'd prefer that.

Vexu avatar Aug 22 '22 10:08 Vexu

@Vexu Updated 👍

shaneikennedy avatar Aug 23 '22 14:08 shaneikennedy

@Vexu I've rebased a few times now and each time I get a different failing CI step, anything I need to do here or is it just flaky?

shaneikennedy avatar Aug 29 '22 11:08 shaneikennedy

The CI is flaky, as long as one of the steps passes the Generating docgen examples phase then this is good. The bigger issue with this is that it only partially addresses the issue since it is missing a Void Literals section.

Vexu avatar Aug 30 '22 11:08 Vexu

missing a Void Literals section.

There's a "void" type section https://ziglang.org/documentation/master/#void and I think concept of literals is fairly common, but I also see a section specifically for anon. struct literals https://ziglang.org/documentation/master/#Anonymous-Struct-Literals

What do you think about me adding a Void Literals section under https://ziglang.org/documentation/master/#void and I can link to it in the doc here https://github.com/ziglang/zig/pull/12496/files#diff-9674f03a76728eff712dfbd966487142bf4103b4a58049ee9696028e890f86bcR4044?

shaneikennedy avatar Aug 30 '22 13:08 shaneikennedy

There's a "void" type section https://ziglang.org/documentation/master/#void and I think concept of literals is fairly common, but I also see a section specifically for anon. struct literals https://ziglang.org/documentation/master/#Anonymous-Struct-Literals

What do you think about me adding a Void Literals section under https://ziglang.org/documentation/master/#void and I can link to it in the doc here https://github.com/ziglang/zig/pull/12496/files#diff-9674f03a76728eff712dfbd966487142bf4103b4a58049ee9696028e890f86bcR4044?

Whatever you think works best, as long as it mentions void{} somewhere and says that {} is usually preferred.

Vexu avatar Aug 30 '22 13:08 Vexu