Skip to content

Commit 46cd560

Browse files
don't assert when a module re-exports a module and one of its symbols (#64480)
rdar://106807038
1 parent ef7a6b8 commit 46cd560

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

lib/AST/Module.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,6 +1128,9 @@ void ModuleDecl::getDisplayDecls(SmallVectorImpl<Decl*> &Results, bool Recursive
11281128
llvm::SmallDenseMap<ModuleDecl *, SmallPtrSet<Decl *, 4>, 4> QualifiedImports;
11291129
collectParsedExportedImports(this, Modules, QualifiedImports);
11301130
for (const auto &QI : QualifiedImports) {
1131+
auto Module = QI.getFirst();
1132+
if (Modules.contains(Module)) continue;
1133+
11311134
auto &Decls = QI.getSecond();
11321135
Results.append(Decls.begin(), Decls.end());
11331136
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend %S/Inputs/DuplicateExportedImport/A.swift -module-name A -emit-module -emit-module-path %t/A.swiftmodule
3+
// 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/
4+
// RUN: %FileCheck %s --input-file %t/DuplicateExportedImport.symbols.json
5+
6+
// REQUIRES: asserts
7+
8+
// CHECK-COUNT-1: "precise":"s:1A8ClassTwoC"
9+
10+
@_exported import A
11+
@_exported import class A.ClassTwo
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
public class ClassOne {}
2+
3+
public class ClassTwo {}

0 commit comments

Comments
 (0)