forked from swiftlang/swift
- Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenum_bridged.swift
38 lines (32 loc) · 757 Bytes
/
enum_bridged.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// RUN: %empty-directory(%t)
// RUN: %target-build-swift %s -o %t/a.out
// RUN: %target-codesign %t/a.out
// RUN: %target-run %t/a.out | %FileCheck %s
// REQUIRES: executable_test
// REQUIRES: objc_interop
import Foundation
classK{}
enumMixedBridged{
case Native(K)
case Bridged([K])
case Empty
}
structContainer{
varstorage:MixedBridged=.Empty
mutatingfunc adoptStyle(_ s:[K]){
storage =.Bridged(s)
}
}
func copyStorage(_ s:[K], _ x :Container)->Container{
varc= x
c.adoptStyle(s)
return c
}
func testCase(){
letnsArray=NSArray(objects:K(),K())as![K]
letl=Container()
letc=copyStorage(nsArray, l)
print(c)
}
// CHECK: Container(storage: a.MixedBridged.Bridged([a.K, a.K]))
testCase()