summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/higher-order-functions/overloaded.slang
blob: d3d495bc1b8ca1f04a903491b6db0346c7c5b8de (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
//TEST:INTERPRET(filecheck=CHECK):

func foo(f : functype (float) -> int) -> int{
    return f(0);
}

int bit<T>(T) {
    return 10;
}

int bit<T, let N : int>(vector<T, N>) {
    return 1;
}

int zit() {
    // even though foo is overloaded, we should still be able to infer that we want bit<T>
    // based on the parameter (expected) type.
    return foo(bit<float>);
}

void main()
{
    // CHECK: 10
    printf("%d\n", zit());
}