Skip to content

Commit 454689a

Browse files
committed
ModuleInterface: Adopt swiftinterface verification lit substitutions in back-deploy-attr.swift. Simplify the test now that another test exercises deserialization of the attribute from a module.
1 parent d3dbe75 commit 454689a

File tree

1 file changed

+17
-37
lines changed

1 file changed

+17
-37
lines changed
Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,46 @@
11
// RUN: %empty-directory(%t)
2-
3-
// Ensure @_backDeploy attributes and function bodies are printed in
4-
// swiftinterface files.
5-
// RUN: %target-swiftc_driver -emit-module -o %t/Test.swiftmodule -emit-module-interface-path %t/Test.swiftinterface %s -enable-library-evolution -verify-emitted-module-interface -module-name Test \
6-
// RUN: -Xfrontend -define-availability -Xfrontend "_macOS12_1:macOS 12.1" \
7-
// RUN: -Xfrontend -define-availability -Xfrontend "_myProject 1.0:macOS 12.1, iOS 15.1"
8-
// RUN: %FileCheck %s --check-prefix FROMSOURCE --check-prefix CHECK < %t/Test.swiftinterface
9-
10-
// FIXME(backDeploy): Remove this step in favor of a test that exercises using
11-
// a back deployed API from a test library so that we can avoid -merge-modules
12-
13-
// Ensure @_backDeploy attributes and function bodies are present after
14-
// deserializing .swiftmodule files.
15-
// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules %t/Test.swiftmodule -disable-objc-attr-requires-foundation-module -emit-module-interface-path %t/TestFromModule.swiftinterface -module-name Test \
2+
// RUN: %target-swift-emit-module-interface(%t/Test.swiftinterface) %s \
163
// RUN: -define-availability "_macOS12_1:macOS 12.1" \
174
// RUN: -define-availability "_myProject 1.0:macOS 12.1, iOS 15.1"
18-
// RUN: %FileCheck %s --check-prefix FROMMODULE --check-prefix CHECK < %t/TestFromModule.swiftinterface
5+
// RUN: %target-swift-typecheck-module-from-interface(%t/Test.swiftinterface)
6+
// RUN: %FileCheck %s < %t/Test.swiftinterface
197

208
public struct TopLevelStruct {
219
// CHECK: @_backDeploy(before: macOS 12.0)
22-
// FROMSOURCE: public func backDeployedFunc_SinglePlatform() -> Swift.Int { return 42 }
23-
// FROMMODULE: public func backDeployedFunc_SinglePlatform() -> Swift.Int
10+
// CHECK: public func backDeployedFunc_SinglePlatform() -> Swift.Int { return 42 }
2411
@available(macOS 11.0, *)
2512
@_backDeploy(before: macOS 12.0)
2613
public func backDeployedFunc_SinglePlatform() -> Int { return 42 }
2714

2815
// CHECK: @_backDeploy(before: macOS 12.0)
2916
// CHECK: @_backDeploy(before: iOS 15.0)
30-
// FROMSOURCE: public func backDeployedFunc_MultiPlatform() -> Swift.Int { return 43 }
31-
// FROMMODULE: public func backDeployedFunc_MultiPlatform() -> Swift.Int
17+
// CHECK: public func backDeployedFunc_MultiPlatform() -> Swift.Int { return 43 }
3218
@available(macOS 11.0, iOS 14.0, *)
3319
@_backDeploy(before: macOS 12.0, iOS 15.0)
3420
public func backDeployedFunc_MultiPlatform() -> Int { return 43 }
3521

3622
// CHECK: @_backDeploy(before: macOS 12.0)
37-
// FROMSOURCE: public var backDeployedComputedProperty: Swift.Int {
38-
// FROMSOURCE: get { 44 }
39-
// FROMSOURCE: }
40-
// FROMMODULE: public var backDeployedComputedProperty: Swift.Int
23+
// CHECK: public var backDeployedComputedProperty: Swift.Int {
24+
// CHECK: get { 44 }
25+
// CHECK: }
4126
@available(macOS 11.0, *)
4227
@_backDeploy(before: macOS 12.0)
4328
public var backDeployedComputedProperty: Int { 44 }
4429

4530
// CHECK: @_backDeploy(before: macOS 12.0)
46-
// FROMSOURCE: public var backDeployedPropertyWithAccessors: Swift.Int {
47-
// FROMSOURCE: get { 45 }
48-
// FROMSOURCE: }
49-
// FROMMODULE: public var backDeployedPropertyWithAccessors: Swift.Int
31+
// CHECK: public var backDeployedPropertyWithAccessors: Swift.Int {
32+
// CHECK: get { 45 }
33+
// CHECK: }
5034
@available(macOS 11.0, *)
5135
@_backDeploy(before: macOS 12.0)
5236
public var backDeployedPropertyWithAccessors: Int {
5337
get { 45 }
5438
}
5539

5640
// CHECK: @_backDeploy(before: macOS 12.0)
57-
// FROMSOURCE: public subscript(index: Swift.Int) -> Swift.Int {
58-
// FROMSOURCE: get { 46 }
59-
// FROMSOURCE: }
60-
// FROMMODULE: public subscript(index: Swift.Int) -> Swift.Int
41+
// CHECK: public subscript(index: Swift.Int) -> Swift.Int {
42+
// CHECK: get { 46 }
43+
// CHECK: }
6144
@available(macOS 11.0, *)
6245
@_backDeploy(before: macOS 12.0)
6346
public subscript(index: Int) -> Int {
@@ -66,25 +49,22 @@ public struct TopLevelStruct {
6649
}
6750

6851
// CHECK: @_backDeploy(before: macOS 12.0)
69-
// FROMSOURCE: public func backDeployTopLevelFunc1() -> Swift.Int { return 47 }
70-
// FROMMODULE: public func backDeployTopLevelFunc1() -> Swift.Int
52+
// CHECK: public func backDeployTopLevelFunc1() -> Swift.Int { return 47 }
7153
@available(macOS 11.0, *)
7254
@_backDeploy(before: macOS 12.0)
7355
public func backDeployTopLevelFunc1() -> Int { return 47 }
7456

7557
// MARK: - Availability macros
7658

7759
// CHECK: @_backDeploy(before: macOS 12.1)
78-
// FROMSOURCE: public func backDeployTopLevelFunc2() -> Swift.Int { return 48 }
79-
// FROMMODULE: public func backDeployTopLevelFunc2() -> Swift.Int
60+
// CHECK: public func backDeployTopLevelFunc2() -> Swift.Int { return 48 }
8061
@available(macOS 11.0, *)
8162
@_backDeploy(before: _macOS12_1)
8263
public func backDeployTopLevelFunc2() -> Int { return 48 }
8364

8465
// CHECK: @_backDeploy(before: macOS 12.1)
8566
// CHECK: @_backDeploy(before: iOS 15.1)
86-
// FROMSOURCE: public func backDeployTopLevelFunc3() -> Swift.Int { return 49 }
87-
// FROMMODULE: public func backDeployTopLevelFunc3() -> Swift.Int
67+
// CHECK: public func backDeployTopLevelFunc3() -> Swift.Int { return 49 }
8868
@available(macOS 11.0, iOS 14.0, *)
8969
@_backDeploy(before: _myProject 1.0)
9070
public func backDeployTopLevelFunc3() -> Int { return 49 }

0 commit comments

Comments
 (0)