blob: 55af3424c0a9266014fdc9d9a942bc0fe7953a60 (
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
//TEST:INTERPRET(filecheck=CHECK):
// Test that we can call variadic generic [Differentiable] methods.
interface IParameterExtractor
{
[Differentiable]
void extract(no_diff uint x);
}
struct FloatParameterExtractor : IParameterExtractor
{
[Differentiable]
void extract(no_diff uint x)
{
printf("fff\n");
}
}
[Differentiable]
void extract_parameters_helper<T : IParameterExtractor>(
no_diff uint x,
T arg,
)
{
arg.extract(x);
}
[Differentiable]
void wrapper1<each T>(
uint x,
expand each T args, // compiler will add no_diff modifier here.
)
where T : IParameterExtractor
{
expand extract_parameters_helper(x, each args);
}
[Differentiable]
void wrapper2<each T>(
uint x,
expand each T args, // compiler will add no_diff modifier here.
)
where T : IParameterExtractor
{
wrapper1(x, args);
}
void main()
{
// There was a bug that causes the compiler failing to treat a `no_diff TypePack` as
// a type pack, and thus diagnose an error when resolving the following call.
//
wrapper2(1, FloatParameterExtractor(), FloatParameterExtractor());
}
// CHECK: fff
// CHECK: fff
|