[FIR] Approximate integer constants in lhs of callable reference

This commit is contained in:
Dmitriy Novozhilov
2020-04-14 15:57:54 +03:00
parent c71f9d9640
commit f7dc06a772
8 changed files with 40 additions and 4 deletions
@@ -0,0 +1,9 @@
fun Short.foo(): Int = 1
fun Int.foo(): Int = 2
fun testRef(f: () -> Int) {}
fun test() {
// should resolve to Int.foo
testRef(1::foo)
}
@@ -0,0 +1,12 @@
FILE: integerLiteralInLhs.kt
public final fun R|kotlin/Short|.foo(): R|kotlin/Int| {
^foo Int(1)
}
public final fun R|kotlin/Int|.foo(): R|kotlin/Int| {
^foo Int(2)
}
public final fun testRef(f: R|() -> kotlin/Int|): R|kotlin/Unit| {
}
public final fun test(): R|kotlin/Unit| {
R|/testRef|(Int(1)::R|/foo|)
}
@@ -1637,6 +1637,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/references"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("integerLiteralInLhs.kt")
public void testIntegerLiteralInLhs() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/references/integerLiteralInLhs.kt");
}
@TestMetadata("referenceToExtension.kt")
public void testReferenceToExtension() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/references/referenceToExtension.kt");
@@ -1637,6 +1637,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/references"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
}
@TestMetadata("integerLiteralInLhs.kt")
public void testIntegerLiteralInLhs() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/references/integerLiteralInLhs.kt");
}
@TestMetadata("referenceToExtension.kt")
public void testReferenceToExtension() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/references/referenceToExtension.kt");