stage2: ignore generic return type when hashing function type

Generic parameter types are already ignored.
This commit is contained in:
Veikka Tuominen
2022-05-31 16:43:58 +03:00
parent febc7d3cd6
commit 36df79cd37
2 changed files with 21 additions and 1 deletions

View File

@@ -987,3 +987,21 @@ test "array type comes from generic function" {
const args = [_]S.A(){.{}};
_ = args;
}
test "generic function uses return type of other generic function" {
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
const S = struct {
fn call(
f: anytype,
args: anytype,
) @TypeOf(@call(.{}, f, @as(@TypeOf(args), undefined))) {
return @call(.{}, f, args);
}
fn func(arg: anytype) @TypeOf(arg) {
return arg;
}
};
try std.testing.expect(S.call(S.func, .{@as(u8, 1)}) == 1);
}