aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2016-11-08 18:08:00 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2016-11-08 18:08:00 +0300
commita014843ed2de90c6ac73e2a8acb41f617ff86432 (patch)
treedd369d145d57bd74300f5a55546adca0152c919d /core
parentc4cf001951bbe92223fdedaf4bb5fbdeddeb2472 (diff)
downloaddokka-a014843ed2de90c6ac73e2a8acb41f617ff86432.tar.gz
dokka-a014843ed2de90c6ac73e2a8acb41f617ff86432.tar.bz2
dokka-a014843ed2de90c6ac73e2a8acb41f617ff86432.zip
Fix for GH-79 , KT-13299 Critical bug, top-level Kotlin functions from libraries not resolved
Diffstat (limited to 'core')
-rw-r--r--core/src/main/kotlin/Analysis/AnalysisEnvironment.kt4
-rw-r--r--core/src/test/kotlin/issues/IssuesTest.kt28
-rw-r--r--core/testdata/issues/errorClasses.kt20
3 files changed, 51 insertions, 1 deletions
diff --git a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt
index d3abf41f..46fcb6c2 100644
--- a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt
+++ b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.analyzer.ResolverForModule
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
+import org.jetbrains.kotlin.cli.jvm.compiler.JvmPackagePartProvider
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.cli.jvm.config.*
import org.jetbrains.kotlin.config.*
@@ -94,7 +95,8 @@ class AnalysisEnvironment(val messageCollector: MessageCollector) : Disposable {
listOf(module),
{ ModuleContent(sourceFiles, GlobalSearchScope.allScope(environment.project)) },
JvmPlatformParameters { module },
- CompilerEnvironment
+ CompilerEnvironment,
+ packagePartProviderFactory = { info, content -> JvmPackagePartProvider(environment, content.moduleContentScope) }
)
val resolverForModule = resolverForProject.resolverForModule(module)
diff --git a/core/src/test/kotlin/issues/IssuesTest.kt b/core/src/test/kotlin/issues/IssuesTest.kt
new file mode 100644
index 00000000..625d7e46
--- /dev/null
+++ b/core/src/test/kotlin/issues/IssuesTest.kt
@@ -0,0 +1,28 @@
+package issues
+
+import org.jetbrains.dokka.DocumentationNode
+import org.jetbrains.dokka.NodeKind
+import org.jetbrains.dokka.tests.toTestString
+import org.jetbrains.dokka.tests.verifyModel
+import org.junit.Test
+import kotlin.test.assertEquals
+
+
+class IssuesTest {
+
+ @Test
+ fun errorClasses() {
+ verifyModel("testdata/issues/errorClasses.kt", withJdk = true, withKotlinRuntime = true) { model ->
+ val cls = model.members.single().members.single()
+
+ fun DocumentationNode.returnType() = this.details.find { it.kind == NodeKind.Type }?.name
+ assertEquals("Test", cls.members[1].returnType())
+ assertEquals("Test", cls.members[2].returnType())
+ assertEquals("Test", cls.members[3].returnType())
+ assertEquals("List", cls.members[4].returnType())
+ assertEquals("String", cls.members[5].returnType())
+ assertEquals("String", cls.members[6].returnType())
+ assertEquals("String", cls.members[7].returnType())
+ }
+ }
+}
diff --git a/core/testdata/issues/errorClasses.kt b/core/testdata/issues/errorClasses.kt
new file mode 100644
index 00000000..9e966b3a
--- /dev/null
+++ b/core/testdata/issues/errorClasses.kt
@@ -0,0 +1,20 @@
+
+class Test(var value: String) {
+ fun brokenApply(v: String) = apply { value = v }
+
+ fun brokenRun(v: String) = run {
+ value = v
+ this
+ }
+
+ fun brokenLet(v: String) = let {
+ it.value = v
+ it
+ }
+
+ fun brokenGenerics() = listOf("a", "b", "c")
+
+ fun working(v: String) = doSomething()
+
+ fun doSomething(): String = "Hello"
+} \ No newline at end of file