Skip to content

Commit b8a6648

Browse files
authored
Merge pull request #59898 from hborla/5.7-revert-any-in-swiftinterface
[5.7][ASTPrinter] Don't print 'any' in Swift interfaces.
2 parents 52499bb + 5f2582b commit b8a6648

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ PrintOptions PrintOptions::printSwiftInterfaceFile(ModuleDecl *ModuleToPrint,
156156
PrintOptions::FunctionRepresentationMode::Full;
157157
result.AlwaysTryPrintParameterLabels = true;
158158
result.PrintSPIs = printSPIs;
159-
result.PrintExplicitAny = true;
160159
result.DesugarExistentialConstraint = true;
161160

162161
// We should print __consuming, __owned, etc for the module interface file.

test/ModuleInterface/existential-any.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,28 @@ public protocol Q {
1414
associatedtype A: P
1515
}
1616

17-
// CHECK: public func takesAndReturnsP(_ x: any main.P) -> any main.P
17+
// CHECK: public func takesAndReturnsP(_ x: main.P) -> main.P
1818
public func takesAndReturnsP(_ x: P) -> P {
1919
return x
2020
}
2121

22-
// CHECK: public func takesAndReturnsOptionalP(_ x: (any main.P)?) -> (any main.P)?
22+
// CHECK: public func takesAndReturnsOptionalP(_ x: main.P?) -> main.P?
2323
public func takesAndReturnsOptionalP(_ x: P?) -> P? {
2424
return x
2525
}
2626

27-
// CHECK: public func takesAndReturnsQ(_ x: any main.Q) -> any main.Q
27+
// CHECK: public func takesAndReturnsQ(_ x: main.Q) -> main.Q
2828
public func takesAndReturnsQ(_ x: any Q) -> any Q {
2929
return x
3030
}
3131

3232
// CHECK: public struct S
3333
public struct S {
34-
// CHECK: public var p: any main.P
34+
// CHECK: public var p: main.P
3535
public var p: P
36-
// CHECK: public var maybeP: (any main.P)?
36+
// CHECK: public var maybeP: main.P?
3737
public var maybeP: P?
38-
// CHECK: public var q: any main.Q
38+
// CHECK: public var q: main.Q
3939
public var q: any Q
4040
}
4141

@@ -44,5 +44,5 @@ public protocol ProtocolTypealias {
4444
typealias A = P
4545
}
4646

47-
// CHECK: public func dependentExistential<T>(value: (T) -> any main.P) where T : main.ProtocolTypealias
47+
// CHECK: public func dependentExistential<T>(value: (T) -> main.P) where T : main.ProtocolTypealias
4848
public func dependentExistential<T: ProtocolTypealias>(value: (T) -> T.A) {}

test/ModuleInterface/features.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public class OldSchool2: MP {
8888
// CHECK: public struct UsesRP {
8989
public struct UsesRP {
9090
// CHECK: #if compiler(>=5.3) && $RethrowsProtocol
91-
// CHECK-NEXT: public var value: (any FeatureTest.RP)? {
91+
// CHECK-NEXT: public var value: FeatureTest.RP? {
9292
// CHECK-NOT: #if compiler(>=5.3) && $RethrowsProtocol
9393
// CHECK: get
9494
public var value: RP? {

test/ModuleInterface/top-level-Type-and-Protocol.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public func usesType(_ x: Type) {}
1919
// CHECK: public func genericProtocol<T>(_ x: T) where T : MyModule.`Protocol`
2020
public func genericProtocol<T: Protocol>(_ x: T) {}
2121

22-
// CHECK: public func existentialProtocol(_ x: any MyModule.`Protocol`)
22+
// CHECK: public func existentialProtocol(_ x: MyModule.`Protocol`)
2323
public func existentialProtocol(_ x: Protocol) {}
2424

2525
// CHECK: public struct Parent {

0 commit comments

Comments
 (0)