Skip to content

Commit 98ff144

Browse files
committed
Tests: Test -application-extension in enum_raw_representable_available.swift.
1 parent 277fbbe commit 98ff144

File tree

1 file changed

+46
-6
lines changed

1 file changed

+46
-6
lines changed

test/SILGen/enum_raw_representable_available.swift

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
// RUN: %target-typecheck-verify-swift -target %target-cpu-apple-macosx10.52
22

3-
// RUN: %target-swift-emit-silgen -target %target-cpu-apple-macosx10.52 -emit-sorted-sil -o %t.fragile.sil %s
4-
// RUN: %FileCheck %s < %t.fragile.sil
5-
// RUN: %FileCheck -check-prefix NEGATIVE %s < %t.fragile.sil
3+
// RUN: %target-swift-emit-silgen -target %target-cpu-apple-macosx10.52 -emit-sorted-sil %s -o %t.fragile.sil
4+
// RUN: %FileCheck -check-prefixes=CHECK,CHECK-NO-EXTENSION %s < %t.fragile.sil
5+
// RUN: %FileCheck -check-prefixes=NEGATIVE,NEGATIVE-NO-EXTENSION %s < %t.fragile.sil
66

7-
// RUN: %target-swift-emit-silgen -target %target-cpu-apple-macosx10.52 -emit-sorted-sil -enable-library-evolution -o %t.resilient.sil %s
8-
// RUN: %FileCheck %s < %t.resilient.sil
9-
// RUN: %FileCheck -check-prefix NEGATIVE %s < %t.resilient.sil
7+
// RUN: %target-swift-emit-silgen -target %target-cpu-apple-macosx10.52 -emit-sorted-sil %s -o %t.extensions-fragile.sil -application-extension
8+
// RUN: %FileCheck -check-prefixes=CHECK,CHECK-EXTENSION %s < %t.extensions-fragile.sil
9+
// RUN: %FileCheck -check-prefixes=NEGATIVE,NEGATIVE-EXTENSION %s < %t.extensions-fragile.sil
10+
11+
// RUN: %target-swift-emit-silgen -target %target-cpu-apple-macosx10.52 -emit-sorted-sil %s -enable-library-evolution -o %t.resilient.sil
12+
// RUN: %FileCheck -check-prefixes=CHECK,CHECK-NO-EXTENSION %s < %t.resilient.sil
13+
// RUN: %FileCheck -check-prefixes=NEGATIVE,NEGATIVE-NO-EXTENSION %s < %t.resilient.sil
14+
15+
// RUN: %target-swift-emit-silgen -target %target-cpu-apple-macosx10.52 -emit-sorted-sil %s -enable-library-evolution -o %t.extensions-resilient.sil -application-extension
16+
// RUN: %FileCheck -check-prefixes=CHECK,CHECK-EXTENSION %s < %t.extensions-resilient.sil
17+
// RUN: %FileCheck -check-prefixes=NEGATIVE,NEGATIVE-EXTENSION %s < %t.extensions-resilient.sil
1018

1119
// This test just requires a platform with meaningful #available() checks, but
1220
// for simplicity, it's written for macOS only.
@@ -25,9 +33,15 @@ public enum E: Int {
2533
@available(macOS 10.55, *)
2634
case potentiallyUnavailable = -3000
2735

36+
@available(macOSApplicationExtension 10.56, *)
37+
case potentiallyUnavailableForExtensions = -3001
38+
2839
@available(macOS, unavailable)
2940
case neverAvailable = -4000
3041

42+
@available(macOSApplicationExtension, unavailable)
43+
case neverAvailableForExtensions = -4001
44+
3145
@available(macOS, obsoleted: 10.99)
3246
case notObsoleteYet = -5000
3347

@@ -46,13 +60,36 @@ public enum E: Int {
4660
// CHECK: integer_literal $Builtin.IntLiteral, -3000
4761
// CHECK: cond_br {{[^,]+}}, [[potentiallyUnavailable:bb[0-9]+]]
4862

63+
// CHECK: integer_literal $Builtin.IntLiteral, -3001
64+
// CHECK: cond_br {{[^,]+}}, [[potentiallyUnavailableForExtensions:bb[0-9]+]]
65+
66+
// CHECK-NO-EXTENSION: integer_literal $Builtin.IntLiteral, -4001
67+
// CHECK-NO-EXTENSION: cond_br {{[^,]+}}, [[neverAvailableForExtensions:bb[0-9]+]]
68+
4969
// CHECK: integer_literal $Builtin.IntLiteral, -5000
5070
// CHECK: cond_br {{[^,]+}}, [[notObsoleteYet:bb[0-9]+]]
5171

5272
// CHECK: [[notObsoleteYet]]:
5373
// CHECK-NOT: function_ref @$ss26_stdlib_isOSVersionAtLeastyBi1_Bw_BwBwtF
5474
// CHECK: {{enum \$E|inject_enum_addr %[0-9]+ : \$\*E}}, #E.notObsoleteYet!enumelt
5575

76+
// CHECK-NO-EXTENSION: [[neverAvailableForExtensions]]:
77+
// CHECK-NO-EXTENSION-NOT: function_ref @$ss26_stdlib_isOSVersionAtLeastyBi1_Bw_BwBwtF
78+
// CHECK-NO-EXTENSION: {{enum \$E|inject_enum_addr %[0-9]+ : \$\*E}}, #E.neverAvailableForExtensions!enumelt
79+
80+
// CHECK: [[potentiallyUnavailableForExtensions]]:
81+
// CHECK-NO-EXTENSION-NOT: function_ref @$ss26_stdlib_isOSVersionAtLeastyBi1_Bw_BwBwtF
82+
// CHECK-NO-EXTENSION: {{enum \$E|inject_enum_addr %[0-9]+ : \$\*E}}, #E.potentiallyUnavailableForExtensions!enumelt
83+
// CHECK-EXTENSION-NEXT: extend_lifetime
84+
// CHECK-EXTENSION-NEXT: integer_literal $Builtin.Word, 10
85+
// CHECK-EXTENSION-NEXT: integer_literal $Builtin.Word, 56
86+
// CHECK-EXTENSION-NEXT: integer_literal $Builtin.Word, 0
87+
// CHECK-EXTENSION: function_ref @$ss26_stdlib_isOSVersionAtLeastyBi1_Bw_BwBwtF
88+
// CHECK-EXTENSION: cond_br {{[^,]+}}, [[potentiallyUnavailableForExtensions_newEnough:bb[0-9]+]],
89+
90+
// CHECK-EXTENSION: [[potentiallyUnavailableForExtensions_newEnough]]:
91+
// CHECK-EXTENSION: {{enum \$E|inject_enum_addr %[0-9]+ : \$\*E}}, #E.potentiallyUnavailableForExtensions!enumelt
92+
5693
// CHECK: [[potentiallyUnavailable]]:
5794
// CHECK-NEXT: extend_lifetime
5895
// CHECK-NEXT: integer_literal $Builtin.Word, 10
@@ -84,6 +121,9 @@ public enum E: Int {
84121
// Should not try to match neverAvailable's raw value
85122
// NEGATIVE-NOT: integer_literal $Builtin.IntLiteral, -4000
86123

124+
// When building with -application-extension, should not try to match neverAvailableForExtensions's raw value
125+
// NEGATIVE-EXTENSION-NOT: integer_literal $Builtin.IntLiteral, -4001
126+
87127
// Should not try to match nowObsolete's raw value
88128
// NEGATIVE-NOT: integer_literal $Builtin.IntLiteral, -6000
89129

0 commit comments

Comments
 (0)