Skip to content

Commit e858867

Browse files
authored
Merge pull request #24939 from nkcsgexi/doc-support-issue
Sourcekit/DocSupport: fix an assertion when generating documentation for extensions with attributes
2 parents 33573aa + 1ca8e83 commit e858867

File tree

5 files changed

+462
-310
lines changed

5 files changed

+462
-310
lines changed

lib/IDE/IDETypeChecking.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ static bool shouldPrintAsFavorable(const Decl *D, const PrintOptions &Options) {
3939
const auto *FD = dyn_cast<FuncDecl>(D);
4040
if (!FD)
4141
return true;
42+
// Don't check overload choices for accessor decls.
43+
if (isa<AccessorDecl>(FD))
44+
return true;
4245
ResolvedMemberResult Result =
4346
resolveValueMember(*DC, BaseTy, FD->getEffectiveFullName());
4447
return !(Result.hasBestOverload() && Result.getBestOverload() != D);

test/SourceKit/DocSupport/Inputs/cake.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,11 @@ public struct S3<Wrapped: P5>: P5 {
9898
public typealias Element = Wrapped.Element
9999
}
100100
extension S3: P6 where Wrapped: P6 {}
101+
102+
/**
103+
some comments
104+
*/
105+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
106+
public extension C1 {
107+
func addition() {}
108+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// RUN: %empty-directory(%t.mod)
2-
// RUN: %swift -emit-module -o %t.mod/cake.swiftmodule %S/Inputs/cake.swift -parse-as-library -enable-objc-interop
2+
// 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
33
// RUN: %sourcekitd-test -req=doc-info -module cake -- -I %t.mod > %t.response
44
// RUN: diff -u %s.response %t.response

0 commit comments

Comments
 (0)