- Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathobjc_enum.swift
36 lines (27 loc) · 1.3 KB
/
objc_enum.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
// RUN: %target-typecheck-verify-swift -enable-objc-interop
@objcenumFoo:Int32{
case Zim, Zang, Zung
}
@objcenumGeneric<T>:Int32{ // expected-error{{'@objc' enum cannot be generic}} {{1-7=}}
case Zim, Zang, Zung
}
@objc(EnumRuntimeName)enumRuntimeNamed:Int32{
case Zim, Zang, Zung
}
@objcenumNoRawType{ // expected-error{{'@objc' enum must declare an integer raw type}}
case Zim, Zang, Zung
}
@objcenumNonIntegerRawType:Float{ // expected-error{{'@objc' enum raw type 'Float' is not an integer type}}
case Zim =1.0, Zang =1.5, Zung =2.0
}
enumNonObjCEnum:Int{
case Zim, Zang, Zung
}
classBar{
@objcfunc foo(x:Foo){}
@objcfunc nonObjC(x:NonObjCEnum){} //expected-error{{type of the parameter cannot be represented in Objective-C}} //expected-note{{non-'@objc' enums cannot be represented in Objective-C}}
}
// <rdar://problem/23681566> @objc enums with payloads rejected with no source location info
@objcenumr23681566:Int32{ // expected-error {{'r23681566' declares raw type 'Int32', but does not conform to RawRepresentable and conformance could not be synthesized}} expected-note {{declared raw type 'Int32' here}} expected-note {{add stubs for conformance}}
case Foo(progress:Int) // expected-error {{enum with raw type cannot have cases with arguments}}
}