Skip to content

Commit 3e0a5fc

Browse files
committed
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'.
1 parent 6dc55a3 commit 3e0a5fc

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

lib/Frontend/ModuleInterfaceSupport.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -650,17 +650,8 @@ class InheritedProtocolCollector {
650650
printer << " {}";
651651
};
652652

653-
bool printedNewline = false;
654-
if (printOptions.PrintCompatibilityFeatureChecks) {
655-
printedNewline =
656-
printWithCompatibilityFeatureChecks(printer, curPrintOptions,
657-
proto, printBody);
658-
} else {
659-
printBody();
660-
printedNewline = false;
661-
}
662-
if (!printedNewline)
663-
printer << "\n";
653+
printBody();
654+
printer << "\n";
664655
}
665656
}
666657

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend -typecheck -module-name ParameterizedProtocols -emit-module-interface-path %t/ParameterizedProtocols.swiftinterface %s
3+
// RUN: %FileCheck %s < %t/ParameterizedProtocols.swiftinterface
4+
5+
public struct S1 : P1 {
6+
public typealias T = Int
7+
}
8+
9+
public struct S2 : Q1 {}
10+
11+
protocol P1 : P2 {}
12+
13+
public protocol P2<T> {
14+
associatedtype T
15+
}
16+
17+
protocol Q1 : Q2 {}
18+
19+
public protocol Q2 {}
20+
21+
// CHECK: extension ParameterizedProtocols.S1 : ParameterizedProtocols.P2 {}
22+
// CHECK-NEXT: extension ParameterizedProtocols.S2 : ParameterizedProtocols.Q2 {}

0 commit comments

Comments
 (0)