[FIR] Add test for KT-43619

This commit is contained in:
Dmitriy Novozhilov
2023-02-13 12:33:04 +02:00
committed by Space Team
parent b23aabf6e0
commit 197f19c627
6 changed files with 61 additions and 0 deletions
@@ -3143,6 +3143,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
runTest("compiler/fir/analysis-tests/testData/resolve/inference/nullableIntegerLiteralType.kt");
}
@Test
@TestMetadata("overloadResolutionByLambdaArgumentType.kt")
public void testOverloadResolutionByLambdaArgumentType() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/inference/overloadResolutionByLambdaArgumentType.kt");
}
@Test
@TestMetadata("receiverWithCapturedType.kt")
public void testReceiverWithCapturedType() throws Exception {
@@ -2757,6 +2757,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
runTest("compiler/fir/analysis-tests/testData/resolve/inference/nullableIntegerLiteralType.kt");
}
@TestMetadata("overloadResolutionByLambdaArgumentType.kt")
public void testOverloadResolutionByLambdaArgumentType() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/inference/overloadResolutionByLambdaArgumentType.kt");
}
@TestMetadata("receiverWithCapturedType.kt")
public void testReceiverWithCapturedType() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/inference/receiverWithCapturedType.kt");
@@ -0,0 +1,27 @@
FILE: overloadResolutionByLambdaArgumentType.kt
public final class A<K> : R|kotlin/Any| {
public constructor<K>(): R|A<K>| {
super<R|kotlin/Any|>()
}
}
public final fun <K> R|A<K>|.foo(k: R|K|): R|K| {
^foo R|<local>/k|
}
public final fun <K> R|A<K>|.foo(a: R|A<K>.() -> kotlin/Unit|): R|kotlin/Int| {
^foo Int(2)
}
public final fun test(): R|kotlin/Unit| {
R|/A.A|<R|kotlin/Int|>().<Ambiguity: foo, [/foo, /foo]>#(<L> = foo@fun <anonymous>(): R|kotlin/Unit| <inline=Unknown> {
^@foo Unit
}
)
R|/A.A|<R|kotlin/Int|>().R|/foo|<R|kotlin/Int|>(<L> = foo@fun R|A<kotlin/Int>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
^@foo Unit
}
)
R|/A.A|<R|kotlin/Int|>().<Ambiguity: foo, [/foo, /foo]>#<R|kotlin/Any|>(<L> = foo@fun <anonymous>(): R|kotlin/Unit| <inline=Unknown> {
^@foo Unit
}
)
}
@@ -0,0 +1,11 @@
// ISSUE: KT-43619
class A<K>
fun <K> A<K>.foo(k: K) = k // (1)
fun <K> A<K>.foo(a: A<K>.() -> Unit) = 2 // (2)
fun test(){
A<Int>().<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!> {} // (1)
A<Int>().foo<Int> {} // (1)
A<Int>().<!NONE_APPLICABLE!>foo<!><Any> {} // error
}
@@ -3143,6 +3143,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
runTest("compiler/fir/analysis-tests/testData/resolve/inference/nullableIntegerLiteralType.kt");
}
@Test
@TestMetadata("overloadResolutionByLambdaArgumentType.kt")
public void testOverloadResolutionByLambdaArgumentType() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/inference/overloadResolutionByLambdaArgumentType.kt");
}
@Test
@TestMetadata("receiverWithCapturedType.kt")
public void testReceiverWithCapturedType() throws Exception {
@@ -3143,6 +3143,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
runTest("compiler/fir/analysis-tests/testData/resolve/inference/nullableIntegerLiteralType.kt");
}
@Test
@TestMetadata("overloadResolutionByLambdaArgumentType.kt")
public void testOverloadResolutionByLambdaArgumentType() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/inference/overloadResolutionByLambdaArgumentType.kt");
}
@Test
@TestMetadata("receiverWithCapturedType.kt")
public void testReceiverWithCapturedType() throws Exception {