mirror of
https://github.com/ziglang/zig.git
synced 2025-02-10 22:50:18 +00:00
behavior: fix redefined exports
This commit is contained in:
parent
e875530f8f
commit
45c667eb21
@ -211,13 +211,7 @@ test {
|
||||
_ = @import("behavior/export.zig");
|
||||
}
|
||||
|
||||
if (builtin.zig_backend != .stage2_arm and
|
||||
builtin.zig_backend != .stage2_x86_64 and
|
||||
builtin.zig_backend != .stage2_aarch64 and
|
||||
builtin.zig_backend != .stage2_wasm and
|
||||
builtin.zig_backend != .stage2_c and
|
||||
builtin.zig_backend != .stage1)
|
||||
{
|
||||
if (builtin.zig_backend != .stage2_wasm) {
|
||||
_ = @import("behavior/export_self_referential_type_info.zig");
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const foo: c_int = @boolToInt(@typeInfo(@This()).Struct.is_tuple);
|
||||
export const self_referential_type_info: c_int = @boolToInt(@typeInfo(@This()).Struct.is_tuple);
|
||||
|
@ -361,13 +361,14 @@ test "nested generic function" {
|
||||
|
||||
test "extern function used as generic parameter" {
|
||||
const S = struct {
|
||||
extern fn foo() void;
|
||||
extern fn bar() void;
|
||||
inline fn baz(comptime _: anytype) type {
|
||||
extern fn usedAsGenericParameterFoo() void;
|
||||
extern fn usedAsGenericParameterBar() void;
|
||||
inline fn usedAsGenericParameterBaz(comptime _: anytype) type {
|
||||
return struct {};
|
||||
}
|
||||
};
|
||||
try expect(S.baz(S.foo) != S.baz(S.bar));
|
||||
try expect(S.usedAsGenericParameterBaz(S.usedAsGenericParameterFoo) !=
|
||||
S.usedAsGenericParameterBaz(S.usedAsGenericParameterBar));
|
||||
}
|
||||
|
||||
test "generic struct as parameter type" {
|
||||
|
@ -355,19 +355,12 @@ fn testOpaque() !void {
|
||||
}
|
||||
|
||||
test "type info: function type info" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
|
||||
// wasm doesn't support align attributes on functions
|
||||
if (builtin.target.cpu.arch == .wasm32 or builtin.target.cpu.arch == .wasm64) return error.SkipZigTest;
|
||||
|
||||
try testFunction();
|
||||
comptime try testFunction();
|
||||
}
|
||||
|
||||
fn testFunction() !void {
|
||||
const fn_info = @typeInfo(@TypeOf(foo));
|
||||
const fn_info = @typeInfo(@TypeOf(typeInfoFoo));
|
||||
try expect(fn_info == .Fn);
|
||||
try expect(fn_info.Fn.alignment > 0);
|
||||
try expect(fn_info.Fn.calling_convention == .C);
|
||||
@ -375,12 +368,12 @@ fn testFunction() !void {
|
||||
try expect(fn_info.Fn.args.len == 2);
|
||||
try expect(fn_info.Fn.is_var_args);
|
||||
try expect(fn_info.Fn.return_type.? == usize);
|
||||
const fn_aligned_info = @typeInfo(@TypeOf(fooAligned));
|
||||
const fn_aligned_info = @typeInfo(@TypeOf(typeInfoFooAligned));
|
||||
try expect(fn_aligned_info.Fn.alignment == 4);
|
||||
}
|
||||
|
||||
extern fn foo(a: usize, b: bool, ...) callconv(.C) usize;
|
||||
extern fn fooAligned(a: usize, b: bool, ...) align(4) callconv(.C) usize;
|
||||
extern fn typeInfoFoo(a: usize, b: bool, ...) callconv(.C) usize;
|
||||
extern fn typeInfoFooAligned(a: usize, b: bool, ...) align(4) callconv(.C) usize;
|
||||
|
||||
test "type info: generic function types" {
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
|
Loading…
Reference in New Issue
Block a user