[FIR-TEST] Add test with callable reference on function with default argument

This commit is contained in:
Dmitriy Novozhilov
2020-02-14 14:32:31 +03:00
parent 3790f31d80
commit 1a2d28d25b
4 changed files with 34 additions and 0 deletions
@@ -0,0 +1,9 @@
class A {
fun foo(s: String, flag: Boolean = true) {}
}
inline fun <T> T.myLet(block: (T) -> Unit) {}
fun test(a: A, s: String) {
s.<!INAPPLICABLE_CANDIDATE!>myLet<!>(a::foo)
}
@@ -0,0 +1,15 @@
FILE: callableReferencesAndDefaultParameters.kt
public final class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
public final fun foo(s: R|kotlin/String|, flag: R|kotlin/Boolean| = Boolean(true)): R|kotlin/Unit| {
}
}
public final inline fun <T> R|T|.myLet(block: R|(T) -> kotlin/Unit|): R|kotlin/Unit| {
}
public final fun test(a: R|A|, s: R|kotlin/String|): R|kotlin/Unit| {
R|<local>/s|.<Inapplicable(INAPPLICABLE): [/myLet]>#(R|<local>/a|::R|/A.foo|)
}
@@ -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("callableReferencesAndDefaultParameters.kt")
public void testCallableReferencesAndDefaultParameters() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/callableReferencesAndDefaultParameters.kt");
}
@TestMetadata("covariantArrayAsReceiver.kt")
public void testCovariantArrayAsReceiver() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/covariantArrayAsReceiver.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("callableReferencesAndDefaultParameters.kt")
public void testCallableReferencesAndDefaultParameters() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/callableReferencesAndDefaultParameters.kt");
}
@TestMetadata("covariantArrayAsReceiver.kt")
public void testCovariantArrayAsReceiver() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/covariantArrayAsReceiver.kt");