diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/diagnostics/autodiff-data-flow-4.slang | 30 | ||||
| -rw-r--r-- | tests/diagnostics/autodiff-data-flow-4.slang.expected | 8 |
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/diagnostics/autodiff-data-flow-4.slang b/tests/diagnostics/autodiff-data-flow-4.slang new file mode 100644 index 000000000..08fabf954 --- /dev/null +++ b/tests/diagnostics/autodiff-data-flow-4.slang @@ -0,0 +1,30 @@ +//DIAGNOSTIC_TEST:SIMPLE: + +float nonDiff(float x) +{ + return x; +} + +[Differentiable] +float f(float x) +{ + return x * x; +} + +[Differentiable] +float h(float x) +{ + float val = 0; + + // call to non-differentiable method + // (should error if the data-flow propagation works properly.) + // + float y = nonDiff(x); + + // call to a differentiable method, using the + // result of a non-differentiable call. + // + val = f(y); + + return val; +} diff --git a/tests/diagnostics/autodiff-data-flow-4.slang.expected b/tests/diagnostics/autodiff-data-flow-4.slang.expected new file mode 100644 index 000000000..69f5d8707 --- /dev/null +++ b/tests/diagnostics/autodiff-data-flow-4.slang.expected @@ -0,0 +1,8 @@ +result code = -1 +standard error = { +tests/diagnostics/autodiff-data-flow-4.slang(29): error 41020: derivative cannot be propagated through call to non-backward-differentiable function `nonDiff`, use 'no_diff' to clarify intention. + float y = nonDiff(x); + ^ +} +standard output = { +} |
