| ... | @@ -355,19 +355,12 @@ fn testOpaque() !void { | ... | @@ -355,19 +355,12 @@ fn testOpaque() !void { |
| 355 | } | 355 | } |
| 356 | | 356 | |
| 357 | test "type info: function type info" { | 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 | try testFunction(); | 358 | try testFunction(); |
| 366 | comptime try testFunction(); | 359 | comptime try testFunction(); |
| 367 | } | 360 | } |
| 368 | | 361 | |
| 369 | fn testFunction() !void { | 362 | fn testFunction() !void { |
| 370 | const fn_info = @typeInfo(@TypeOf(foo)); | 363 | const fn_info = @typeInfo(@TypeOf(typeInfoFoo)); |
| 371 | try expect(fn_info == .Fn); | 364 | try expect(fn_info == .Fn); |
| 372 | try expect(fn_info.Fn.alignment > 0); | 365 | try expect(fn_info.Fn.alignment > 0); |
| 373 | try expect(fn_info.Fn.calling_convention == .C); | 366 | try expect(fn_info.Fn.calling_convention == .C); |
| ... | @@ -375,12 +368,12 @@ fn testFunction() !void { | ... | @@ -375,12 +368,12 @@ fn testFunction() !void { |
| 375 | try expect(fn_info.Fn.args.len == 2); | 368 | try expect(fn_info.Fn.args.len == 2); |
| 376 | try expect(fn_info.Fn.is_var_args); | 369 | try expect(fn_info.Fn.is_var_args); |
| 377 | try expect(fn_info.Fn.return_type.? == usize); | 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 | try expect(fn_aligned_info.Fn.alignment == 4); | 372 | try expect(fn_aligned_info.Fn.alignment == 4); |
| 380 | } | 373 | } |
| 381 | | 374 | |
| 382 | extern fn foo(a: usize, b: bool, ...) callconv(.C) usize; | 375 | extern fn typeInfoFoo(a: usize, b: bool, ...) callconv(.C) usize; |
| 383 | extern fn fooAligned(a: usize, b: bool, ...) align(4) callconv(.C) usize; | 376 | extern fn typeInfoFooAligned(a: usize, b: bool, ...) align(4) callconv(.C) usize; |
| 384 | | 377 | |
| 385 | test "type info: generic function types" { | 378 | test "type info: generic function types" { |
| 386 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | 379 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; |