aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/generic_instantiation_failure.zig
blob: d820f8f410b4036a9319a3dc704e0dc7bc154c53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
fn List(comptime Head: type, comptime Tail: type) type {
    return union {
        const Self = @This();
        head: Head,
        tail: Tail,

        fn AppendReturnType(comptime item: anytype) type {
            return List(Head, List(@TypeOf(item), void));
        }
    };
}

fn makeList(item: anytype) List(@TypeOf(item), void) {
    return List(@TypeOf(item), void){ .head = item };
}

pub export fn entry() void {
    @TypeOf(makeList(42)).AppendReturnType(64);
}

// error
// backend=llvm
// target=native
//
// :18:43: error: value of type 'type' ignored
// :18:43: note: all non-void values must be used
// :18:43: note: to discard the value, assign it to '_'