| author | |
| committer | |
| log | 45c667eb21b1edde991435871523ece82793b449 |
| tree | 93519b7479f61b345dcdcc4677b867a54a31be8f |
| parent | e875530f8f886cbf8272ab18d063252b94a835c9 |
4 files changed, 11 insertions(+), 23 deletions(-)
test/behavior.zig+1-7| ... | ... | @@ -211,13 +211,7 @@ test { |
| 211 | 211 | _ = @import("behavior/export.zig"); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | if (builtin.zig_backend != .stage2_arm and | |
| 215 | builtin.zig_backend != .stage2_x86_64 and | |
| 216 | builtin.zig_backend != .stage2_aarch64 and | |
| 217 | builtin.zig_backend != .stage2_wasm and | |
| 218 | builtin.zig_backend != .stage2_c and | |
| 219 | builtin.zig_backend != .stage1) | |
| 220 | { | |
| 214 | if (builtin.zig_backend != .stage2_wasm) { | |
| 221 | 215 | _ = @import("behavior/export_self_referential_type_info.zig"); |
| 222 | 216 | } |
| 223 | 217 | } |
test/behavior/export_self_referential_type_info.zig+1-1| ... | ... | @@ -1 +1 @@ |
| 1 | export const foo: c_int = @boolToInt(@typeInfo(@This()).Struct.is_tuple); | |
| 1 | export const self_referential_type_info: c_int = @boolToInt(@typeInfo(@This()).Struct.is_tuple); |
test/behavior/generics.zig+5-4| ... | ... | @@ -361,13 +361,14 @@ test "nested generic function" { |
| 361 | 361 | |
| 362 | 362 | test "extern function used as generic parameter" { |
| 363 | 363 | const S = struct { |
| 364 | extern fn foo() void; | |
| 365 | extern fn bar() void; | |
| 366 | inline fn baz(comptime _: anytype) type { | |
| 364 | extern fn usedAsGenericParameterFoo() void; | |
| 365 | extern fn usedAsGenericParameterBar() void; | |
| 366 | inline fn usedAsGenericParameterBaz(comptime _: anytype) type { | |
| 367 | 367 | return struct {}; |
| 368 | 368 | } |
| 369 | 369 | }; |
| 370 | try expect(S.baz(S.foo) != S.baz(S.bar)); | |
| 370 | try expect(S.usedAsGenericParameterBaz(S.usedAsGenericParameterFoo) != | |
| 371 | S.usedAsGenericParameterBaz(S.usedAsGenericParameterBar)); | |
| 371 | 372 | } |
| 372 | 373 | |
| 373 | 374 | test "generic struct as parameter type" { |
test/behavior/type_info.zig+4-11| ... | ... | @@ -355,19 +355,12 @@ fn testOpaque() !void { |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | test "type info: function type info" { |
| 358 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | |
| 359 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | |
| 360 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | |
| 361 | ||
| 362 | // wasm doesn't support align attributes on functions | |
| 363 | if (builtin.target.cpu.arch == .wasm32 or builtin.target.cpu.arch == .wasm64) return error.SkipZigTest; | |
| 364 | ||
| 365 | 358 | try testFunction(); |
| 366 | 359 | comptime try testFunction(); |
| 367 | 360 | } |
| 368 | 361 | |
| 369 | 362 | fn testFunction() !void { |
| 370 | const fn_info = @typeInfo(@TypeOf(foo)); | |
| 363 | const fn_info = @typeInfo(@TypeOf(typeInfoFoo)); | |
| 371 | 364 | try expect(fn_info == .Fn); |
| 372 | 365 | try expect(fn_info.Fn.alignment > 0); |
| 373 | 366 | try expect(fn_info.Fn.calling_convention == .C); |
| ... | ... | @@ -375,12 +368,12 @@ fn testFunction() !void { |
| 375 | 368 | try expect(fn_info.Fn.args.len == 2); |
| 376 | 369 | try expect(fn_info.Fn.is_var_args); |
| 377 | 370 | try expect(fn_info.Fn.return_type.? == usize); |
| 378 | const fn_aligned_info = @typeInfo(@TypeOf(fooAligned)); | |
| 371 | const fn_aligned_info = @typeInfo(@TypeOf(typeInfoFooAligned)); | |
| 379 | 372 | try expect(fn_aligned_info.Fn.alignment == 4); |
| 380 | 373 | } |
| 381 | 374 | |
| 382 | extern fn foo(a: usize, b: bool, ...) callconv(.C) usize; | |
| 383 | extern fn fooAligned(a: usize, b: bool, ...) align(4) callconv(.C) usize; | |
| 375 | extern fn typeInfoFoo(a: usize, b: bool, ...) callconv(.C) usize; | |
| 376 | extern fn typeInfoFooAligned(a: usize, b: bool, ...) align(4) callconv(.C) usize; | |
| 384 | 377 | |
| 385 | 378 | test "type info: generic function types" { |
| 386 | 379 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; |