[Analysis API] add diagnostic test of type inference from getValue delegate

^KT-62888
This commit is contained in:
Dmitrii Gridin
2023-12-27 20:44:08 +01:00
committed by Space Team
parent 3eb86ede96
commit faf33e4fa4
8 changed files with 77 additions and 0 deletions
@@ -0,0 +1,12 @@
import kotlin.reflect.KMutableProperty
class SimpleVarClass(var constructorVariable: Boolean) {
var memberVariable: Boolean = constructorVariable
}
fun moreFun(a: KMutableProperty<Boolean>) = a
fun testMutableProp() {
moreFun(SimpleVarClass::constructorVariable)
moreFun(SimpleVarClass::memberVariable)
}
@@ -0,0 +1 @@
Diagnostics from elements:
@@ -0,0 +1,20 @@
// IGNORE_FE10
// KT-64503
// MODULE: lib
// MODULE_KIND: LibraryBinary
// FILE: Lib.kt
class SimpleVarClass(var constructorVariable: Boolean) {
var memberVariable: Boolean = constructorVariable
}
// MODULE: main(lib)
// FILE: usage.kt
import kotlin.reflect.KMutableProperty
fun moreFun(a: KMutableProperty<Boolean>) = a
fun testMutableProp() {
moreFun(SimpleVarClass::constructorVariable)
moreFun(SimpleVarClass::memberVariable)
}
@@ -0,0 +1,7 @@
Diagnostics from elements:
for PSI element of type KtNameReferenceExpression at (18,29-48)
INAPPLICABLE_CANDIDATE text ranges: [(188,207)]
PSI: KtNameReferenceExpression at (18,29-48)
for PSI element of type KtNameReferenceExpression at (19,29-43)
INAPPLICABLE_CANDIDATE text ranges: [(237,251)]
PSI: KtNameReferenceExpression at (19,29-43)