[FIR-TEST] Add test with calling constructor of type with aliased import

This commit is contained in:
Dmitriy Novozhilov
2019-11-14 16:30:52 +03:00
parent d9fe70f97c
commit 944be132de
3 changed files with 45 additions and 0 deletions
@@ -0,0 +1,21 @@
// FILE: A.kt
package foo
class A {
fun foo() {}
}
// FILE: main.kt
import foo.A as B
fun test_1() {
val a = <!UNRESOLVED_REFERENCE!>A<!>()
val b = <!UNRESOLVED_REFERENCE!>B<!>() // should be OK
val c: B = <!UNRESOLVED_REFERENCE!>A<!>()
}
fun test_2(b: B) {
b.foo()
}
@@ -0,0 +1,19 @@
FILE: A.kt
public final class A : R|kotlin/Any| {
public constructor(): R|foo/A| {
super<R|kotlin/Any|>()
}
public final fun foo(): R|kotlin/Unit| {
}
}
FILE: main.kt
public final fun test_1(): R|kotlin/Unit| {
lval a: <ERROR TYPE REF: Unresolved name: A> = <Unresolved name: A>#()
lval b: <ERROR TYPE REF: Unresolved name: B> = <Unresolved name: B>#()
lval c: R|foo/A| = <Unresolved name: A>#()
}
public final fun test_2(b: R|foo/A|): R|kotlin/Unit| {
R|<local>/b|.R|foo/A.foo|()
}
@@ -783,6 +783,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/fir/resolve/testData/resolve/problems"), Pattern.compile("^([^.]+)\\.kt$"), true);
}
@TestMetadata("asImports.kt")
public void testAsImports() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/asImports.kt");
}
@TestMetadata("javaAccessorConversion.kt")
public void testJavaAccessorConversion() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/javaAccessorConversion.kt");