diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java index 3590ad08500..7e14c5aa505 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java @@ -18149,6 +18149,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag public void testLiteralsInInference() throws Exception { 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 diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java index 9e75bca0143..205b60fa81f 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java @@ -18149,6 +18149,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti public void testLiteralsInInference() throws Exception { 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 diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java index d98878c7eca..7b2a8574079 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java @@ -18149,6 +18149,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac public void testLiteralsInInference() throws Exception { 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 diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/AbstractConeCallConflictResolver.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/AbstractConeCallConflictResolver.kt index cee709b79c5..c24fe3ef331 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/AbstractConeCallConflictResolver.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/AbstractConeCallConflictResolver.kt @@ -9,6 +9,7 @@ import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.utils.isExpect import org.jetbrains.kotlin.fir.resolve.BodyResolveComponents 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.types.* import org.jetbrains.kotlin.name.StandardClassIds @@ -173,18 +174,19 @@ abstract class AbstractConeCallConflictResolver( called: FirCallableDeclaration ): List { 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 if (typeForCallableReference != null) { // Return type isn't needed here v typeForCallableReference.typeArguments.dropLast(1) .mapTo(this) { - TypeWithConversion((it as ConeKotlinType).removeTypeVariableTypes(inferenceComponents.session.typeContext)) + TypeWithConversion((it as ConeKotlinType).fullyExpandedType(session).removeTypeVariableTypes(session.typeContext)) } } else { - called.contextReceivers.mapTo(this) { TypeWithConversion(it.typeRef.coneType) } + called.contextReceivers.mapTo(this) { TypeWithConversion(it.typeRef.coneType.fullyExpandedType(session)) } call.argumentMapping?.mapTo(this) { (_, parameter) -> - val argumentType = parameter.argumentType() + val argumentType = parameter.argumentType().fullyExpandedType(session) if (!call.usesSAM) { TypeWithConversion(argumentType) } else { diff --git a/compiler/testData/diagnostics/tests/integerLiterals/typealiasOnLong.kt b/compiler/testData/diagnostics/tests/integerLiterals/typealiasOnLong.kt new file mode 100644 index 00000000000..c667bf9ec3c --- /dev/null +++ b/compiler/testData/diagnostics/tests/integerLiterals/typealiasOnLong.kt @@ -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) +} diff --git a/compiler/testData/diagnostics/tests/integerLiterals/typealiasOnLong.txt b/compiler/testData/diagnostics/tests/integerLiterals/typealiasOnLong.txt new file mode 100644 index 00000000000..81e6e2ec534 --- /dev/null +++ b/compiler/testData/diagnostics/tests/integerLiterals/typealiasOnLong.txt @@ -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 diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index 897f7fecc39..d05c405971a 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -18155,6 +18155,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { public void testLiteralsInInference() throws Exception { 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