Skip to content

Sourcekit/DocSupport: fix an assertion when generating documentation for extensions with attributes #24939

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
merged 1 commit into from
May 21, 2019
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: 3 additions & 0 deletions lib/IDE/IDETypeChecking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ static bool shouldPrintAsFavorable(const Decl *D, const PrintOptions &Options) {
const auto *FD = dyn_cast<FuncDecl>(D);
if (!FD)
return true;
// Don't check overload choices for accessor decls.
if (isa<AccessorDecl>(FD))
return true;
ResolvedMemberResult Result =
resolveValueMember(*DC, BaseTy, FD->getEffectiveFullName());
return !(Result.hasBestOverload() && Result.getBestOverload() != D);
Expand Down
8 changes: 8 additions & 0 deletions test/SourceKit/DocSupport/Inputs/cake.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,11 @@ public struct S3<Wrapped: P5>: P5 {
public typealias Element = Wrapped.Element
}
extension S3: P6 where Wrapped: P6 {}

/**
some comments
*/
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
public extension C1 {
func addition() {}
}
2 changes: 1 addition & 1 deletion test/SourceKit/DocSupport/doc_swift_module.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %empty-directory(%t.mod)
// RUN: %swift -emit-module -o %t.mod/cake.swiftmodule %S/Inputs/cake.swift -parse-as-library -enable-objc-interop
// RUN: %swift -emit-module -o %t.mod/cake.swiftmodule %S/Inputs/cake.swift -parse-as-library -enable-objc-interop -emit-module-doc-path %t.mod/cake.swiftdoc
// RUN: %sourcekitd-test -req=doc-info -module cake -- -I %t.mod > %t.response
// RUN: diff -u %s.response %t.response
Loading