summaryrefslogtreecommitdiffstats
path: root/tests/autodiff/avoid-double-lowering.slang
blob: 354d1d27b2c0048d4ac9f87399752bbb17b023d1 (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
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):
// CHECK-NOT: an internal error threw
// CHECK-NOT: error:

interface IFoo<T, int N>: IDifferentiable
    where T : __BuiltinFloatingPointType
{
    This myFunc(This other);
}

struct Foo<T, int N>
    where T : __BuiltinFloatingPointType
{
    [BackwardDifferentiable]
    This myFunc(This other)
    {
        [MaxIters(N)]
        for (int i = 0; i < N; i++) {}

        return this;
    }
}

extension <T, int N> Foo<T, N> : IFoo<T, N>
    where T : __BuiltinFloatingPointType {}