blob: f2572484ec5a27bf3a6d4fd4064026d6dcbe6d88 (
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
|
//TEST:INTERPRET(filecheck=CHECK):
public interface IDataTrait {
public associatedtype InputType;
public static const int32_t kElementCount;
}
public struct DataTrait0 : IDataTrait {
public typedef float InputType;
public static const int32_t kElementCount = 2;
}
public interface IGenericInterface<Ti : IFloat> {
public Array<Di.InputType, Di.kElementCount> eval<Di : IDataTrait>(const Di.InputType interface_input);
}
public struct GenericImpl<T : IFloat> : IGenericInterface<T>
{
public Array<Dx.InputType, Dx.kElementCount> eval<Dx : IDataTrait>(
const Dx.InputType impl_input)
{
return makeArrayFromElement<Dx.InputType, Dx.kElementCount>(impl_input);
}
}
void main()
{
GenericImpl<float> f;
let rs = f.eval<DataTrait0>(1.0);
printf("result is %f\n", rs[0]);
// CHECK: result is 1.0
}
|