mirror of
https://github.com/apple/swift.git
synced 2026-06-20 15:42:51 +02:00
60ea598e7f
Prevents situations when actor isolation ends up not being set un-intentionally i.e. when cloning, specializating, or creating thunks. The thunks get `unspecified` isolation at the moment.
36 lines
1.2 KiB
Swift
36 lines
1.2 KiB
Swift
// RUN: %target-swift-frontend -Xllvm -sil-print-types -emit-sil %s | %FileCheck %s
|
|
|
|
// Verify the result type of a subset parameters thunk matches the declaration:
|
|
//
|
|
// CHECK: // autodiff subset parameters thunk for forward-mode derivative from f(x:)
|
|
// CHECK-NEXT: // Isolation: unspecified
|
|
// CHECK-NEXT: sil shared [transparent] [thunk] @$s17param_thunk_tuple{{.*}} : $@convention(thin) (X)
|
|
// CHECK-SAME: -> (Float, Double, @owned @callee_guaranteed (X.TangentVector) -> Float)
|
|
// CHECK: return
|
|
// CHECK-SAME: %{{.*}} : $(Float, Double, @callee_guaranteed (X.TangentVector) -> Float)
|
|
//
|
|
// CHECK: // autodiff subset parameters thunk for reverse-mode derivative from f(x:)
|
|
// CHECK-NEXT: // Isolation: unspecified
|
|
// CHECK-NEXT: sil shared [transparent] [thunk] @$s17param_thunk_tuple{{.*}} : $@convention(thin) (X)
|
|
// CHECK-SAME: -> (Float, Double, @owned @callee_guaranteed (Float) -> X.TangentVector)
|
|
// CHECK: return
|
|
// CHECK-SAME: %{{.*}} : $(Float, Double, @callee_guaranteed (Float) -> X.TangentVector)
|
|
|
|
import _Differentiation
|
|
|
|
struct X: Differentiable {
|
|
var a: Float
|
|
var b: Double
|
|
}
|
|
|
|
@differentiable(reverse)
|
|
func f(x: X) -> (Float, Double) {
|
|
(x.a, x.b)
|
|
}
|
|
|
|
@differentiable(reverse)
|
|
func g1(x: X) -> Float {
|
|
f(x: x).0
|
|
}
|
|
|