Skip to content

Commit 903786f

Browse files
committed
tests: correct availability checks in Interpreter/runtime_name_local_class_opaque_type.swift
The test checks a fix, which also affects the runtime. Therefore, the test requires a minimum OS version to run without a crash.
1 parent a71e4fb commit 903786f

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed
Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,33 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-build-swift -Xfrontend -disable-availability-checking %s -o %t/a.out
2+
// RUN: %target-build-swift %s -o %t/a.out
33
// RUN: %target-run %t/a.out | %FileCheck %s
44

55
// REQUIRES: executable_test
66
// REQUIRES: objc_interop
77

88
protocol MyProtocol {}
99

10+
@available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *)
1011
func returnsClass1() -> some MyProtocol {
1112
class MyClass1: MyProtocol {}
1213
return MyClass1()
1314
}
1415

15-
var returnsClass2: some MyProtocol {
16-
class MyClass2: MyProtocol {}
17-
return MyClass2()
16+
@available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *)
17+
struct Outer {
18+
static var returnsClass2: some MyProtocol {
19+
class MyClass2: MyProtocol {}
20+
return MyClass2()
21+
}
1822
}
1923

20-
print(returnsClass1())
2124
// CHECK: a.(unknown context at ${{[0-9a-z]+}}).(unknown context at ${{[0-9a-z]+}}).MyClass1
22-
23-
print(returnsClass2)
24-
// CHECK: a.(unknown context at ${{[0-9a-z]+}}).(unknown context at ${{[0-9a-z]+}}).MyClass2
25+
// CHECK: a.Outer.(unknown context at ${{[0-9a-z]+}}).(unknown context at ${{[0-9a-z]+}}).MyClass2
26+
if #available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *) {
27+
print(returnsClass1())
28+
print(Outer.returnsClass2)
29+
} else {
30+
// Make FileCheck happy if this test runs on an older OS.
31+
print("a.(unknown context at $0).(unknown context at $0).MyClass1")
32+
print("a.Outer.(unknown context at $0).(unknown context at $0).MyClass2")
33+
}

0 commit comments

Comments
 (0)