Skip to content

Commit d9e3056

Browse files
committed
Fix up and re-enable test.
This was disabled after one of the pass pipeline changes resulted in the test failing only in certain configurations (unoptimized stdlib build). Previously, the same test had been updated for other pipeline changes, but the more recent pipeline changes made the previous updates unnecessary. This change reverts those previous updates, and adds new updates to deal with changes that have happened since the test was disabled (specifically signature optimization firing in some cases where it wasn't before).
1 parent 1c3d998 commit d9e3056

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

test/SILGen/objc_nonnull_lie_hack.swift

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// RUN: %target-swift-frontend -emit-sil -O -sdk %S/Inputs -I %S/Inputs -I %t/APINotes -enable-source-import -primary-file %s | FileCheck -check-prefix=OPT %s
66

77
// REQUIRES: objc_interop
8-
// REQUIRES: rdar24894993
98

109
import Foundation
1110
import gizmo
@@ -17,7 +16,7 @@ import gizmo
1716

1817
// OPT-LABEL: sil hidden @_TF21objc_nonnull_lie_hack10makeObjectFT_GSqCSo8NSObject_
1918
// OPT: [[OPT:%.*]] = unchecked_ref_cast
20-
// OPT: select_enum [[OPT]] : $Optional<NSObject>{{.*}} case #Optional.none!enumelt
19+
// OPT: switch_enum [[OPT]] : $Optional<NSObject>, case #Optional.none!enumelt: [[NIL:bb[0-9]+]]
2120
func makeObject() -> NSObject? {
2221
let foo: NSObject? = NSObject()
2322
if foo == nil {
@@ -26,27 +25,13 @@ func makeObject() -> NSObject? {
2625
return foo
2726
}
2827

29-
// OPT-LABEL: sil hidden @_TF21objc_nonnull_lie_hack18callInstanceMethod
30-
// OPT: [[METHOD:%[0-9]+]] = class_method [volatile] [[OBJ:%[0-9]+]] : $Gizmo, #Gizmo.nonNilGizmo!1.foreign : Gizmo -> () -> Gizmo , $@convention(objc_method) (Gizmo) -> @autoreleased Gizmo
31-
// OPT: [[NONOPTIONAL:%[0-9]+]] = apply [[METHOD]]([[OBJ]]) : $@convention(objc_method) (Gizmo) -> @autoreleased Gizmo
32-
// OPT: [[OPTIONAL:%[0-9]+]] = unchecked_ref_cast [[NONOPTIONAL]]
33-
// OPT: select_enum [[OPTIONAL]] : $Optional<Gizmo>
34-
func callInstanceMethod(gizmo: Gizmo) -> Gizmo? {
35-
let foo: Gizmo? = gizmo.nonNilGizmo()
36-
37-
if foo == nil {
38-
print("nil")
39-
}
40-
return foo
41-
}
42-
4328
// OPT-LABEL: sil hidden @_TF21objc_nonnull_lie_hack15callClassMethod
4429
// OPT: [[METATYPE:%[0-9]+]] = metatype $@thick Gizmo.Type
4530
// OPT: [[METHOD:%[0-9]+]] = class_method [volatile] [[METATYPE]] : $@thick Gizmo.Type, #Gizmo.nonNilGizmo!1.foreign : Gizmo.Type -> () -> Gizmo , $@convention(objc_method) (@objc_metatype Gizmo.Type) -> @autoreleased Gizmo
4631
// OPT: [[OBJC_METATYPE:%[0-9]+]] = metatype $@objc_metatype Gizmo.Type
4732
// OPT: [[NONOPTIONAL:%[0-9]+]] = apply [[METHOD]]([[OBJC_METATYPE]]) : $@convention(objc_method) (@objc_metatype Gizmo.Type) -> @autoreleased Gizmo
4833
// OPT: [[OPTIONAL:%[0-9]+]] = unchecked_ref_cast [[NONOPTIONAL]] : $Gizmo to $Optional<Gizmo>
49-
// OPT: select_enum [[OPTIONAL]] : $Optional<Gizmo>
34+
// OPT: switch_enum [[OPTIONAL]] : $Optional<Gizmo>
5035
func callClassMethod() -> Gizmo? {
5136
let foo: Gizmo? = Gizmo.nonNilGizmo()
5237
if foo == nil {
@@ -55,11 +40,25 @@ func callClassMethod() -> Gizmo? {
5540
return foo
5641
}
5742

58-
// OPT-LABEL: sil hidden @_TF21objc_nonnull_lie_hack12loadPropertyFCSo5GizmoGSqS0__ : $@convention(thin) (@owned Gizmo) -> @owned Optional<Gizmo>
43+
// OPT-LABEL: sil hidden @_TTSf4g___TF21objc_nonnull_lie_hack18callInstanceMetho
44+
// OPT: [[METHOD:%[0-9]+]] = class_method [volatile] [[OBJ:%[0-9]+]] : $Gizmo, #Gizmo.nonNilGizmo!1.foreign : Gizmo -> () -> Gizmo , $@convention(objc_method) (Gizmo) -> @autoreleased Gizmo
45+
// OPT: [[NONOPTIONAL:%[0-9]+]] = apply [[METHOD]]([[OBJ]]) : $@convention(objc_method) (Gizmo) -> @autoreleased Gizmo
46+
// OPT: [[OPTIONAL:%[0-9]+]] = unchecked_ref_cast [[NONOPTIONAL]]
47+
// OPT: switch_enum [[OPTIONAL]] : $Optional<Gizmo>
48+
func callInstanceMethod(gizmo: Gizmo) -> Gizmo? {
49+
let foo: Gizmo? = gizmo.nonNilGizmo()
50+
51+
if foo == nil {
52+
print("nil")
53+
}
54+
return foo
55+
}
56+
57+
// OPT-LABEL: sil hidden @_TTSf4g___TF21objc_nonnull_lie_hack12loadPropertyFT5gizmoCSo5Gizmo_GSqS0__
5958
// OPT: [[GETTER:%[0-9]+]] = class_method [volatile] [[OBJ:%[0-9]+]] : $Gizmo, #Gizmo.nonNilGizmoProperty!getter.1.foreign : Gizmo -> () -> Gizmo , $@convention(objc_method) (Gizmo) -> @autoreleased Gizmo
6059
// OPT: [[NONOPTIONAL:%[0-9]+]] = apply [[GETTER]]([[OBJ]]) : $@convention(objc_method) (Gizmo) -> @autoreleased Gizmo
6160
// OPT: [[OPTIONAL:%[0-9]+]] = unchecked_ref_cast [[NONOPTIONAL]] : $Gizmo to $Optional<Gizmo>
62-
// OPT: select_enum [[OPTIONAL]] : $Optional<Gizmo>,
61+
// OPT: switch_enum [[OPTIONAL]] : $Optional<Gizmo>,
6362
func loadProperty(gizmo: Gizmo) -> Gizmo? {
6463
let foo: Gizmo? = gizmo.nonNilGizmoProperty
6564
if foo == nil {
@@ -68,11 +67,11 @@ func loadProperty(gizmo: Gizmo) -> Gizmo? {
6867
return foo
6968
}
7069

71-
// OPT-LABEL: sil hidden @_TF21objc_nonnull_lie_hack19loadUnownedPropertyFCSo5GizmoGSqS0__
70+
// OPT-LABEL: sil hidden @_TTSf4g___TF21objc_nonnull_lie_hack19loadUnownedPropertyFT5gizmoCSo5Gizmo_GSqS0__
7271
// OPT: [[GETTER:%[0-9]+]] = class_method [volatile] [[OBJ:%[0-9]+]] : $Gizmo, #Gizmo.unownedNonNilGizmoProperty!getter.1.foreign : Gizmo -> () -> Gizmo , $@convention(objc_method) (Gizmo) -> @autoreleased Gizmo
7372
// OPT: [[NONOPTIONAL:%[0-9]+]] = apply [[GETTER]]([[OBJ]]) : $@convention(objc_method) (Gizmo) -> @autoreleased Gizmo
7473
// OPT: [[OPTIONAL:%[0-9]+]] = unchecked_ref_cast [[NONOPTIONAL]] : $Gizmo to $Optional<Gizmo>
75-
// OPT: select_enum [[OPTIONAL]] : $Optional<Gizmo>
74+
// OPT: switch_enum [[OPTIONAL]] : $Optional<Gizmo>
7675
func loadUnownedProperty(gizmo: Gizmo) -> Gizmo? {
7776
let foo: Gizmo? = gizmo.unownedNonNilGizmoProperty
7877
if foo == nil {

0 commit comments

Comments
 (0)