FIR: resolve conflicts between overloads with platform integer types
This commit is contained in:
+5
@@ -561,6 +561,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/integerLiteralTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("integerOverloads.kt")
|
||||
public void testIntegerOverloads() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/integerOverloads.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("invoke.kt")
|
||||
public void testInvoke() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/invoke.kt");
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
FILE: x.kt
|
||||
public final fun f(x: R|kotlin/Byte|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun f(x: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun f(x: R|kotlin/Long|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun g(x: R|kotlin/Byte?|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun g(x: R|kotlin/Int?|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun g(x: R|kotlin/Long?|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
Q|J|.R|/J.f|(Int(123))
|
||||
Q|J|.R|/J.f|(Long(123123123123))
|
||||
R|/f|(Int(123))
|
||||
R|/f|(Long(123123123123))
|
||||
R|/g|(Int(123))
|
||||
R|/g|(Long(123123123123))
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public static fun f(Byte x) {}
|
||||
public static fun f(Integer x) {}
|
||||
public static fun f(Long x) {}
|
||||
}
|
||||
|
||||
// FILE: x.kt
|
||||
fun f(x: Byte) {}
|
||||
fun f(x: Int) {}
|
||||
fun f(x: Long) {}
|
||||
|
||||
fun g(x: Byte?) {}
|
||||
fun g(x: Int?) {}
|
||||
fun g(x: Long?) {}
|
||||
|
||||
fun main() {
|
||||
J.f(123)
|
||||
J.f(123123123123)
|
||||
f(123)
|
||||
f(123123123123)
|
||||
g(123)
|
||||
g(123123123123)
|
||||
}
|
||||
+6
@@ -659,6 +659,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/integerLiteralTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("integerOverloads.kt")
|
||||
public void testIntegerOverloads() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/integerOverloads.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("invoke.kt")
|
||||
public void testInvoke() throws Exception {
|
||||
|
||||
+6
@@ -659,6 +659,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/integerLiteralTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("integerOverloads.kt")
|
||||
public void testIntegerOverloads() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/integerOverloads.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("invoke.kt")
|
||||
public void testInvoke() throws Exception {
|
||||
|
||||
+3
-6
@@ -7,11 +7,8 @@ package org.jetbrains.kotlin.fir.resolve.calls
|
||||
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.resolve.inference.InferenceComponents
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
import org.jetbrains.kotlin.name.StandardClassIds
|
||||
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||
import org.jetbrains.kotlin.fir.types.arrayElementType
|
||||
import org.jetbrains.kotlin.fir.types.classId
|
||||
import org.jetbrains.kotlin.fir.types.coneType
|
||||
import org.jetbrains.kotlin.resolve.calls.results.*
|
||||
import org.jetbrains.kotlin.types.model.KotlinTypeMarker
|
||||
import org.jetbrains.kotlin.types.model.requireOrDescribe
|
||||
@@ -69,8 +66,8 @@ abstract class AbstractConeCallConflictResolver(
|
||||
val uByte = StandardClassIds.UByte
|
||||
val uShort = StandardClassIds.UShort
|
||||
|
||||
val specificClassId = specific.classId ?: return false
|
||||
val generalClassId = general.classId ?: return false
|
||||
val specificClassId = specific.lowerBoundIfFlexible().classId ?: return false
|
||||
val generalClassId = general.upperBoundIfFlexible().classId ?: return false
|
||||
|
||||
|
||||
// int >= long, int >= short, short >= byte
|
||||
|
||||
+5
@@ -563,6 +563,11 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/integerLiteralTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("integerOverloads.kt")
|
||||
public void testIntegerOverloads() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/integerOverloads.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("invoke.kt")
|
||||
public void testInvoke() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/invoke.kt");
|
||||
|
||||
Reference in New Issue
Block a user