11// 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
32
4- #if DIAGS
53func 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-
94#if _runtime(_ObjC)
105 let us2 = USConstant2
116#else
@@ -20,27 +15,8 @@ func testDiags() {
2015#endif
2116 let _: String = usVar2 // expected-error {{cannot convert value of type 'UInt16' to specified type 'String'}}
2217
23- let _: String = SR2511 ( ) . y // expected-error {{cannot convert value of type 'UInt32' to specified type 'String'}}
24-
2518 // The nested anonymous enum value should still have top-level scope, because
2619 // 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'}}
2820 let _: String = SR2511 . SR2511B // expected-error {{type 'SR2511' has no member 'SR2511B'}}
2921}
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
4222
43- // Force the definition of the type above.
44- // CHECK: ret
45- return x. pointee. z
46- } // CHECK-NEXT: {{^}$}}
0 commit comments