[LL FIR] dependent analyze: add test on different statements in script
It contains a wrong result. Will be fixed in the next commit ^KT-60987
This commit is contained in:
committed by
Space Team
parent
201100db60
commit
4f4b30ee28
+40
@@ -0,0 +1,40 @@
|
||||
Tower Data Context:
|
||||
Element 0
|
||||
Scope: FirDefaultStarImportingScope
|
||||
Element 1
|
||||
Scope: FirDefaultSimpleImportingScope
|
||||
Element 2
|
||||
Scope: FirExplicitStarImportingScope
|
||||
Element 3
|
||||
Scope: FirDefaultSimpleImportingScope
|
||||
Element 4
|
||||
Scope: FirDefaultSimpleImportingScope
|
||||
Element 5
|
||||
Scope: FirPackageMemberScope
|
||||
Element 6
|
||||
Scope: FirExplicitSimpleImportingScope
|
||||
Element 7
|
||||
Scope: FirScriptDeclarationsScope
|
||||
Functions
|
||||
FirNamedFunctionSymbol public? final? fun foo(i: Int, action: ( (Int) -> Unit )): R|kotlin/Unit|
|
||||
FirNamedFunctionSymbol public? final? fun foo(i: Int, action: ( (Int) -> Unit )): R|kotlin/Unit|
|
||||
FirNamedFunctionSymbol public? final? fun scriptFunction(): <implicit>
|
||||
FirNamedFunctionSymbol public? final? fun unusedScriptFunction(p: String): <implicit>
|
||||
FirNamedFunctionSymbol public? final? fun unusedScriptFunction(p: String): <implicit>
|
||||
Element 8
|
||||
Scope: FirLocalScope
|
||||
Properties:
|
||||
FirPropertySymbol lval args: R|kotlin/Array<kotlin/String>|
|
||||
Element 9
|
||||
Context receivers:
|
||||
FirScriptSymbol context(<script>@R|kotlin/script/templates/standard/ScriptTemplateWithArgs|)
|
||||
SCRIPT:
|
||||
lval args: R|kotlin/Array<kotlin/String>|
|
||||
|
||||
public? final? fun scriptFunction(): <implicit>
|
||||
public? final? fun unusedScriptFunction(p: String): <implicit>
|
||||
public? final? fun unusedScriptFunction(p: String): <implicit>
|
||||
public? final? fun foo(i: Int, action: ( (Int) -> Unit )): R|kotlin/Unit|
|
||||
public? final? fun foo(i: Int, action: ( (Int) -> Unit )): R|kotlin/Unit|
|
||||
Type: kotlin/script/templates/standard/ScriptTemplateWithArgs
|
||||
Label: <script>
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// LOOK_UP_FOR_ELEMENT_OF_TYPE: KtScript
|
||||
|
||||
fun scriptFunction() = 42
|
||||
scriptFunction()
|
||||
|
||||
fun unusedScriptFunction(p: String) = 22
|
||||
|
||||
scriptFunction()
|
||||
|
||||
fun foo(i: Int, action: (Int) -> Unit) {
|
||||
action(i)
|
||||
}
|
||||
|
||||
foo(scriptFunction()) {
|
||||
scriptFunction()
|
||||
}
|
||||
|
||||
unusedScriptFunction("str")
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
KT element: KtScript
|
||||
FIR element: FirScriptImpl
|
||||
FIR source kind: KtRealSourceElementKind
|
||||
|
||||
FIR element rendered:
|
||||
context(<script>@R|kotlin/script/templates/standard/ScriptTemplateWithArgs|)
|
||||
SCRIPT: [ResolvedTo(BODY_RESOLVE)]
|
||||
[ResolvedTo(BODY_RESOLVE)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] fun scriptFunction(): <implicit> { LAZY_BLOCK }
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] fun unusedScriptFunction([ResolvedTo(RAW_FIR)] p: String): <implicit> { LAZY_BLOCK }
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] fun unusedScriptFunction([ResolvedTo(RAW_FIR)] p: String): <implicit> {
|
||||
^unusedScriptFunction IntegerLiteral(22)
|
||||
}
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] i: Int, [ResolvedTo(RAW_FIR)] action: ( (Int) -> Unit )): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
public? final? [ResolvedTo(RAW_FIR)] fun foo([ResolvedTo(RAW_FIR)] i: Int, [ResolvedTo(RAW_FIR)] action: ( (Int) -> Unit )): R|kotlin/Unit| {
|
||||
action#(i#)
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// LOOK_UP_FOR_ELEMENT_OF_TYPE: KtScript
|
||||
<caret>
|
||||
fun scriptFunction() = 42
|
||||
fun unusedScriptFunction(p: String) = 22
|
||||
|
||||
scriptFunction()
|
||||
|
||||
fun foo(i: Int, action: (Int) -> Unit) {
|
||||
action(i)
|
||||
}
|
||||
|
||||
foo(scriptFunction()) {
|
||||
scriptFunction()
|
||||
}
|
||||
+6
@@ -36,6 +36,12 @@ public class ScriptDependentCopyContextTestGenerated extends AbstractScriptDepen
|
||||
runTest("analysis/low-level-api-fir/testdata/dependentCopy/classScript.kts");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("moreStatementsInCopy.kts")
|
||||
public void testMoreStatementsInCopy() throws Exception {
|
||||
runTest("analysis/low-level-api-fir/testdata/dependentCopy/moreStatementsInCopy.kts");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("script.kts")
|
||||
public void testScript() throws Exception {
|
||||
|
||||
+6
@@ -36,6 +36,12 @@ public class ScriptDependentCopyFirTestGenerated extends AbstractScriptDependent
|
||||
runTest("analysis/low-level-api-fir/testdata/dependentCopy/classScript.kts");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("moreStatementsInCopy.kts")
|
||||
public void testMoreStatementsInCopy() throws Exception {
|
||||
runTest("analysis/low-level-api-fir/testdata/dependentCopy/moreStatementsInCopy.kts");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("script.kts")
|
||||
public void testScript() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user