Reproduce wrong binary resolution to fun w/ value class
^KT-65653
This commit is contained in:
+12
@@ -111,4 +111,16 @@ public class FirStandaloneNormalAnalysisLibraryBinaryModulePsiDeclarationProvide
|
|||||||
public void testPropertiesInOuterClass() throws Exception {
|
public void testPropertiesInOuterClass() throws Exception {
|
||||||
runTest("analysis/analysis-api/testData/standalone/binary/propertiesInOuterClass.kt");
|
runTest("analysis/analysis-api/testData/standalone/binary/propertiesInOuterClass.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("propertyWithValueClass.kt")
|
||||||
|
public void testPropertyWithValueClass() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/standalone/binary/propertyWithValueClass.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("topLevelFunctionWithValueClass.kt")
|
||||||
|
public void testTopLevelFunctionWithValueClass() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/standalone/binary/topLevelFunctionWithValueClass.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
// MODULE: lib
|
||||||
|
|
||||||
|
// FILE: some/graphics/Color.kt
|
||||||
|
|
||||||
|
package some.graphics
|
||||||
|
|
||||||
|
@JvmInline
|
||||||
|
value class Color(val value: Int) {
|
||||||
|
companion object {
|
||||||
|
val Blue = Color(42)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: some/unit/ColorProvider.kt
|
||||||
|
|
||||||
|
package some.unit
|
||||||
|
|
||||||
|
import some.graphics.Color
|
||||||
|
|
||||||
|
var changingColor: Color? = null
|
||||||
|
|
||||||
|
class ColorProvider {
|
||||||
|
val color: Color
|
||||||
|
get() = changingColor ?: Color.Blue
|
||||||
|
|
||||||
|
@Deprecated(message = "For binary compatibility") //, level = DeprecationLevel.HIDDEN)
|
||||||
|
@get:JvmName("getColor")
|
||||||
|
val deprecatedColor: Color?
|
||||||
|
get() = changingColor
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: app(lib)
|
||||||
|
// MODULE_KIND: Source
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
import some.unit.ColorProvider
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
val color = ColorProvider().col<caret>or
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Resolved to:
|
||||||
|
PsiMethod:getColor(): PsiType:Color
|
||||||
+51
@@ -0,0 +1,51 @@
|
|||||||
|
// MODULE: lib
|
||||||
|
|
||||||
|
// FILE: some/graphics/Color.kt
|
||||||
|
|
||||||
|
package some.graphics
|
||||||
|
|
||||||
|
@JvmInline
|
||||||
|
value class Color(val value: Int) {
|
||||||
|
companion object {
|
||||||
|
val Blue = Color(42)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: some/unit/ColorProvider.kt
|
||||||
|
|
||||||
|
package some.unit
|
||||||
|
|
||||||
|
import some.graphics.Color
|
||||||
|
|
||||||
|
interface Context
|
||||||
|
|
||||||
|
interface ColorProvider {
|
||||||
|
fun getColor(context: Context): Color
|
||||||
|
}
|
||||||
|
|
||||||
|
fun ColorProvider(color: Color): ColorProvider {
|
||||||
|
return FixedColorProvider(color)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun ColorProvider(resId: Int): ColorProvider {
|
||||||
|
return ResourceColorProvider(resId)
|
||||||
|
}
|
||||||
|
|
||||||
|
data class FixedColorProvider(val color: Color) : ColorProvider {
|
||||||
|
override fun getColor(context: Context) = color
|
||||||
|
}
|
||||||
|
|
||||||
|
data class ResourceColorProvider(val resId: Int) : ColorProvider {
|
||||||
|
override fun getColor(context: Context): Color = Color(resId)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: app(lib)
|
||||||
|
// MODULE_KIND: Source
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
import some.graphics.Color
|
||||||
|
import some.unit.ColorProvider
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
val color = Color<caret>Provider(color = Color.Blue)
|
||||||
|
}
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
Resolved to:
|
||||||
|
PsiMethod:ColorProvider(resId: PsiType:int): PsiType:ColorProvider
|
||||||
Reference in New Issue
Block a user