Files
swift-mirror/validation-test/compiler_crashers_2_fixed/issue-53910.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
}