Skip to content

Commit 7b26e29

Browse files
committed
1 parent 075db56 commit 7b26e29

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// RUN: %target-swift-frontend -emit-sil -O %s
2+
3+
// REQUIRES: objc_interop
4+
import Foundation
5+
6+
@objc protocol OptionalVar {
7+
@objc optional var name: String { get }
8+
}
9+
10+
extension NSObject: OptionalVar { }
11+
12+
do {
13+
let objects = [NSObject()] as Array<OptionalVar>
14+
15+
let names = objects.compactMap(\.name)
16+
print("Names: \(names)")
17+
}

0 commit comments

Comments
 (0)