FIR resolution API: fix handling of expressions inside secondary ctors

This commit is contained in:
Mikhail Glukhikh
2019-07-30 11:23:49 +03:00
parent 2a69efba8a
commit 1f771a2407
14 changed files with 84 additions and 1 deletions
@@ -51,7 +51,7 @@ private fun FirFile.findCallableMember(
ProcessorAction.NEXT
}
}
if (callableMember is KtNamedFunction) {
if (callableMember is KtNamedFunction || callableMember is KtConstructor<*>) {
memberScope.processFunctionsByName(declName, processor)
} else {
memberScope.processPropertiesByName(declName, processor)
+3
View File
@@ -0,0 +1,3 @@
{
"mainFile": "main.kt"
}
+7
View File
@@ -0,0 +1,7 @@
class Foo {
val x: Int
init {
<caret>x = 42
}
}
+14
View File
@@ -0,0 +1,14 @@
FILE: main.kt
public final class Foo : R|kotlin/Any| {
public constructor(): R|Foo| {
super<R|kotlin/Any|>()
}
public final val x: R|kotlin/Int|
public get(): R|kotlin/Int|
init {
R|/Foo.x| = Int(42)
}
}
+1
View File
@@ -0,0 +1 @@
R|/Foo.x| = Int(42)
@@ -0,0 +1,3 @@
{
"mainFile": "main.kt"
}
+7
View File
@@ -0,0 +1,7 @@
class Foo {
val x: Int
constructor() {
<caret>x = 42
}
}
+11
View File
@@ -0,0 +1,11 @@
FILE: main.kt
public final class Foo : R|kotlin/Any| {
public final val x: R|kotlin/Int|
public get(): R|kotlin/Int|
public constructor(): R|Foo| {
super<R|kotlin/Any|>()
R|/Foo.x| = Int(42)
}
}
+1
View File
@@ -0,0 +1 @@
R|/Foo.x| = Int(42)
+7
View File
@@ -0,0 +1,7 @@
class My {
constructor()
}
fun foo(): My {
return <caret>My()
}
+10
View File
@@ -0,0 +1,10 @@
FILE: main.kt
public final class My : R|kotlin/Any| {
public constructor(): R|My| {
super<R|kotlin/Any|>()
}
}
public final fun foo(): R|My| {
^foo R|/My.My|()
}
+1
View File
@@ -0,0 +1 @@
R|/My.My|()
@@ -0,0 +1,3 @@
{
"mainFile": "main.kt"
}
@@ -29,11 +29,26 @@ public class FirLazyResolveTestGenerated extends AbstractFirLazyResolveTest {
KotlinTestUtils.assertAllTestsPresentInSingleGeneratedClass(this.getClass(), new File("idea/testData/fir/lazyResolve"), Pattern.compile("^(.+)\\.test$"), TargetBackend.ANY);
}
@TestMetadata("inInit/inInit.test")
public void testInInit_InInit() throws Exception {
runTest("idea/testData/fir/lazyResolve/inInit/inInit.test");
}
@TestMetadata("inLocal/inLocal.test")
public void testInLocal_InLocal() throws Exception {
runTest("idea/testData/fir/lazyResolve/inLocal/inLocal.test");
}
@TestMetadata("inSecondary/inSecondary.test")
public void testInSecondary_InSecondary() throws Exception {
runTest("idea/testData/fir/lazyResolve/inSecondary/inSecondary.test");
}
@TestMetadata("secondary/secondary.test")
public void testSecondary_Secondary() throws Exception {
runTest("idea/testData/fir/lazyResolve/secondary/secondary.test");
}
@TestMetadata("simple/simple.test")
public void testSimple_Simple() throws Exception {
runTest("idea/testData/fir/lazyResolve/simple/simple.test");