[FE 1.0] Don't try to compute value parameters for variables while creating a flat signature for the overload resolution

^KT-50172 Fixed
This commit is contained in:
Victor Petukhov
2021-12-10 11:10:22 +03:00
committed by teamcity
parent c998582e13
commit e50e055eb4
10 changed files with 65 additions and 3 deletions
@@ -2933,6 +2933,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/callableReference/kt47988.kt");
}
@Test
@TestMetadata("kt50172.kt")
public void testKt50172() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/kt50172.kt");
}
@Test
@TestMetadata("nested.kt")
public void testNested() throws Exception {
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.builtins.getValueParameterTypesFromCallableReflectio
import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.descriptors.MemberDescriptor
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
import org.jetbrains.kotlin.descriptors.VariableDescriptor
import org.jetbrains.kotlin.descriptors.synthetic.SyntheticMemberDescriptor
import org.jetbrains.kotlin.resolve.calls.components.hasDefaultValue
import org.jetbrains.kotlin.types.KotlinType
@@ -28,9 +29,13 @@ fun <T> FlatSignature.Companion.createFromReflectionType(
// have transient receiver which is not the same in its signature
val receiver = descriptor.extensionReceiverParameter?.type
val contextReceiversTypes = descriptor.contextReceiverParameters.mapNotNull { it.type }
val parameters = reflectionType.getValueParameterTypesFromCallableReflectionType(
receiver != null && !hasBoundExtensionReceiver
).map { it.type }
val parameters = if (descriptor is VariableDescriptor) {
emptyList()
} else {
reflectionType.getValueParameterTypesFromCallableReflectionType(
receiver != null && !hasBoundExtensionReceiver
).map { it.type }
}
return FlatSignature(
origin,
@@ -0,0 +1,11 @@
// WITH_STDLIB
fun g(s: String): List<String> {
fun f(x: String): String = x + "K"
val f = f(s)
return listOf(s).map(::f)
}
fun box(): String =
g("O").first()
@@ -2855,6 +2855,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/callableReference/kt47988.kt");
}
@Test
@TestMetadata("kt50172.kt")
public void testKt50172() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/kt50172.kt");
}
@Test
@TestMetadata("nested.kt")
public void testNested() throws Exception {
@@ -2933,6 +2933,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/callableReference/kt47988.kt");
}
@Test
@TestMetadata("kt50172.kt")
public void testKt50172() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/kt50172.kt");
}
@Test
@TestMetadata("nested.kt")
public void testNested() throws Exception {
@@ -2505,6 +2505,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/callableReference/kt47988.kt");
}
@TestMetadata("kt50172.kt")
public void testKt50172() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/kt50172.kt");
}
@TestMetadata("nested.kt")
public void testNested() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/nested.kt");
@@ -1895,6 +1895,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/callableReference/kt47988.kt");
}
@Test
@TestMetadata("kt50172.kt")
public void testKt50172() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/kt50172.kt");
}
@Test
@TestMetadata("nested.kt")
public void testNested() throws Exception {
@@ -1937,6 +1937,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/callableReference/kt47988.kt");
}
@Test
@TestMetadata("kt50172.kt")
public void testKt50172() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/kt50172.kt");
}
@Test
@TestMetadata("nested.kt")
public void testNested() throws Exception {
@@ -1730,6 +1730,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/callableReference/kt47988.kt");
}
@TestMetadata("kt50172.kt")
public void testKt50172() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/kt50172.kt");
}
@TestMetadata("nested.kt")
public void testNested() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/nested.kt");
@@ -1961,6 +1961,12 @@ public class NativeExtBlackBoxTestGenerated extends AbstractNativeBlackBoxTest {
runTest("compiler/testData/codegen/box/callableReference/kt47988.kt");
}
@Test
@TestMetadata("kt50172.kt")
public void testKt50172() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/kt50172.kt");
}
@Test
@TestMetadata("nested.kt")
public void testNested() throws Exception {