[FIR] Expand typealiases in OverloadConflictResolver
^KT-52825 Fixed
This commit is contained in:
committed by
teamcity
parent
b73783b693
commit
eb453dc96b
+6
@@ -18149,6 +18149,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
|||||||
public void testLiteralsInInference() throws Exception {
|
public void testLiteralsInInference() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/integerLiterals/literalsInInference.kt");
|
runTest("compiler/testData/diagnostics/tests/integerLiterals/literalsInInference.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("typealiasOnLong.kt")
|
||||||
|
public void testTypealiasOnLong() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/integerLiterals/typealiasOnLong.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
+6
@@ -18149,6 +18149,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
|||||||
public void testLiteralsInInference() throws Exception {
|
public void testLiteralsInInference() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/integerLiterals/literalsInInference.kt");
|
runTest("compiler/testData/diagnostics/tests/integerLiterals/literalsInInference.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("typealiasOnLong.kt")
|
||||||
|
public void testTypealiasOnLong() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/integerLiterals/typealiasOnLong.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
+6
@@ -18149,6 +18149,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
|||||||
public void testLiteralsInInference() throws Exception {
|
public void testLiteralsInInference() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/integerLiterals/literalsInInference.kt");
|
runTest("compiler/testData/diagnostics/tests/integerLiterals/literalsInInference.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("typealiasOnLong.kt")
|
||||||
|
public void testTypealiasOnLong() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/integerLiterals/typealiasOnLong.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
+6
-4
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.fir.declarations.*
|
|||||||
import org.jetbrains.kotlin.fir.declarations.utils.isExpect
|
import org.jetbrains.kotlin.fir.declarations.utils.isExpect
|
||||||
import org.jetbrains.kotlin.fir.resolve.BodyResolveComponents
|
import org.jetbrains.kotlin.fir.resolve.BodyResolveComponents
|
||||||
import org.jetbrains.kotlin.fir.resolve.FirSamResolver
|
import org.jetbrains.kotlin.fir.resolve.FirSamResolver
|
||||||
|
import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
|
||||||
import org.jetbrains.kotlin.fir.resolve.inference.InferenceComponents
|
import org.jetbrains.kotlin.fir.resolve.inference.InferenceComponents
|
||||||
import org.jetbrains.kotlin.fir.types.*
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
import org.jetbrains.kotlin.name.StandardClassIds
|
import org.jetbrains.kotlin.name.StandardClassIds
|
||||||
@@ -173,18 +174,19 @@ abstract class AbstractConeCallConflictResolver(
|
|||||||
called: FirCallableDeclaration
|
called: FirCallableDeclaration
|
||||||
): List<TypeWithConversion> {
|
): List<TypeWithConversion> {
|
||||||
return buildList {
|
return buildList {
|
||||||
addIfNotNull(called.receiverTypeRef?.coneType?.let { TypeWithConversion(it) })
|
val session = inferenceComponents.session
|
||||||
|
addIfNotNull(called.receiverTypeRef?.coneType?.fullyExpandedType(session)?.let { TypeWithConversion(it) })
|
||||||
val typeForCallableReference = call.resultingTypeForCallableReference
|
val typeForCallableReference = call.resultingTypeForCallableReference
|
||||||
if (typeForCallableReference != null) {
|
if (typeForCallableReference != null) {
|
||||||
// Return type isn't needed here v
|
// Return type isn't needed here v
|
||||||
typeForCallableReference.typeArguments.dropLast(1)
|
typeForCallableReference.typeArguments.dropLast(1)
|
||||||
.mapTo(this) {
|
.mapTo(this) {
|
||||||
TypeWithConversion((it as ConeKotlinType).removeTypeVariableTypes(inferenceComponents.session.typeContext))
|
TypeWithConversion((it as ConeKotlinType).fullyExpandedType(session).removeTypeVariableTypes(session.typeContext))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
called.contextReceivers.mapTo(this) { TypeWithConversion(it.typeRef.coneType) }
|
called.contextReceivers.mapTo(this) { TypeWithConversion(it.typeRef.coneType.fullyExpandedType(session)) }
|
||||||
call.argumentMapping?.mapTo(this) { (_, parameter) ->
|
call.argumentMapping?.mapTo(this) { (_, parameter) ->
|
||||||
val argumentType = parameter.argumentType()
|
val argumentType = parameter.argumentType().fullyExpandedType(session)
|
||||||
if (!call.usesSAM) {
|
if (!call.usesSAM) {
|
||||||
TypeWithConversion(argumentType)
|
TypeWithConversion(argumentType)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
// ISSUE: KT-52825
|
||||||
|
|
||||||
|
typealias LLL = Long
|
||||||
|
|
||||||
|
fun foo(a: Int, b: Int) {}
|
||||||
|
fun foo(a: LLL, b: LLL) {}
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
foo(0, 0)
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun foo(/*0*/ a: LLL /* = kotlin.Long */, /*1*/ b: LLL /* = kotlin.Long */): kotlin.Unit
|
||||||
|
public fun foo(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Unit
|
||||||
|
public fun test(): kotlin.Unit
|
||||||
|
public typealias LLL = kotlin.Long
|
||||||
Generated
+6
@@ -18155,6 +18155,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
public void testLiteralsInInference() throws Exception {
|
public void testLiteralsInInference() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/integerLiterals/literalsInInference.kt");
|
runTest("compiler/testData/diagnostics/tests/integerLiterals/literalsInInference.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("typealiasOnLong.kt")
|
||||||
|
public void testTypealiasOnLong() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/integerLiterals/typealiasOnLong.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
Reference in New Issue
Block a user