ASTPrinter: Remove printWithCompatibilityFeatureChecks() from printSynthesizedExtensionIfNeeded()

This path was not exercised in the test suite, and when the
PrimaryAssociatedTypes feature finally (incorrectly) triggered it,
it would print '#endifextension'.
This commit is contained in:
Slava Pestov
2022-04-06 23:44:54 -04:00
parent edbbf48898
commit b16498c3df
2 changed files with 24 additions and 11 deletions

View File

@@ -650,16 +650,7 @@ public:
printer << " {}";
};
bool printedNewline = false;
if (printOptions.PrintCompatibilityFeatureChecks) {
printedNewline =
printWithCompatibilityFeatureChecks(printer, curPrintOptions,
proto, printBody);
} else {
printBody();
printedNewline = false;
}
if (!printedNewline)
printer << "\n";
}
}

View File

@@ -0,0 +1,22 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -typecheck -module-name ParameterizedProtocols -emit-module-interface-path %t/ParameterizedProtocols.swiftinterface %s
// RUN: %FileCheck %s < %t/ParameterizedProtocols.swiftinterface
public struct S1 : P1 {
public typealias T = Int
}
public struct S2 : Q1 {}
protocol P1 : P2 {}
public protocol P2<T> {
associatedtype T
}
protocol Q1 : Q2 {}
public protocol Q2 {}
// CHECK: extension ParameterizedProtocols.S1 : ParameterizedProtocols.P2 {}
// CHECK-NEXT: extension ParameterizedProtocols.S2 : ParameterizedProtocols.Q2 {}