Skip to content

Commit 9c97153

Browse files
committed
[Test] Adds a test case
1 parent 1e87dfc commit 9c97153

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// RUN: %target-swift-frontend %s -typecheck -verify
2+
3+
@propertyWrapper
4+
public struct Wrapper<Value> {
5+
public init(someValue unused: Int) {
6+
_ = unused
7+
}
8+
9+
public var wrappedValue: Value?
10+
}
11+
12+
13+
func functionScope() {
14+
let scopedValue = 3 // expected-note {{'scopedValue' declared here}}
15+
// expected-warning@-1 {{initialization of immutable value 'scopedValue' was never used; consider replacing with assignment to '_' or removing it}}
16+
17+
enum StaticScope { // expected-note {{type declared here}}
18+
@Wrapper(someValue: scopedValue) static var foo: String? // expected-error {{enum declaration cannot close over value 'scopedValue' defined in outer scope}}
19+
}
20+
21+
_ = StaticScope.foo
22+
}

0 commit comments

Comments
 (0)