| author | |
| committer | |
| log | c3fb30803f4fbe62abb4bfad348c585e9ab80234 |
| tree | 57905ad345e6e4e7cebdb4597b6790f073dfa0b1 |
| parent | 605f2a0978c3ae262e224ff01d163d412a64c284 |
| signature |
4 files changed, 13 insertions(+), 25 deletions(-)
test/behavior/call.zig+4-4| ... | @@ -549,7 +549,7 @@ test "call function pointer in comptime field" { | ... | @@ -549,7 +549,7 @@ test "call function pointer in comptime field" { |
| 549 | auto: [max_len]u8 = undefined, | 549 | auto: [max_len]u8 = undefined, |
| 550 | offset: u64 = 0, | 550 | offset: u64 = 0, |
| 551 | 551 | ||
| 552 | comptime capacity: *const fn () u64 = capacity, | 552 | comptime capacityFn: *const fn () u64 = capacity, |
| 553 | 553 | ||
| 554 | const max_len: u64 = 32; | 554 | const max_len: u64 = 32; |
| 555 | 555 | ||
| ... | @@ -558,9 +558,9 @@ test "call function pointer in comptime field" { | ... | @@ -558,9 +558,9 @@ test "call function pointer in comptime field" { |
| 558 | } | 558 | } |
| 559 | }; | 559 | }; |
| 560 | 560 | ||
| 561 | const a: Auto = .{ .offset = 16, .capacity = Auto.capacity }; | 561 | const a: Auto = .{ .offset = 16, .capacityFn = Auto.capacity }; |
| 562 | try std.testing.expect(a.capacity() == 32); | 562 | try std.testing.expect(a.capacityFn() == 32); |
| 563 | try std.testing.expect((a.capacity)() == 32); | 563 | try std.testing.expect((a.capacityFn)() == 32); |
| 564 | } | 564 | } |
| 565 | 565 | ||
| 566 | test "generic function pointer can be called" { | 566 | test "generic function pointer can be called" { |
test/behavior/packed-union.zig+2-2| ... | @@ -149,12 +149,12 @@ test "packed union initialized with a runtime value" { | ... | @@ -149,12 +149,12 @@ test "packed union initialized with a runtime value" { |
| 149 | value: u63, | 149 | value: u63, |
| 150 | fields: Fields, | 150 | fields: Fields, |
| 151 | 151 | ||
| 152 | fn value() i64 { | 152 | fn getValue() i64 { |
| 153 | return 1341; | 153 | return 1341; |
| 154 | } | 154 | } |
| 155 | }; | 155 | }; |
| 156 | 156 | ||
| 157 | const timestamp: i64 = ID.value(); | 157 | const timestamp: i64 = ID.getValue(); |
| 158 | const id = ID{ .fields = Fields{ | 158 | const id = ID{ .fields = Fields{ |
| 159 | .timestamp = @as(u50, @intCast(timestamp)), | 159 | .timestamp = @as(u50, @intCast(timestamp)), |
| 160 | .random_bits = 420, | 160 | .random_bits = 420, |
test/behavior/struct.zig+3-3| ... | @@ -1529,15 +1529,15 @@ test "function pointer in struct returns the struct" { | ... | @@ -1529,15 +1529,15 @@ test "function pointer in struct returns the struct" { |
| 1529 | 1529 | ||
| 1530 | const A = struct { | 1530 | const A = struct { |
| 1531 | const A = @This(); | 1531 | const A = @This(); |
| 1532 | f: *const fn () A, | 1532 | ptr: *const fn () A, |
| 1533 | 1533 | ||
| 1534 | fn f() A { | 1534 | fn f() A { |
| 1535 | return .{ .f = f }; | 1535 | return .{ .ptr = f }; |
| 1536 | } | 1536 | } |
| 1537 | }; | 1537 | }; |
| 1538 | var a = A.f(); | 1538 | var a = A.f(); |
| 1539 | _ = &a; | 1539 | _ = &a; |
| 1540 | try expect(a.f == A.f); | 1540 | try expect(a.ptr == A.f); |
| 1541 | } | 1541 | } |
| 1542 | 1542 | ||
| 1543 | test "no dependency loop on optional field wrapped in generic function" { | 1543 | test "no dependency loop on optional field wrapped in generic function" { |
test/behavior/union.zig+4-16| ... | @@ -155,18 +155,6 @@ test "unions embedded in aggregate types" { | ... | @@ -155,18 +155,6 @@ test "unions embedded in aggregate types" { |
| 155 | } | 155 | } |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | test "access a member of tagged union with conflicting enum tag name" { | ||
| 159 | const Bar = union(enum) { | ||
| 160 | A: A, | ||
| 161 | B: B, | ||
| 162 | |||
| 163 | const A = u8; | ||
| 164 | const B = void; | ||
| 165 | }; | ||
| 166 | |||
| 167 | comptime assert(Bar.A == u8); | ||
| 168 | } | ||
| 169 | |||
| 170 | test "constant tagged union with payload" { | 158 | test "constant tagged union with payload" { |
| 171 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 159 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 172 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 160 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| ... | @@ -1417,10 +1405,10 @@ test "union field ptr - zero sized payload" { | ... | @@ -1417,10 +1405,10 @@ test "union field ptr - zero sized payload" { |
| 1417 | const U = union { | 1405 | const U = union { |
| 1418 | foo: void, | 1406 | foo: void, |
| 1419 | bar: void, | 1407 | bar: void, |
| 1420 | fn bar(_: *void) void {} | 1408 | fn qux(_: *void) void {} |
| 1421 | }; | 1409 | }; |
| 1422 | var u: U = .{ .foo = {} }; | 1410 | var u: U = .{ .foo = {} }; |
| 1423 | U.bar(&u.foo); | 1411 | U.qux(&u.foo); |
| 1424 | } | 1412 | } |
| 1425 | 1413 | ||
| 1426 | test "union field ptr - zero sized field" { | 1414 | test "union field ptr - zero sized field" { |
| ... | @@ -1431,10 +1419,10 @@ test "union field ptr - zero sized field" { | ... | @@ -1431,10 +1419,10 @@ test "union field ptr - zero sized field" { |
| 1431 | const U = union { | 1419 | const U = union { |
| 1432 | foo: void, | 1420 | foo: void, |
| 1433 | bar: u32, | 1421 | bar: u32, |
| 1434 | fn bar(_: *void) void {} | 1422 | fn qux(_: *void) void {} |
| 1435 | }; | 1423 | }; |
| 1436 | var u: U = .{ .foo = {} }; | 1424 | var u: U = .{ .foo = {} }; |
| 1437 | U.bar(&u.foo); | 1425 | U.qux(&u.foo); |
| 1438 | } | 1426 | } |
| 1439 | 1427 | ||
| 1440 | test "packed union in packed struct" { | 1428 | test "packed union in packed struct" { |