Skip to content

Fix #61531: swift-symbolgraph-extract crashes when trying to emit the 'Swift' module #62825

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/SymbolGraphGen/SymbolGraphASTWalker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ bool SymbolGraphASTWalker::walkToDeclPre(Decl *D, CharSourceRange Range) {
llvm_unreachable("Expected ProtocolDecl or ProtocolCompositionType");
}

while (const auto *Comp = UnexpandedCompositions.pop_back_val()) {
while (!UnexpandedCompositions.empty()) {
const auto *Comp = UnexpandedCompositions.pop_back_val();
for (const auto &Member : Comp->getMembers()) {
if (const auto *Proto =
dyn_cast_or_null<ProtocolDecl>(Member->getAnyNominal())) {
Expand Down
6 changes: 6 additions & 0 deletions test/SymbolGraph/Relationships/ConformsTo/Indirect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ extension ES: EQ {
// EQ : EP
// EXTERNAL-DAG: "kind": "conformsTo",{{[[:space:]]*}}"source": "s:16ExternalIndirect2EQP",{{[[:space:]]*}}"target": "s:16ExternalIndirect2EPP"

// extension ES : EA (originating from EP : EAB and typealias EAB = EA & EB)
// EXTENSION-DAG: "kind": "conformsTo",{{[[:space:]]*}}"source": "s:e:s:16ExternalIndirect2ESV0B0E3fooyyF",{{[[:space:]]*}}"target": "s:16ExternalIndirect2EAP"

// extension ES : EB (originating from EP : EAB and typealias EAB = EA & EB)
// EXTENSION-DAG: "kind": "conformsTo",{{[[:space:]]*}}"source": "s:e:s:16ExternalIndirect2ESV0B0E3fooyyF",{{[[:space:]]*}}"target": "s:16ExternalIndirect2EBP"

// extension ES : EP
// EXTENSION-DAG: "kind": "conformsTo",{{[[:space:]]*}}"source": "s:e:s:16ExternalIndirect2ESV0B0E3fooyyF",{{[[:space:]]*}}"target": "s:16ExternalIndirect2EPP"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
public protocol EP {
public protocol EA {}
public protocol EB {}

public typealias EAB = EA & EB

public protocol EP : EAB {
func foo()
}

Expand Down