1
1
// RUN: %target-swift-frontend -typecheck %s -enable-objc-interop -import-objc-header %S/Inputs/enum-anon.h -DDIAGS -verify
2
- // RUN: %target-swift-frontend -emit-ir %s -enable-objc-interop -import-objc-header %S/Inputs/enum-anon.h | %FileCheck -check-prefix=CHECK -check-prefix=CHECK-%target-runtime %s
3
2
4
- #if DIAGS
5
3
func testDiags( ) {
6
- let _: String = Constant2 // expected-error {{cannot convert value of type 'Int' to specified type 'String'}}
7
- let _: String = VarConstant2 // expected-error {{cannot convert value of type 'UInt32' to specified type 'String'}}
8
-
9
4
#if _runtime(_ObjC)
10
5
let us2 = USConstant2
11
6
#else
@@ -20,27 +15,8 @@ func testDiags() {
20
15
#endif
21
16
let _: String = usVar2 // expected-error {{cannot convert value of type 'UInt16' to specified type 'String'}}
22
17
23
- let _: String = SR2511 ( ) . y // expected-error {{cannot convert value of type 'UInt32' to specified type 'String'}}
24
-
25
18
// The nested anonymous enum value should still have top-level scope, because
26
19
// that's how C works. It should also have the same type as the field (above).
27
- let _: String = SR2511B // expected-error {{cannot convert value of type 'UInt32' to specified type 'String'}}
28
20
let _: String = SR2511 . SR2511B // expected-error {{type 'SR2511' has no member 'SR2511B'}}
29
21
}
30
- #endif
31
-
32
- // CHECK-LABEL: %TSo6SR2511V = type <{ %Ts5Int32V, %Ts6UInt32V, %Ts5Int32V }>
33
- // CHECK-LABEL: define{{.*}} i32 @"$s4main6testIR1xs5Int32VSPySo6SR2511VG_tF"(
34
- public func testIR( x: UnsafePointer < SR2511 > ) -> CInt {
35
- // CHECK: store i32 1, i32* getelementptr inbounds (%Ts6UInt32V, %Ts6UInt32V* bitcast (i32* @global to %Ts6UInt32V*), i32 0, i32 0), align 4
36
- global = VarConstant2
37
-
38
- #if _runtime(_ObjC)
39
- // CHECK-objc: store i16 1, i16* getelementptr inbounds (%Ts6UInt16V, %Ts6UInt16V* bitcast (i16* @usGlobal to %Ts6UInt16V*), i32 0, i32 0), align 2
40
- usGlobal = USVarConstant2
41
- #endif
42
22
43
- // Force the definition of the type above.
44
- // CHECK: ret
45
- return x. pointee. z
46
- } // CHECK-NEXT: {{^}$}}
0 commit comments