Skip to content

Commit c130848

Browse files
committed
[Test] Add a regression test for property wrapper backing initializers that
involve inout closure parameters and were previously type checked twice.
1 parent bbfcb55 commit c130848

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/Sema/property_wrappers.swift

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// RUN: %target-swift-frontend -typecheck -disable-availability-checking -dump-ast %s | %FileCheck %s
2+
3+
struct Transaction {
4+
var state: Int?
5+
}
6+
7+
@propertyWrapper
8+
struct Wrapper<Value> {
9+
var wrappedValue: Value
10+
11+
init(wrappedValue: Value,
12+
reset: @escaping (Value, inout Transaction) -> Void) {
13+
self.wrappedValue = wrappedValue
14+
}
15+
}
16+
17+
// rdar://problem/59685601
18+
// CHECK-LABEL: R_59685601
19+
struct R_59685601 {
20+
// CHECK: tuple_expr implicit type='(wrappedValue: String, reset: (String, inout Transaction) -> Void)'
21+
// CHECK-NEXT: opaque_value_expr implicit type='String'
22+
// CHECK-NEXT: string_literal_expr type='String'
23+
@Wrapper(reset: { value, transaction in
24+
transaction.state = 10
25+
})
26+
private var value = "hello"
27+
}
28+

0 commit comments

Comments
 (0)