blob: a50a3aca15b83bb9240b26dc4d6621d257f1315b [file] [log] [blame]
// RUN: %target-swift-frontend %s -typecheck -verify
@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
}