summaryrefslogtreecommitdiffstats
path: root/tests/autodiff/custom-differential-type-error.slang
blob: 2542eff4ff31820fa9b1cab0d332574ca875d20e (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
//TEST:SIMPLE(filecheck=CHECK):-target spirv

interface IFoo : IDifferentiable
{
    float myFunc();
}

struct Bar: IDifferentiable
{
    float y;
}

struct Foo :  IFoo
{
    typealias Differential = Bar;

    // CHECK: ([[# @LINE+1]]): error 30027: 'x' is not a member of 'typeof(Foo.Differential)'.
    [DerivativeMember(Differential.x)]
    float x;

    [BackwardDifferentiable]
    float myFunc()
    {
        return x * x;
    };
}