diff options
-rw-r--r-- | core/src/main/kotlin/Kotlin/DocumentationBuilder.kt | 8 | ||||
-rw-r--r-- | core/src/test/kotlin/format/MarkdownFormatTest.kt | 4 | ||||
-rw-r--r-- | core/testdata/format/memberExtension.kt | 8 | ||||
-rw-r--r-- | core/testdata/format/memberExtension.md | 10 |
4 files changed, 27 insertions, 3 deletions
diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt index d9561980..2ab43fa1 100644 --- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt +++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt @@ -367,6 +367,7 @@ class DocumentationBuilder val extensionFunctionsByName = allExtensionFunctions.groupBy { it.name } for (extensionFunction in allExtensionFunctions) { + if (extensionFunction.dispatchReceiverParameter != null) continue val possiblyShadowingFunctions = extensionFunctionsByName[extensionFunction.name] ?.filter { fn -> fn.canShadow(extensionFunction) } ?: emptyList() @@ -677,9 +678,10 @@ class DocumentationBuilder receiverClass = upperBoundClass } } - link(receiverClass, - containingDeclaration, - RefKind.Extension) + + if ((containingDeclaration as? FunctionDescriptor)?.dispatchReceiverParameter == null) { + link(receiverClass, containingDeclaration, RefKind.Extension) + } val node = DocumentationNode(name.asString(), Content.Empty, NodeKind.Receiver) node.appendType(type) diff --git a/core/src/test/kotlin/format/MarkdownFormatTest.kt b/core/src/test/kotlin/format/MarkdownFormatTest.kt index fb202b81..34870ce7 100644 --- a/core/src/test/kotlin/format/MarkdownFormatTest.kt +++ b/core/src/test/kotlin/format/MarkdownFormatTest.kt @@ -250,6 +250,10 @@ class MarkdownFormatTest { verifyMarkdownNodes("dynamicExtension") { model -> model.members.single().members.filter { it.name == "Foo" } } } + @Test fun memberExtension() { + verifyMarkdownNodes("memberExtension") { model -> model.members.single().members.filter { it.name == "Foo" } } + } + @Test fun multiplePlatforms() { verifyMultiplatformPackage(buildMultiplePlatforms("multiplatform"), "multiplatform") } diff --git a/core/testdata/format/memberExtension.kt b/core/testdata/format/memberExtension.kt new file mode 100644 index 00000000..955794d1 --- /dev/null +++ b/core/testdata/format/memberExtension.kt @@ -0,0 +1,8 @@ +open class X + +class Foo : X + +class Bar { + fun X.y() = "" + fun Foo.x() = "" +} diff --git a/core/testdata/format/memberExtension.md b/core/testdata/format/memberExtension.md new file mode 100644 index 00000000..b9db4e3d --- /dev/null +++ b/core/testdata/format/memberExtension.md @@ -0,0 +1,10 @@ +[test](test/index) / [Foo](test/-foo/index) + +# Foo + +`class Foo : `[`X`](test/-x/index) + +### Constructors + +| [<init>](test/-foo/-init-) | `Foo()` | + |