Skip to content

Commit 2b1bfcb

Browse files
committed
Reflection: Fix tests for iPhoneOS
1 parent 60dff01 commit 2b1bfcb

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

test/Reflection/Inputs/ObjectiveCTypes.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import CoreGraphics
23

34
public class OC : NSObject {
45
public let nsObject: NSObject
@@ -26,7 +27,7 @@ public class GenericOC<T> : NSObject {
2627
public class HasObjCClasses {
2728
let url = NSURL()
2829
let integer = NSInteger()
29-
let rect = NSRect(x: 0, y: 1, width: 2, height: 3)
30+
let rect = CGRect(x: 0, y: 1, width: 2, height: 3)
3031
}
3132

3233
public func closureHasObjCClasses(b: NSBundle, c: NSCoding) -> () -> () {

test/Reflection/typeref_decoding_objc.swift

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: rm -rf %t && mkdir -p %t
22
// RUN: %target-build-swift %S/Inputs/ObjectiveCTypes.swift -parse-as-library -emit-module -emit-library -module-name TypesToReflect -o %t/libTypesToReflect.%target-dylib-extension
3-
// RUN: %target-swift-reflection-dump -binary-filename %t/libTypesToReflect.%target-dylib-extension | FileCheck %s --check-prefix=CHECK
3+
// RUN: %target-swift-reflection-dump -binary-filename %t/libTypesToReflect.%target-dylib-extension | FileCheck %s --check-prefix=CHECK-%target-ptrsize --check-prefix=CHECK
44
// REQUIRES: objc_interop
55

66
// CHECK: FIELDS:
@@ -54,11 +54,16 @@
5454
// CHECK: BUILTIN TYPES:
5555
// CHECK: ==============
5656

57-
// CHECK: - __C.CGRect:
58-
// CHECK: Size: 32
59-
// CHECK: Alignment: 8
60-
// CHECK: Stride: 32
61-
// CHECK: NumExtraInhabitants: 0
57+
// CHECK-32: - __C.CGRect:
58+
// CHECK-32: Size: 16
59+
// CHECK-32: Alignment: 4
60+
// CHECK-32: Stride: 16
61+
// CHECK-32: NumExtraInhabitants: 0
62+
63+
// CHECK-64: Size: 32
64+
// CHECK-64: Alignment: 8
65+
// CHECK-64: Stride: 32
66+
// CHECK-64: NumExtraInhabitants: 0
6267

6368
// CHECK: CAPTURE DESCRIPTORS:
6469
// CHECK: ====================

validation-test/Reflection/functions_objc.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,25 @@
55

66
import SwiftReflectionTest
77
import Foundation
8+
import CoreGraphics
89

9-
func capturesImportedTypes(x: Int, n: NSURL, r: NSRect, c: NSCoding) {
10+
func capturesImportedTypes(x: Int, n: NSURL, r: CGRect, c: NSCoding) {
1011
reflect(function: {print(x); print(n); print(r); print(c)})
1112

1213
// CHECK-32: Type reference:
1314
// CHECK-32-NEXT: (builtin Builtin.NativeObject)
1415

1516
// CHECK-32: Type info:
16-
// CHECK-32-NEXT: (closure_context size=60 alignment=8 stride=60 num_extra_inhabitants=0
17+
// CHECK-32-NEXT: (closure_context size=40 alignment=4 stride=40 num_extra_inhabitants=0
1718
// CHECK-32-NEXT: (field offset=12
1819
// CHECK-32-NEXT: (struct size=4 alignment=4 stride=4 num_extra_inhabitants=0
1920
// CHECK-32-NEXT: (field name=_value offset=0
2021
// CHECK-32-NEXT: (builtin size=4 alignment=4 stride=4 num_extra_inhabitants=0))))
2122
// CHECK-32-NEXT: (field offset=16
2223
// CHECK-32-NEXT: (reference kind=strong refcounting=unknown))
23-
// CHECK-32-NEXT: (field offset=24
24-
// CHECK-32-NEXT: (builtin size=32 alignment=8 stride=32 num_extra_inhabitants=0))
25-
// CHECK-32-NEXT: (field offset=56
24+
// CHECK-32-NEXT: (field offset=20
25+
// CHECK-32-NEXT: (builtin size=16 alignment=4 stride=16 num_extra_inhabitants=0))
26+
// CHECK-32-NEXT: (field offset=36
2627
// CHECK-32-NEXT: (reference kind=strong refcounting=unknown)))
2728

2829
// CHECK-64: Type reference:
@@ -42,6 +43,6 @@ func capturesImportedTypes(x: Int, n: NSURL, r: NSRect, c: NSCoding) {
4243
// CHECK-64-NEXT: (reference kind=strong refcounting=unknown)))
4344
}
4445

45-
capturesImportedTypes(x: 10, n: NSURL(), r: NSRect(x: 1, y: 2, width: 3, height: 4), c: "" as NSString)
46+
capturesImportedTypes(x: 10, n: NSURL(), r: CGRect(x: 1, y: 2, width: 3, height: 4), c: "" as NSString)
4647

4748
doneReflecting()

0 commit comments

Comments
 (0)