[LL FIR] add more tests for script initializer
^KT-65344
This commit is contained in:
committed by
Space Team
parent
08332fdc6e
commit
f972c8d239
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
// LOOK_UP_FOR_ELEMENT_OF_TYPE: KtScriptInitializer
|
||||||
|
fun foo() = 24
|
||||||
|
<expr>foo()</expr>
|
||||||
Vendored
+28
@@ -0,0 +1,28 @@
|
|||||||
|
KT element: KtScriptInitializer
|
||||||
|
FIR element: FirScriptImpl
|
||||||
|
FIR source kind: KtRealSourceElementKind
|
||||||
|
|
||||||
|
FIR element rendered:
|
||||||
|
context(<script>@R|kotlin/script/templates/standard/ScriptTemplateWithArgs|)
|
||||||
|
SCRIPT: [ResolvedTo(BODY_RESOLVE)] <script-syntheticResultDeclarationInitializer.kts>
|
||||||
|
[ResolvedTo(BODY_RESOLVE)] lval args: R|kotlin/Array<kotlin/String>|
|
||||||
|
|
||||||
|
public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] fun foo(): R|kotlin/Int| {
|
||||||
|
^foo Int(24)
|
||||||
|
}
|
||||||
|
|
||||||
|
public final [ResolvedTo(BODY_RESOLVE)] val $$result: R|kotlin/Int| = R|/foo|()
|
||||||
|
public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int|
|
||||||
|
|
||||||
|
FIR FILE:
|
||||||
|
FILE: [ResolvedTo(IMPORTS)] syntheticResultDeclarationInitializer.kts
|
||||||
|
context(<script>@R|kotlin/script/templates/standard/ScriptTemplateWithArgs|)
|
||||||
|
SCRIPT: [ResolvedTo(BODY_RESOLVE)] <script-syntheticResultDeclarationInitializer.kts>
|
||||||
|
[ResolvedTo(BODY_RESOLVE)] lval args: R|kotlin/Array<kotlin/String>|
|
||||||
|
|
||||||
|
public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] fun foo(): R|kotlin/Int| {
|
||||||
|
^foo Int(24)
|
||||||
|
}
|
||||||
|
|
||||||
|
public final [ResolvedTo(BODY_RESOLVE)] val $$result: R|kotlin/Int| = R|/foo|()
|
||||||
|
public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/Int|
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
// LOOK_UP_FOR_ELEMENT_OF_TYPE: KtScriptInitializer
|
||||||
|
fun foo() = 4
|
||||||
|
|
||||||
|
<expr>foo()</expr>
|
||||||
|
bar()
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
|
||||||
|
}
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
KT element: KtScriptInitializer
|
||||||
|
FIR element: FirAnonymousInitializerImpl
|
||||||
|
FIR source kind: KtRealSourceElementKind
|
||||||
|
|
||||||
|
FIR element rendered:
|
||||||
|
[ResolvedTo(BODY_RESOLVE)] init {
|
||||||
|
R|/foo|()
|
||||||
|
}
|
||||||
|
|
||||||
|
FIR FILE:
|
||||||
|
FILE: [ResolvedTo(IMPORTS)] firstStatement.kts
|
||||||
|
context(<script>@R|kotlin/script/templates/standard/ScriptTemplateWithArgs|)
|
||||||
|
SCRIPT: [ResolvedTo(BODY_RESOLVE)] <script-firstStatement.kts>
|
||||||
|
[ResolvedTo(BODY_RESOLVE)] lval args: R|kotlin/Array<kotlin/String>|
|
||||||
|
|
||||||
|
public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] fun foo(): R|kotlin/Int| {
|
||||||
|
^foo Int(4)
|
||||||
|
}
|
||||||
|
|
||||||
|
[ResolvedTo(BODY_RESOLVE)] init {
|
||||||
|
R|/foo|()
|
||||||
|
}
|
||||||
|
|
||||||
|
[ResolvedTo(BODY_RESOLVE)] init {
|
||||||
|
R|/bar|()
|
||||||
|
}
|
||||||
|
|
||||||
|
public final [ResolvedTo(CONTRACTS)] fun bar(): R|kotlin/Unit| {
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
// LOOK_UP_FOR_ELEMENT_OF_TYPE: KtCallExpression
|
||||||
|
fun foo() = 4
|
||||||
|
|
||||||
|
<expr>foo()</expr>
|
||||||
|
bar()
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
|
||||||
|
}
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
KT element: KtCallExpression
|
||||||
|
FIR element: FirFunctionCallImpl
|
||||||
|
FIR source kind: KtRealSourceElementKind
|
||||||
|
|
||||||
|
FIR element rendered:
|
||||||
|
R|/foo|()
|
||||||
|
|
||||||
|
FIR FILE:
|
||||||
|
FILE: [ResolvedTo(IMPORTS)] firstStatementCall.kts
|
||||||
|
context(<script>@R|kotlin/script/templates/standard/ScriptTemplateWithArgs|)
|
||||||
|
SCRIPT: [ResolvedTo(BODY_RESOLVE)] <script-firstStatementCall.kts>
|
||||||
|
[ResolvedTo(BODY_RESOLVE)] lval args: R|kotlin/Array<kotlin/String>|
|
||||||
|
|
||||||
|
public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] fun foo(): R|kotlin/Int| {
|
||||||
|
^foo Int(4)
|
||||||
|
}
|
||||||
|
|
||||||
|
[ResolvedTo(BODY_RESOLVE)] init {
|
||||||
|
R|/foo|()
|
||||||
|
}
|
||||||
|
|
||||||
|
[ResolvedTo(BODY_RESOLVE)] init {
|
||||||
|
R|/bar|()
|
||||||
|
}
|
||||||
|
|
||||||
|
public final [ResolvedTo(CONTRACTS)] fun bar(): R|kotlin/Unit| {
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
// LOOK_UP_FOR_ELEMENT_OF_TYPE: KtScriptInitializer
|
||||||
|
fun foo() = 4
|
||||||
|
|
||||||
|
foo()
|
||||||
|
<expr>bar()</expr>
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
|
||||||
|
}
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
KT element: KtScriptInitializer
|
||||||
|
FIR element: FirAnonymousInitializerImpl
|
||||||
|
FIR source kind: KtRealSourceElementKind
|
||||||
|
|
||||||
|
FIR element rendered:
|
||||||
|
[ResolvedTo(BODY_RESOLVE)] init {
|
||||||
|
R|/bar|()
|
||||||
|
}
|
||||||
|
|
||||||
|
FIR FILE:
|
||||||
|
FILE: [ResolvedTo(IMPORTS)] secondStatement.kts
|
||||||
|
context(<script>@R|kotlin/script/templates/standard/ScriptTemplateWithArgs|)
|
||||||
|
SCRIPT: [ResolvedTo(BODY_RESOLVE)] <script-secondStatement.kts>
|
||||||
|
[ResolvedTo(BODY_RESOLVE)] lval args: R|kotlin/Array<kotlin/String>|
|
||||||
|
|
||||||
|
public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] fun foo(): R|kotlin/Int| {
|
||||||
|
^foo Int(4)
|
||||||
|
}
|
||||||
|
|
||||||
|
[ResolvedTo(BODY_RESOLVE)] init {
|
||||||
|
R|/foo|()
|
||||||
|
}
|
||||||
|
|
||||||
|
[ResolvedTo(BODY_RESOLVE)] init {
|
||||||
|
R|/bar|()
|
||||||
|
}
|
||||||
|
|
||||||
|
public final [ResolvedTo(CONTRACTS)] fun bar(): R|kotlin/Unit| {
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
// LOOK_UP_FOR_ELEMENT_OF_TYPE: KtCallExpression
|
||||||
|
fun foo() = 4
|
||||||
|
|
||||||
|
foo()
|
||||||
|
<expr>bar()</expr>
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
|
||||||
|
}
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
KT element: KtCallExpression
|
||||||
|
FIR element: FirFunctionCallImpl
|
||||||
|
FIR source kind: KtRealSourceElementKind
|
||||||
|
|
||||||
|
FIR element rendered:
|
||||||
|
R|/bar|()
|
||||||
|
|
||||||
|
FIR FILE:
|
||||||
|
FILE: [ResolvedTo(IMPORTS)] secondStatementCall.kts
|
||||||
|
context(<script>@R|kotlin/script/templates/standard/ScriptTemplateWithArgs|)
|
||||||
|
SCRIPT: [ResolvedTo(BODY_RESOLVE)] <script-secondStatementCall.kts>
|
||||||
|
[ResolvedTo(BODY_RESOLVE)] lval args: R|kotlin/Array<kotlin/String>|
|
||||||
|
|
||||||
|
public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] fun foo(): R|kotlin/Int| {
|
||||||
|
^foo Int(4)
|
||||||
|
}
|
||||||
|
|
||||||
|
[ResolvedTo(BODY_RESOLVE)] init {
|
||||||
|
R|/foo|()
|
||||||
|
}
|
||||||
|
|
||||||
|
[ResolvedTo(BODY_RESOLVE)] init {
|
||||||
|
R|/bar|()
|
||||||
|
}
|
||||||
|
|
||||||
|
public final [ResolvedTo(CONTRACTS)] fun bar(): R|kotlin/Unit| {
|
||||||
|
}
|
||||||
+30
@@ -340,6 +340,12 @@ public class ScriptGetOrBuildFirTestGenerated extends AbstractScriptGetOrBuildFi
|
|||||||
public void testSyntheticResultDeclaration() throws Exception {
|
public void testSyntheticResultDeclaration() throws Exception {
|
||||||
runTest("analysis/low-level-api-fir/testData/getOrBuildFir/calls/syntheticResultDeclaration.kts");
|
runTest("analysis/low-level-api-fir/testData/getOrBuildFir/calls/syntheticResultDeclaration.kts");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("syntheticResultDeclarationInitializer.kts")
|
||||||
|
public void testSyntheticResultDeclarationInitializer() throws Exception {
|
||||||
|
runTest("analysis/low-level-api-fir/testData/getOrBuildFir/calls/syntheticResultDeclarationInitializer.kts");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@@ -495,6 +501,18 @@ public class ScriptGetOrBuildFirTestGenerated extends AbstractScriptGetOrBuildFi
|
|||||||
runTest("analysis/low-level-api-fir/testData/getOrBuildFir/expressions/callInsideStatement.kts");
|
runTest("analysis/low-level-api-fir/testData/getOrBuildFir/expressions/callInsideStatement.kts");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("firstStatement.kts")
|
||||||
|
public void testFirstStatement() throws Exception {
|
||||||
|
runTest("analysis/low-level-api-fir/testData/getOrBuildFir/expressions/firstStatement.kts");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("firstStatementCall.kts")
|
||||||
|
public void testFirstStatementCall() throws Exception {
|
||||||
|
runTest("analysis/low-level-api-fir/testData/getOrBuildFir/expressions/firstStatementCall.kts");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("forExpressionRangeScript.kts")
|
@TestMetadata("forExpressionRangeScript.kts")
|
||||||
public void testForExpressionRangeScript() throws Exception {
|
public void testForExpressionRangeScript() throws Exception {
|
||||||
@@ -555,6 +573,18 @@ public class ScriptGetOrBuildFirTestGenerated extends AbstractScriptGetOrBuildFi
|
|||||||
runTest("analysis/low-level-api-fir/testData/getOrBuildFir/expressions/parenthesizedExpressionScript.kts");
|
runTest("analysis/low-level-api-fir/testData/getOrBuildFir/expressions/parenthesizedExpressionScript.kts");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("secondStatement.kts")
|
||||||
|
public void testSecondStatement() throws Exception {
|
||||||
|
runTest("analysis/low-level-api-fir/testData/getOrBuildFir/expressions/secondStatement.kts");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("secondStatementCall.kts")
|
||||||
|
public void testSecondStatementCall() throws Exception {
|
||||||
|
runTest("analysis/low-level-api-fir/testData/getOrBuildFir/expressions/secondStatementCall.kts");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("stringLiteralScript.kts")
|
@TestMetadata("stringLiteralScript.kts")
|
||||||
public void testStringLiteralScript() throws Exception {
|
public void testStringLiteralScript() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user