[FIR-TEST] Add test with callable reference to member of local class

#KT-36758
This commit is contained in:
Dmitriy Novozhilov
2020-02-17 11:46:31 +03:00
parent d10e56c358
commit e67c8a55bf
4 changed files with 35 additions and 0 deletions
@@ -0,0 +1,7 @@
fun <T, R> List<T>.myMap(block: (T) -> R): List<R> = null!!
fun test_1() {
class Data(val x: Int)
val datas: List<Data> = null!!
val xs = datas.<!INAPPLICABLE_CANDIDATE!>myMap<!>(<!UNRESOLVED_REFERENCE!>Data::x<!>)
}
@@ -0,0 +1,18 @@
FILE: callableReferenceToLocalClass.kt
public final fun <T, R> R|kotlin/collections/List<T>|.myMap(block: R|(T) -> R|): R|kotlin/collections/List<R>| {
^myMap Null(null)!!
}
public final fun test_1(): R|kotlin/Unit| {
local final class Data : R|kotlin/Any| {
public constructor(x: R|kotlin/Int|): R|Data| {
super<R|kotlin/Any|>()
}
public final val x: R|kotlin/Int| = R|<local>/x|
public get(): R|kotlin/Int|
}
lval datas: R|kotlin/collections/List<Data>| = Null(null)!!
lval xs: <ERROR TYPE REF: Inapplicable(INAPPLICABLE): [/myMap]> = R|<local>/datas|.<Inapplicable(INAPPLICABLE): [/myMap]>#(Q|Data|::<Unresolved name: x>#)
}
@@ -1269,6 +1269,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/problems"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("callableReferenceToLocalClass.kt")
public void testCallableReferenceToLocalClass() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/callableReferenceToLocalClass.kt");
}
@TestMetadata("callableReferencesAndDefaultParameters.kt")
public void testCallableReferencesAndDefaultParameters() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/callableReferencesAndDefaultParameters.kt");
@@ -1269,6 +1269,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/problems"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("callableReferenceToLocalClass.kt")
public void testCallableReferenceToLocalClass() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/callableReferenceToLocalClass.kt");
}
@TestMetadata("callableReferencesAndDefaultParameters.kt")
public void testCallableReferencesAndDefaultParameters() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/callableReferencesAndDefaultParameters.kt");