ASTPrinter: Fix logic to determine if a requirement needs 'repeat' prefix

This commit is contained in:
Slava Pestov
2023-07-12 12:31:51 -04:00
parent ddeab73e0e
commit 29415df860
2 changed files with 27 additions and 7 deletions

View File

@@ -2,6 +2,8 @@
// RUN: %target-swift-emit-module-interface(%t/PackExpansionType.swiftinterface) %s -module-name PackExpansionType -disable-availability-checking
// RUN: %FileCheck %s < %t/PackExpansionType.swiftinterface
/// Requirements
// CHECK: #if compiler(>=5.3) && $ParameterPacks
// CHECK-NEXT: public func variadicFunction<each T, each U>(t: repeat each T, u: repeat each U) -> (repeat (each T, each U)) where (repeat (each T, each U)) : Any
public func variadicFunction<each T, each U>(t: repeat each T, u: repeat each U) -> (repeat (each T, each U)) {}
@@ -24,6 +26,13 @@ public struct VariadicType<each T> {
// CHECK: }
// CHECK-NEXT: #endif
// The second requirement should not be prefixed with 'repeat'
// CHECK: public struct SameTypeReq<T, each U> where T : Swift.Sequence, T.Element == PackExpansionType.VariadicType<repeat each U> {
public struct SameTypeReq<T: Sequence, each U> where T.Element == VariadicType<repeat each U> {}
// CHECK: }
/// Pack expansion types
// CHECK: public func returnsVariadicType() -> PackExpansionType.VariadicType<>
public func returnsVariadicType() -> VariadicType< > {}