diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/autodiff/avoid-double-lowering.slang | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/autodiff/avoid-double-lowering.slang b/tests/autodiff/avoid-double-lowering.slang new file mode 100644 index 000000000..354d1d27b --- /dev/null +++ b/tests/autodiff/avoid-double-lowering.slang @@ -0,0 +1,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 {} + |
