mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
29 lines
581 B
Swift
29 lines
581 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-build-swift %s -o %t/a.out
|
|
// RUN: %target-codesign %t/a.out
|
|
// RUN: %target-run %t/a.out | %FileCheck %s
|
|
|
|
// REQUIRES: executable_test
|
|
|
|
@propertyWrapper
|
|
public class Autoclosure<Value> {
|
|
public var wrappedValue: Value
|
|
|
|
public init(wrappedValue: @autoclosure () -> Value) {
|
|
print("Property Wrapper init")
|
|
self.wrappedValue = wrappedValue()
|
|
}
|
|
}
|
|
|
|
struct S {
|
|
init() { print("S.init") }
|
|
}
|
|
|
|
struct ValueHolder {
|
|
@Autoclosure var value: S
|
|
}
|
|
|
|
// CHECK: Property Wrapper init
|
|
// CHECK-NEXT: S.init
|
|
_ = ValueHolder(value: S())
|