FIR IDE: render resolve phase for lazy resolve tests

This commit is contained in:
Ilya Kirillov
2020-10-13 22:55:28 +03:00
parent 9c53c66bb5
commit 2f093e76b0
13 changed files with 35 additions and 36 deletions
@@ -8,11 +8,11 @@ FILE: classMembers.kt
this@R|/A|.R|/A.receive|(this@R|/A|.R|/A.functionWithLazyBody|())
}
public final [STATUS] val x: R|kotlin/Int| = LAZY_EXPRESSION
public final [CONTRACTS] val x: R|kotlin/Int| = LAZY_EXPRESSION
public get(): R|kotlin/Int| { LAZY_BLOCK }
public final [STATUS] fun receive(value: R|kotlin/String|): R|kotlin/Unit| { LAZY_BLOCK }
public final [CONTRACTS] fun receive(value: R|kotlin/String|): R|kotlin/Unit| { LAZY_BLOCK }
public final [STATUS] fun functionWithLazyBody(): R|kotlin/String| { LAZY_BLOCK }
public final [CONTRACTS] fun functionWithLazyBody(): R|kotlin/String| { LAZY_BLOCK }
}
@@ -1,11 +1,11 @@
FILE: main.kt
public final fun R|Y|.test(): R|kotlin/String?| {
lval a: R|kotlin/Int| = when (this@R|/test|) {
($subj$ is R|F|) -> {
Int(1)
public? final? fun Y.test(): String? {
lval a: <implicit> = when (this#) {
($subj$ is F) -> {
IntegerLiteral(1)
}
($subj$ is R|G|) -> {
Int(2)
($subj$ is G) -> {
IntegerLiteral(2)
}
else -> {
^test Null(null)
@@ -13,6 +13,7 @@ import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.search.FileTypeIndex
import com.intellij.testFramework.LightProjectDescriptor
import junit.framework.TestCase
import org.jetbrains.kotlin.fir.FirRenderer
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
import org.jetbrains.kotlin.fir.declarations.FirResolvedImport
import org.jetbrains.kotlin.fir.render
@@ -82,7 +83,7 @@ abstract class AbstractFirLazyResolveTest : KotlinLightCodeInsightFixtureTestCas
append(name)
}
}
else -> firElement.render()
else -> firElement.render(FirRenderer.RenderMode.WithResolvePhases)
}
KotlinTestUtils.assertEqualsToFile(File(testFile.parent, "results.txt"), resultsDump)
@@ -106,7 +107,7 @@ abstract class AbstractFirLazyResolveTest : KotlinLightCodeInsightFixtureTestCas
val session = resolveState.rootModuleSession
val firProvider = session.firIdeProvider
val firFile = firProvider.cache.getCachedFirFile(psiFile) ?: continue
KotlinTestUtils.assertEqualsToFile(File(expectedTxtPath(file)), firFile.render())
KotlinTestUtils.assertEqualsToFile(File(expectedTxtPath(file)), firFile.render(FirRenderer.RenderMode.WithResolvePhases))
}
}
}
+3 -3
View File
@@ -1,13 +1,13 @@
FILE: main.kt
public final class WithElvis : R|kotlin/Any| {
public final [BODY_RESOLVE] class WithElvis : R|kotlin/Any| {
public constructor(value: R|kotlin/String?|): R|elvis/WithElvis| {
super<R|kotlin/Any|>()
}
public final val value: R|kotlin/String?| = R|<local>/value|
public final [CONTRACTS] val value: R|kotlin/String?| = R|<local>/value|
public get(): R|kotlin/String?|
public final fun foo(): R|kotlin/String| {
public final [BODY_RESOLVE] fun foo(): R|kotlin/String| {
^foo this@R|elvis/WithElvis|.R|elvis/WithElvis.value| ?: String()
}
+2 -2
View File
@@ -1,4 +1,4 @@
FILE: main.kt
public final fun foofoo(): R|kotlin/Int| {
^foofoo R|bar/barbar|()
public? final? [RAW_FIR] fun foofoo(): Int {
^foofoo barbar#()
}
+2 -2
View File
@@ -1,10 +1,10 @@
FILE: main.kt
public final class Foo : R|kotlin/Any| {
public final [BODY_RESOLVE] class Foo : R|kotlin/Any| {
public constructor(): R|Foo| {
super<R|kotlin/Any|>()
}
public final val x: R|kotlin/Int|
public final [BODY_RESOLVE] val x: R|kotlin/Int|
public get(): R|kotlin/Int|
init {
+4 -4
View File
@@ -1,12 +1,12 @@
FILE: main.kt
public final fun main(): R|kotlin/Unit| {
local final fun foo(): R|kotlin/Int| {
public final [BODY_RESOLVE] fun main(): R|kotlin/Unit| {
local final [BODY_RESOLVE] fun foo(): R|kotlin/Int| {
^foo R|main/bar|()
}
R|<local>/foo|()
}
public final fun bar(): R|kotlin/Int| {
lval x: <implicit> = IntegerLiteral(4)
public final [STATUS] fun bar(): R|kotlin/Int| {
[RAW_FIR] lval x: <implicit> = IntegerLiteral(4)
^bar IntegerLiteral(9).times#(x#)
}
+2 -2
View File
@@ -1,6 +1,6 @@
FILE: main.kt
public final class Foo : R|kotlin/Any| {
public final val x: R|kotlin/Int|
public final [BODY_RESOLVE] class Foo : R|kotlin/Any| {
public final [CONTRACTS] val x: R|kotlin/Int|
public get(): R|kotlin/Int|
public constructor(): R|Foo| {
+2 -2
View File
@@ -1,10 +1,10 @@
FILE: main.kt
public final class My : R|kotlin/Any| {
public final [STATUS] class My : R|kotlin/Any| {
public constructor(): R|My| {
super<R|kotlin/Any|>()
}
}
public final fun foo(): R|My| {
public final [BODY_RESOLVE] fun foo(): R|My| {
^foo R|/My.My|()
}
+2 -4
View File
@@ -1,7 +1,5 @@
FILE: callMe.kt
public final fun callMe(): R|kotlin/Int| {
public final [IMPLICIT_TYPES_BODY_RESOLVE] fun callMe(): R|kotlin/Int| {
^callMe Int(42)
}
public final fun other(): R|kotlin/Unit| {
lval x: <implicit> = IntegerLiteral(1)
}
public final [STATUS] fun other(): R|kotlin/Unit| { LAZY_BLOCK }
+4 -4
View File
@@ -1,12 +1,12 @@
FILE: main.kt
public final fun main(): R|kotlin/Unit| {
public final [BODY_RESOLVE] fun main(): R|kotlin/Unit| {
R|/callMe|()
R|/foo|()
R|/bar|(Int(1), Int(2))
}
public final fun foo(): R|kotlin/Unit| {
lval y: <implicit> = Double(2.0)
public final [STATUS] fun foo(): R|kotlin/Unit| {
[RAW_FIR] lval y: <implicit> = Double(2.0)
}
public final fun bar(x: R|kotlin/Int|, y: R|kotlin/Int|): R|kotlin/Int| {
public final [IMPLICIT_TYPES_BODY_RESOLVE] fun bar(x: R|kotlin/Int|, y: R|kotlin/Int|): R|kotlin/Int| {
^bar R|<local>/x|.R|kotlin/Int.plus|(R|<local>/y|)
}
+1 -1
View File
@@ -1,4 +1,4 @@
FILE: main.kt
public final fun foo(): R|kotlin/Int| {
public final [BODY_RESOLVE] fun foo(): R|kotlin/Int| {
^foo R|root/myProperty|
}
@@ -1,5 +1,5 @@
FILE: myProperty.kt
public final val myProperty: R|kotlin/Int|
public final [IMPLICIT_TYPES_BODY_RESOLVE] val myProperty: R|kotlin/Int|
public get(): R|kotlin/Int| {
^ Int(42)
}