REPL: Fix completion for protected members
This commit is contained in:
+33
@@ -442,6 +442,39 @@ class ReplCompletionAndErrorsAnalysisTest : TestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testProtectedInheritedMemberCompletion() = test {
|
||||
run {
|
||||
code = """
|
||||
open class Base {
|
||||
private val xyz1: Float = 7.0f
|
||||
protected val xyz2: Int = 42
|
||||
internal val xyz3: String = ""
|
||||
public val xyz4: Byte = 8
|
||||
}
|
||||
""".trimIndent()
|
||||
doCompile
|
||||
}
|
||||
|
||||
run {
|
||||
val definition = "val c = x"
|
||||
code = """
|
||||
object : Base() {
|
||||
fun g() {
|
||||
$definition
|
||||
}
|
||||
}
|
||||
""".trimIndent()
|
||||
cursor = code.indexOf(definition) + definition.length
|
||||
|
||||
expect {
|
||||
addCompletion("xyz2", "xyz2", "Int", "property")
|
||||
addCompletion("xyz3", "xyz3", "String", "property")
|
||||
addCompletion("xyz4", "xyz4", "Byte", "property")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Ignore("Should be fixed by KT-39314")
|
||||
@Test
|
||||
fun ignore_testDefaultImportsNotFirst() = test {
|
||||
|
||||
+9
-2
@@ -14,6 +14,8 @@ import java.util.concurrent.atomic.AtomicInteger
|
||||
import kotlin.reflect.KProperty
|
||||
import kotlin.reflect.KProperty0
|
||||
import kotlin.script.experimental.api.*
|
||||
import kotlin.script.experimental.jvm.impl.KJvmCompiledScript
|
||||
import kotlin.script.experimental.util.LinkedSnippet
|
||||
import kotlin.system.measureTimeMillis
|
||||
|
||||
class TestConf {
|
||||
@@ -249,8 +251,13 @@ private suspend fun evaluateInRepl(
|
||||
|
||||
if (doCompile) {
|
||||
val codeLineForCompilation = nextCodeLine(code, lineCounter)
|
||||
|
||||
val timeMillis = measureTimeMillis { compiler.compile(codeLineForCompilation, newCompilationConfiguration) }
|
||||
val compilationResult: ResultWithDiagnostics<LinkedSnippet<KJvmCompiledScript>>
|
||||
val timeMillis = measureTimeMillis {
|
||||
compilationResult = compiler.compile(codeLineForCompilation, newCompilationConfiguration)
|
||||
}
|
||||
if (compilationResult is ResultWithDiagnostics.Failure) {
|
||||
System.err.println(compilationResult.reports.joinToString("\n", "Compilation failed:\n") { it.toString() })
|
||||
}
|
||||
|
||||
loggingInfo?.compile?.writeValue(timeMillis)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user