File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed
test/SourceKit/DocSupport
tools/SourceKit/lib/SwiftLang Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -622,10 +622,11 @@ void swift::ide::printSubmoduleInterface(
622
622
// For sub-decls, all extensions should be printed.
623
623
SynthesizedExtensionAnalyzer::MergeGroupKind::All,
624
624
[&](ArrayRef<ExtensionInfo> Decls) {
625
+ // Whether we've started the extension merge group in printing.
626
+ bool Opened = false ;
625
627
for (auto ET : Decls) {
626
- AdjustedOptions.BracketOptions = {
627
- ET.Ext , Decls.front ().Ext == ET.Ext ,
628
- Decls.back ().Ext == ET.Ext , true };
628
+ AdjustedOptions.BracketOptions = { ET.Ext , !Opened,
629
+ Decls.back ().Ext == ET.Ext , true };
629
630
if (AdjustedOptions.BracketOptions .shouldOpenExtension (
630
631
ET.Ext ))
631
632
Printer << " \n " ;
@@ -636,7 +637,8 @@ void swift::ide::printSubmoduleInterface(
636
637
else
637
638
AdjustedOptions.initForSynthesizedExtension (NTD);
638
639
}
639
- ET.Ext ->print (Printer, AdjustedOptions);
640
+ // Set opened if we actually printed this extension.
641
+ Opened |= ET.Ext ->print (Printer, AdjustedOptions);
640
642
if (ET.IsSynthesized )
641
643
AdjustedOptions.clearSynthesizedExtension ();
642
644
if (AdjustedOptions.BracketOptions .shouldCloseExtension (
Original file line number Diff line number Diff line change
1
+ // Make sure we're not crashing.
2
+ // RUN: %sourcekitd-test -req=doc-info -module Swift
Original file line number Diff line number Diff line change @@ -209,6 +209,7 @@ class AnnotatingPrinter : public StreamPrinter {
209
209
initDefaultMapToUse (D);
210
210
// If D is declared in the extension, then the synthesized target is valid.
211
211
TypeOrExtensionDecl SynthesizedTarget;
212
+ assert (D->getDeclContext ()->isModuleScopeContext () == EntitiesStack.empty ());
212
213
if (D->getDeclContext () == SynthesizedExtensionInfo.first )
213
214
SynthesizedTarget = SynthesizedExtensionInfo.second ;
214
215
EntitiesStack.emplace_back (D, SynthesizedTarget,
You can’t perform that action at this time.
0 commit comments