FIR: resolve conflicts between overloads with platform integer types

This commit is contained in:
pyos
2021-04-23 12:32:44 +02:00
committed by TeamCityServer
parent a27d428573
commit bfb1a06f3d
7 changed files with 70 additions and 6 deletions
@@ -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");
@@ -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)
}
@@ -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 {
@@ -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 {