Skip to content

Commit f3ad288

Browse files
don't assert when a module re-exports a module and one of its symbols (#64479)
rdar://106807038
1 parent 5e3e0b0 commit f3ad288

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
@@ -1397,6 +1397,9 @@ void ModuleDecl::getDisplayDecls(SmallVectorImpl<Decl*> &Results, bool Recursive
13971397
llvm::SmallDenseMap<ModuleDecl *, SmallPtrSet<Decl *, 4>, 4> QualifiedImports;
13981398
collectParsedExportedImports(this, Modules, QualifiedImports);
13991399
for (const auto &QI : QualifiedImports) {
1400+
auto Module = QI.getFirst();
1401+
if (Modules.contains(Module)) continue;
1402+
14001403
auto &Decls = QI.getSecond();
14011404
Results.append(Decls.begin(), Decls.end());
14021405
}
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)