Files
swift-mirror/test/AutoDiff/Sema/DerivativeRegistrationCrossFile/main.swift
Anton Korobeynikov 6e2c4faa34 [AutoDiff] Lookup for custom derivatives in non-primary source files (#58965)
* Lookup for custom derivatives in non-primary source files after typecheck is finished for the primary source.

This registers all custom derivatives before autodiff transformations and makes them available to them.

Fully resolves #55170
2022-07-18 11:52:02 -07:00

10 lines
338 B
Swift

// RUN: %target-swift-frontend -emit-sil -verify -primary-file %s %S/Inputs/derivatives.swift -module-name main -o /dev/null
import _Differentiation
@differentiable(reverse)
func clamp(_ value: Double, _ lowerBound: Double, _ upperBound: Double) -> Double {
// No error expected
return max(min(value, upperBound), lowerBound)
}