[LL FIR] do not create lazy bodies during on-air resolve in scripts
We assume that on-air resolve already has normal bodies, so depending on this fact, we can omit some redundant work ^KT-61026 Fixed
This commit is contained in:
committed by
Space Team
parent
601ffb2db4
commit
734a3e5716
+6
@@ -46,6 +46,12 @@ public class FirIdeNormalAnalysisSourceModuleReferenceShortenerForWholeFileTestG
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/referenceShortenerWholeFile"), Pattern.compile("^(.+)\\.(kt|kts)$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callInsideScriptExpression.kts")
|
||||
public void testCallInsideScriptExpression() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortenerWholeFile/callInsideScriptExpression.kts");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("fileWithKDoc.kt")
|
||||
public void testFileWithKDoc() throws Exception {
|
||||
|
||||
+9
-3
@@ -43,7 +43,7 @@ public class FirIdeNormalAnalysisSourceModuleReferenceShortenerTestGenerated ext
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInReferenceShortener() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/referenceShortener"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/referenceShortener"), Pattern.compile("^(.+)\\.(kt|kts)$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -52,6 +52,12 @@ public class FirIdeNormalAnalysisSourceModuleReferenceShortenerTestGenerated ext
|
||||
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/annotaiton.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callInsideScriptExpression.kts")
|
||||
public void testCallInsideScriptExpression() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/callInsideScriptExpression.kts");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableFromDefaultImport.kt")
|
||||
public void testCallableFromDefaultImport() throws Exception {
|
||||
@@ -460,7 +466,7 @@ public class FirIdeNormalAnalysisSourceModuleReferenceShortenerTestGenerated ext
|
||||
public class NestedClasses {
|
||||
@Test
|
||||
public void testAllFilesPresentInNestedClasses() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/nestedClasses"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/nestedClasses"), Pattern.compile("^(.+)\\.(kt|kts)$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -505,7 +511,7 @@ public class FirIdeNormalAnalysisSourceModuleReferenceShortenerTestGenerated ext
|
||||
public class ClassHeaderPositions {
|
||||
@Test
|
||||
public void testAllFilesPresentInClassHeaderPositions() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/nestedClasses/classHeaderPositions"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/nestedClasses/classHeaderPositions"), Pattern.compile("^(.+)\\.(kt|kts)$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+6
@@ -46,6 +46,12 @@ public class FirStandaloneNormalAnalysisSourceModuleReferenceShortenerForWholeFi
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/referenceShortenerWholeFile"), Pattern.compile("^(.+)\\.(kt|kts)$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callInsideScriptExpression.kts")
|
||||
public void testCallInsideScriptExpression() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortenerWholeFile/callInsideScriptExpression.kts");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("fileWithKDoc.kt")
|
||||
public void testFileWithKDoc() throws Exception {
|
||||
|
||||
+9
-3
@@ -43,7 +43,7 @@ public class FirStandaloneNormalAnalysisSourceModuleReferenceShortenerTestGenera
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInReferenceShortener() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/referenceShortener"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/referenceShortener"), Pattern.compile("^(.+)\\.(kt|kts)$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -52,6 +52,12 @@ public class FirStandaloneNormalAnalysisSourceModuleReferenceShortenerTestGenera
|
||||
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/annotaiton.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callInsideScriptExpression.kts")
|
||||
public void testCallInsideScriptExpression() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/callInsideScriptExpression.kts");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableFromDefaultImport.kt")
|
||||
public void testCallableFromDefaultImport() throws Exception {
|
||||
@@ -460,7 +466,7 @@ public class FirStandaloneNormalAnalysisSourceModuleReferenceShortenerTestGenera
|
||||
public class NestedClasses {
|
||||
@Test
|
||||
public void testAllFilesPresentInNestedClasses() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/nestedClasses"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/nestedClasses"), Pattern.compile("^(.+)\\.(kt|kts)$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -505,7 +511,7 @@ public class FirStandaloneNormalAnalysisSourceModuleReferenceShortenerTestGenera
|
||||
public class ClassHeaderPositions {
|
||||
@Test
|
||||
public void testAllFilesPresentInClassHeaderPositions() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/nestedClasses/classHeaderPositions"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/referenceShortener/nestedClasses/classHeaderPositions"), Pattern.compile("^(.+)\\.(kt|kts)$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package one
|
||||
|
||||
class A
|
||||
class B
|
||||
|
||||
fun foo(a: () -> Unit) {
|
||||
|
||||
}
|
||||
|
||||
foo {
|
||||
<expr>one.A</expr>
|
||||
}
|
||||
|
||||
foo {
|
||||
one.B
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
Before shortening: one.A
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] one.A
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] one.A
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package one
|
||||
|
||||
class A
|
||||
class B
|
||||
|
||||
fun foo(a: () -> Unit) {
|
||||
|
||||
}
|
||||
|
||||
foo {
|
||||
one.A
|
||||
}
|
||||
|
||||
foo {
|
||||
one.B
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[qualifier] one.A
|
||||
[qualifier] one.B
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[qualifier] one.A
|
||||
[qualifier] one.B
|
||||
+1
-1
@@ -47,7 +47,7 @@ internal class RawFirNonLocalDeclarationBuilder private constructor(
|
||||
scopeProvider: FirScopeProvider,
|
||||
file: KtFile,
|
||||
): FirFile {
|
||||
val builder = PsiRawFirBuilder(session, scopeProvider, bodyBuildingMode = BodyBuildingMode.LAZY_BODIES)
|
||||
val builder = PsiRawFirBuilder(session, scopeProvider, bodyBuildingMode = BodyBuildingMode.NORMAL)
|
||||
return builder.buildFirFile(file)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -249,7 +249,7 @@ private fun AnalysisApiTestGroup.generateAnalysisApiComponentsTests() {
|
||||
|
||||
component("referenceShortener", filter = frontendIs(FrontendKind.Fir) and analysisSessionModeIs(AnalysisSessionMode.Normal)) {
|
||||
test(AbstractReferenceShortenerTest::class) {
|
||||
model("referenceShortener")
|
||||
model("referenceShortener", pattern = TestGeneratorUtil.KT_OR_KTS)
|
||||
}
|
||||
test(AbstractReferenceShortenerForWholeFileTest::class) {
|
||||
model("referenceShortenerWholeFile", pattern = TestGeneratorUtil.KT_OR_KTS)
|
||||
|
||||
Reference in New Issue
Block a user