Skip to content

Commit

Permalink
Merge pull request #110 from Kotlin/0.9.10/GH-79
Browse files Browse the repository at this point in the history
Fix for GH-79 , KT-13299  Critical bug, top-level Kotlin functions from libraries not resolved
  • Loading branch information
semoro authored Nov 8, 2016
2 parents c4cf001 + a014843 commit beb3389
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/main/kotlin/Analysis/AnalysisEnvironment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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.*
Expand Down Expand Up @@ -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)
Expand Down
28 changes: 28 additions & 0 deletions core/src/test/kotlin/issues/IssuesTest.kt
Original file line number Diff line number Diff line change
@@ -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())
}
}
}
20 changes: 20 additions & 0 deletions core/testdata/issues/errorClasses.kt
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit beb3389

Please sign in to comment.