Skip to content

Commit

Permalink
don't assert when a module re-exports a module and one of its symbols (
Browse files Browse the repository at this point in the history
…swiftlang#64479)

rdar://106807038
  • Loading branch information
QuietMisdreavus committed Mar 22, 2023
1 parent 5e3e0b0 commit f3ad288
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/AST/Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,9 @@ void ModuleDecl::getDisplayDecls(SmallVectorImpl<Decl*> &Results, bool Recursive
llvm::SmallDenseMap<ModuleDecl *, SmallPtrSet<Decl *, 4>, 4> QualifiedImports;
collectParsedExportedImports(this, Modules, QualifiedImports);
for (const auto &QI : QualifiedImports) {
auto Module = QI.getFirst();
if (Modules.contains(Module)) continue;

auto &Decls = QI.getSecond();
Results.append(Decls.begin(), Decls.end());
}
Expand Down
11 changes: 11 additions & 0 deletions test/SymbolGraph/Module/DuplicateExportedImport.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend %S/Inputs/DuplicateExportedImport/A.swift -module-name A -emit-module -emit-module-path %t/A.swiftmodule
// RUN: %target-swift-frontend %s -module-name DuplicateExportedImport -emit-module -emit-module-path /dev/null -I %t -emit-symbol-graph -emit-symbol-graph-dir %t/
// RUN: %FileCheck %s --input-file %t/DuplicateExportedImport.symbols.json

// REQUIRES: asserts

// CHECK-COUNT-1: "precise":"s:1A8ClassTwoC"

@_exported import A
@_exported import class A.ClassTwo
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
public class ClassOne {}

public class ClassTwo {}

0 comments on commit f3ad288

Please sign in to comment.