Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
behavior: correct tests after ziglang#18816
Browse files Browse the repository at this point in the history
  • Loading branch information
mlugg authored and RossComputerGuy committed Mar 20, 2024
1 parent df71855 commit 727c411
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 13 deletions.
8 changes: 6 additions & 2 deletions test/behavior/generics.zig
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,12 @@ test "extern function used as generic parameter" {
const S = struct {
extern fn usedAsGenericParameterFoo() void;
extern fn usedAsGenericParameterBar() void;
inline fn usedAsGenericParameterBaz(comptime _: anytype) type {
return struct {};
inline fn usedAsGenericParameterBaz(comptime token: anytype) type {
return struct {
comptime {
_ = token;
}
};
}
};
try expect(S.usedAsGenericParameterBaz(S.usedAsGenericParameterFoo) !=
Expand Down
8 changes: 6 additions & 2 deletions test/behavior/src.zig
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ test "@src" {

test "@src used as a comptime parameter" {
const S = struct {
fn Foo(comptime _: std.builtin.SourceLocation) type {
return struct {};
fn Foo(comptime src: std.builtin.SourceLocation) type {
return struct {
comptime {
_ = src;
}
};
}
};
const T1 = S.Foo(@src());
Expand Down
27 changes: 18 additions & 9 deletions test/behavior/typename.zig
Original file line number Diff line number Diff line change
Expand Up @@ -164,21 +164,30 @@ test "fn param" {
}

fn TypeFromFn(comptime T: type) type {
_ = T;
return struct {};
return struct {
comptime {
_ = T;
}
};
}

fn TypeFromFn2(comptime T1: type, comptime T2: type) type {
_ = T1;
_ = T2;
return struct {};
return struct {
comptime {
_ = T1;
_ = T2;
}
};
}

fn TypeFromFnB(comptime T1: type, comptime T2: type, comptime T3: type) type {
_ = T1;
_ = T2;
_ = T3;
return struct {};
return struct {
comptime {
_ = T1;
_ = T2;
_ = T3;
}
};
}

/// Replaces integers in `actual` with '0' before doing the test.
Expand Down

0 comments on commit 727c411

Please sign in to comment.