mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
25 lines
749 B
Swift
25 lines
749 B
Swift
// RUN: %target-swift-frontend %s -typecheck -verify
|
|
|
|
// https://github.com/apple/swift/issues/53910
|
|
|
|
@propertyWrapper
|
|
public struct Wrapper<Value> {
|
|
public init(someValue unused: Int) {
|
|
_ = unused
|
|
}
|
|
|
|
public var wrappedValue: Value?
|
|
}
|
|
|
|
|
|
func functionScope() {
|
|
let scopedValue = 3 // expected-note {{'scopedValue' declared here}}
|
|
// expected-warning@-1 {{initialization of immutable value 'scopedValue' was never used; consider replacing with assignment to '_' or removing it}}
|
|
|
|
enum StaticScope { // expected-note {{type declared here}}
|
|
@Wrapper(someValue: scopedValue) static var foo: String? // expected-error {{enum declaration cannot close over value 'scopedValue' defined in outer scope}}
|
|
}
|
|
|
|
_ = StaticScope.foo
|
|
}
|