diff options
| author | Chris Boesch <chrboesch@noreply.codeberg.org> | 2024-09-02 19:33:59 +0200 |
|---|---|---|
| committer | Chris Boesch <chrboesch@noreply.codeberg.org> | 2024-09-02 19:33:59 +0200 |
| commit | b2f56c7cea6475d5335dd8e8642181817fdc390b (patch) | |
| tree | a452bb020c5d66f6ea1452444630789e0e5aa036 /exercises | |
| parent | 296a2b5c6ad3b03dbd237453e7c267d1ca1bab07 (diff) | |
Fixes several changes in std.builtin.zig
Diffstat (limited to 'exercises')
| -rw-r--r-- | exercises/065_builtins2.zig | 8 | ||||
| -rw-r--r-- | exercises/071_comptime6.zig | 2 | ||||
| -rw-r--r-- | exercises/076_sentinels.zig | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/exercises/065_builtins2.zig b/exercises/065_builtins2.zig index 283aca5..0790db4 100644 --- a/exercises/065_builtins2.zig +++ b/exercises/065_builtins2.zig @@ -94,7 +94,7 @@ pub fn main() void { print("He has room in his heart for:", .{}); // A StructFields array - const fields = @typeInfo(Narcissus).Struct.fields; + const fields = @typeInfo(Narcissus).@"struct".fields; // 'fields' is a slice of StructFields. Here's the declaration: // @@ -110,15 +110,15 @@ pub fn main() void { // name will not be printed if the field is of type 'void' // (which is a zero-bit type that takes up no space at all!): if (fields[0].??? != void) { - print(" {s}", .{@typeInfo(Narcissus).Struct.fields[0].name}); + print(" {s}", .{@typeInfo(Narcissus).@"struct".fields[0].name}); } if (fields[1].??? != void) { - print(" {s}", .{@typeInfo(Narcissus).Struct.fields[1].name}); + print(" {s}", .{@typeInfo(Narcissus).@"struct".fields[1].name}); } if (fields[2].??? != void) { - print(" {s}", .{@typeInfo(Narcissus).Struct.fields[2].name}); + print(" {s}", .{@typeInfo(Narcissus).@"struct".fields[2].name}); } // Yuck, look at all that repeated code above! I don't know diff --git a/exercises/071_comptime6.zig b/exercises/071_comptime6.zig index 7723291..5938abc 100644 --- a/exercises/071_comptime6.zig +++ b/exercises/071_comptime6.zig @@ -38,7 +38,7 @@ pub fn main() void { // Please use an 'inline for' to implement the block below // for each field in the slice 'fields'! - const fields = @typeInfo(Narcissus).Struct.fields; + const fields = @typeInfo(Narcissus).@"struct".fields; ??? { if (field.type != void) { diff --git a/exercises/076_sentinels.zig b/exercises/076_sentinels.zig index 357bd95..accb600 100644 --- a/exercises/076_sentinels.zig +++ b/exercises/076_sentinels.zig @@ -78,7 +78,7 @@ fn printSequence(my_seq: anytype) void { // a switch to handle printing the Array or Pointer fields, // depending on which type of my_seq was passed in: switch (my_typeinfo) { - .Array => { + .array => { print("Array:", .{}); // Loop through the items in my_seq. @@ -86,7 +86,7 @@ fn printSequence(my_seq: anytype) void { print("{}", .{s}); } }, - .Pointer => { + .pointer => { // Check this out - it's pretty cool: const my_sentinel = sentinel(@TypeOf(my_seq)); print("Many-item pointer:", .{}); |
