master
1export fn callBoolMethodWithVoid() void {
2 const s = S{};
3 s.boolMethod({});
4}
5
6export fn callVoidMethodWithBool() void {
7 const s = S{};
8 s.voidMethod(false);
9}
10
11export fn callComptimeBoolMethodWithRuntimeBool() void {
12 const s = S{};
13 var arg = true;
14 _ = &arg;
15 s.comptimeBoolMethod(arg);
16}
17
18const S = struct {
19 fn boolMethod(comptime _: @This(), _: bool) void {}
20 fn voidMethod(comptime _: @This(), _: void) void {}
21 fn comptimeBoolMethod(comptime _: @This(), comptime _: bool) void {}
22};
23
24// error
25//
26// :3:18: error: expected type 'bool', found 'void'
27// :19:43: note: parameter type declared here
28// :8:18: error: expected type 'void', found 'bool'
29// :20:43: note: parameter type declared here
30// :15:26: error: unable to resolve comptime value
31// :15:26: note: argument to comptime parameter must be comptime-known
32// :21:48: note: parameter declared comptime here