FIR IDE: restore FirLazyDeclarationResolveTest
This commit is contained in:
committed by
TeamCityServer
parent
c70629c22a
commit
61651c685c
+5
-4
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.idea.fir.frontend.api.symbols.AbstractSymbolByFqName
|
||||
import org.jetbrains.kotlin.idea.fir.frontend.api.symbols.AbstractSymbolByPsiTest
|
||||
import org.jetbrains.kotlin.idea.fir.frontend.api.symbols.AbstractSymbolByReferenceTest
|
||||
import org.jetbrains.kotlin.idea.fir.low.level.api.AbstractFirLazyBodiesCalculatorTest
|
||||
//import org.jetbrains.kotlin.idea.fir.low.level.api.AbstractFirLazyDeclarationResolveTest
|
||||
import org.jetbrains.kotlin.idea.fir.low.level.api.AbstractFirLazyDeclarationResolveTest
|
||||
import org.jetbrains.kotlin.idea.fir.low.level.api.AbstractFirOnAirResolveTest
|
||||
import org.jetbrains.kotlin.idea.fir.low.level.api.AbstractPartialRawFirBuilderTestCase
|
||||
import org.jetbrains.kotlin.idea.fir.low.level.api.diagnostic.AbstractDiagnosticTraversalCounterTest
|
||||
@@ -90,9 +90,10 @@ fun main(args: Array<String>) {
|
||||
testClass<AbstractFirOnAirResolveTest> {
|
||||
model("onAirResolve")
|
||||
}
|
||||
// testClass<AbstractFirLazyDeclarationResolveTest> {
|
||||
// model("lazyResolve")
|
||||
// }
|
||||
|
||||
testClass<AbstractFirLazyDeclarationResolveTest> {
|
||||
model("lazyResolve")
|
||||
}
|
||||
|
||||
testClass<AbstractFileStructureTest> {
|
||||
model("fileStructure")
|
||||
|
||||
@@ -32,6 +32,26 @@ dependencies {
|
||||
testCompile(project(":kotlin-test:kotlin-test-junit"))
|
||||
testApiJUnit5()
|
||||
testCompile(project(":kotlin-reflect"))
|
||||
|
||||
testRuntimeOnly(intellijDep()) {
|
||||
includeJars(
|
||||
"jps-model",
|
||||
"extensions",
|
||||
"util",
|
||||
"platform-api",
|
||||
"platform-impl",
|
||||
"idea",
|
||||
"guava",
|
||||
"trove4j",
|
||||
"asm-all",
|
||||
"log4j",
|
||||
"jdom",
|
||||
"streamex",
|
||||
"bootstrap",
|
||||
"jna",
|
||||
rootProject = rootProject
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
+13
-12
@@ -1,3 +1,4 @@
|
||||
|
||||
RAW_FIR:
|
||||
FILE: delegates.kt
|
||||
public? final? [RAW_FIR] fun resolveMe(): R|kotlin/Unit| {
|
||||
@@ -632,28 +633,28 @@ FILE: delegates.kt
|
||||
}
|
||||
public final [STATUS] [ResolvePhaseWithForAllDeclarationsKey=STATUS] fun receive([STATUS] value: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final [BODY_RESOLVE] [ResolvePhaseWithForAllDeclarationsKey=STATUS] val delegate: <ERROR TYPE REF: Symbol not found for ReadWriteProperty<R|kotlin/Any?|, R|kotlin/Int|>> = object : <ERROR TYPE REF: Symbol not found for ReadWriteProperty<R|kotlin/Any?|, R|kotlin/Int|>> {
|
||||
public final [BODY_RESOLVE] [ResolvePhaseWithForAllDeclarationsKey=STATUS] val delegate: R|kotlin/properties/ReadWriteProperty<kotlin/Any?, kotlin/Int>| = object : R|kotlin/properties/ReadWriteProperty<kotlin/Any?, kotlin/Int>| {
|
||||
private [BODY_RESOLVE] [ContainingClassKey=<anonymous>] constructor(): R|<anonymous>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final override [BODY_RESOLVE] fun getValue([BODY_RESOLVE] thisRef: R|kotlin/Any?|, [BODY_RESOLVE] property: R|kotlin/reflect/KProperty<*>|): R|kotlin/Int| {
|
||||
public final override operator [BODY_RESOLVE] fun getValue([BODY_RESOLVE] thisRef: R|kotlin/Any?|, [BODY_RESOLVE] property: R|kotlin/reflect/KProperty<*>|): R|kotlin/Int| {
|
||||
^getValue Int(1)
|
||||
}
|
||||
|
||||
public final override [BODY_RESOLVE] fun setValue([BODY_RESOLVE] thisRef: R|kotlin/Any?|, [BODY_RESOLVE] property: R|kotlin/reflect/KProperty<*>|, [BODY_RESOLVE] value: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
public final override operator [BODY_RESOLVE] fun setValue([BODY_RESOLVE] thisRef: R|kotlin/Any?|, [BODY_RESOLVE] property: R|kotlin/reflect/KProperty<*>|, [BODY_RESOLVE] value: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[BODY_RESOLVE] public get(): <ERROR TYPE REF: Symbol not found for ReadWriteProperty<R|kotlin/Any?|, R|kotlin/Int|>>
|
||||
[BODY_RESOLVE] public get(): R|kotlin/properties/ReadWriteProperty<kotlin/Any?, kotlin/Int>|
|
||||
public final [STATUS] [ResolvePhaseWithForAllDeclarationsKey=STATUS] val valueWithExplicitType: R|kotlin/Int|by delegate#
|
||||
[STATUS] public get(): <implicit> {
|
||||
^ D|/valueWithExplicitType|.getValue#(Null(null), ::R|/valueWithExplicitType|)
|
||||
}
|
||||
public final [BODY_RESOLVE] [ResolvePhaseWithForAllDeclarationsKey=STATUS] val valueWithImplicitType: <ERROR TYPE REF: Unresolved name: getValue>by R|/delegate|
|
||||
[BODY_RESOLVE] public get(): <ERROR TYPE REF: Unresolved name: getValue> {
|
||||
^ D|/valueWithImplicitType|.<Unresolved name: getValue>#(Null(null), ::R|/valueWithImplicitType|)
|
||||
public final [BODY_RESOLVE] [ResolvePhaseWithForAllDeclarationsKey=STATUS] val valueWithImplicitType: R|kotlin/Int|by R|/delegate|
|
||||
[BODY_RESOLVE] public get(): R|kotlin/Int| {
|
||||
^ D|/valueWithImplicitType|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.getValue: R|kotlin/Int|>|(Null(null), ::R|/valueWithImplicitType|)
|
||||
}
|
||||
public final [STATUS] [ResolvePhaseWithForAllDeclarationsKey=STATUS] var variableWithExplicitType: R|kotlin/Int|by delegate#
|
||||
[STATUS] public get(): <implicit> {
|
||||
@@ -902,10 +903,10 @@ FILE: delegates.kt
|
||||
[BODY_RESOLVE] public set([BODY_RESOLVE] <set-?>: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
D|/variableWithExplicitType|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.setValue: R|kotlin/Unit|>|(Null(null), ::R|/variableWithExplicitType|, R|<local>/variableWithExplicitType|)
|
||||
}
|
||||
public final [BODY_RESOLVE] [ResolvePhaseWithForAllDeclarationsKey=BODY_RESOLVE] var variableWithImplicitType: <ERROR TYPE REF: Unresolved name: getValue>by R|/delegate|
|
||||
[BODY_RESOLVE] public get(): <ERROR TYPE REF: Unresolved name: getValue> {
|
||||
^ D|/variableWithImplicitType|.<Unresolved name: getValue>#(Null(null), ::R|/variableWithImplicitType|)
|
||||
public final [BODY_RESOLVE] [ResolvePhaseWithForAllDeclarationsKey=BODY_RESOLVE] var variableWithImplicitType: R|kotlin/Int|by R|/delegate|
|
||||
[BODY_RESOLVE] public get(): R|kotlin/Int| {
|
||||
^ D|/variableWithImplicitType|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.getValue: R|kotlin/Int|>|(Null(null), ::R|/variableWithImplicitType|)
|
||||
}
|
||||
[BODY_RESOLVE] public set([BODY_RESOLVE] <set-?>: <ERROR TYPE REF: Unresolved name: getValue>): R|kotlin/Unit| {
|
||||
D|/variableWithImplicitType|.<Unresolved name: setValue>#(Null(null), ::R|/variableWithImplicitType|, R|<local>/variableWithImplicitType|)
|
||||
[BODY_RESOLVE] public set([BODY_RESOLVE] <set-?>: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
D|/variableWithImplicitType|.R|SubstitutionOverride<kotlin/properties/ReadWriteProperty.setValue: R|kotlin/Unit|>|(Null(null), ::R|/variableWithImplicitType|, R|<local>/variableWithImplicitType|)
|
||||
}
|
||||
|
||||
+110
-112
@@ -1,112 +1,110 @@
|
||||
///*
|
||||
// * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
// * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
// */
|
||||
//
|
||||
//package org.jetbrains.kotlin.idea.fir.low.level.api
|
||||
//
|
||||
//import com.intellij.openapi.util.io.FileUtil
|
||||
//import com.intellij.testFramework.LightProjectDescriptor
|
||||
//import org.jetbrains.kotlin.fir.*
|
||||
//import org.jetbrains.kotlin.fir.declarations.*
|
||||
//import org.jetbrains.kotlin.fir.visitors.FirVisitorVoid
|
||||
//import org.jetbrains.kotlin.idea.caches.project.ModuleSourceInfo
|
||||
//import org.jetbrains.kotlin.idea.caches.project.getModuleInfo
|
||||
//import org.jetbrains.kotlin.idea.fir.low.level.api.api.withFirDeclaration
|
||||
//import org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.FirLazyDeclarationResolver
|
||||
//import org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.ResolveType
|
||||
//import org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.declarationCanBeLazilyResolved
|
||||
//import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
||||
//import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
|
||||
//import org.jetbrains.kotlin.psi.KtCallableDeclaration
|
||||
//import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
//import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
//import org.jetbrains.kotlin.psi.KtFile
|
||||
//import org.jetbrains.kotlin.psi.psiUtil.collectDescendantsOfType
|
||||
//import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
//import java.io.File
|
||||
//
|
||||
///**
|
||||
// * Test that we do not resolve declarations we do not need & do not build bodies for them
|
||||
// */
|
||||
//abstract class AbstractFirLazyDeclarationResolveTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||
// override fun isFirPlugin(): Boolean = true
|
||||
//
|
||||
// private fun FirFile.findResolveMe(): FirDeclaration {
|
||||
// val visitor = object : FirVisitorVoid() {
|
||||
// var result: FirDeclaration? = null
|
||||
// override fun visitElement(element: FirElement) {
|
||||
// if (result != null) return
|
||||
// val declaration = element.realPsi as? KtDeclaration
|
||||
// if (element is FirDeclaration && declaration != null && declaration.name == "resolveMe") {
|
||||
// result = element
|
||||
// return
|
||||
// }
|
||||
// element.acceptChildren(this)
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// accept(visitor)
|
||||
// return visitor.result ?: error("declaration with name `resolveMe` was not found")
|
||||
// }
|
||||
//
|
||||
//
|
||||
// fun doTest(path: String) {
|
||||
// val testDataFile = File(path)
|
||||
// val ktFile = myFixture.configureByText(testDataFile.name, FileUtil.loadFile(testDataFile)) as KtFile
|
||||
// val rendererOption = FirRenderer.RenderMode.WithDeclarationAttributes.copy(renderDeclarationResolvePhase = true)
|
||||
// val resultBuilder = StringBuilder()
|
||||
// resolveWithClearCaches(ktFile) { firModuleResolveState ->
|
||||
// check(firModuleResolveState is FirModuleResolveStateImpl)
|
||||
// val declarationToResolve = firModuleResolveState
|
||||
// .getOrBuildFirFile(ktFile)
|
||||
// .findResolveMe()
|
||||
// for (currentPhase in FirResolvePhase.values()) {
|
||||
// if (currentPhase.pluginPhase || currentPhase == FirResolvePhase.SEALED_CLASS_INHERITORS) continue
|
||||
// declarationToResolve.withFirDeclaration(firModuleResolveState, currentPhase) {
|
||||
// val firFile = firModuleResolveState.getOrBuildFirFile(ktFile)
|
||||
// resultBuilder.append("\n${currentPhase.name}:\n")
|
||||
// resultBuilder.append(firFile.render(rendererOption))
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// for (resolveType in ResolveType.values()) {
|
||||
// resolveWithClearCaches(ktFile) { firModuleResolveState ->
|
||||
// check(firModuleResolveState is FirModuleResolveStateImpl)
|
||||
// val declarationToResolve = firModuleResolveState
|
||||
// .getOrBuildFirFile(ktFile)
|
||||
// .findResolveMe()
|
||||
//
|
||||
// when (resolveType) {
|
||||
// ResolveType.CallableReturnType,
|
||||
// ResolveType.CallableBodyResolve,
|
||||
// ResolveType.CallableContracts -> if (declarationToResolve !is FirCallableDeclaration<*>) return@resolveWithClearCaches
|
||||
// ResolveType.ClassSuperTypes -> if (declarationToResolve !is FirClassLikeDeclaration<*>) return@resolveWithClearCaches
|
||||
// else -> {
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// declarationToResolve.withFirDeclaration(resolveType, firModuleResolveState) {
|
||||
// val firFile = firModuleResolveState.getOrBuildFirFile(ktFile)
|
||||
// resultBuilder.append("\n${resolveType.name}:\n")
|
||||
// resultBuilder.append(firFile.render(rendererOption))
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// resolveWithClearCaches(ktFile) { firModuleResolveState ->
|
||||
// check(firModuleResolveState is FirModuleResolveStateImpl)
|
||||
// val firFile = firModuleResolveState.getOrBuildFirFile(ktFile)
|
||||
// firFile.withFirDeclaration(firModuleResolveState, FirResolvePhase.BODY_RESOLVE) {
|
||||
// resultBuilder.append("\nFILE RAW TO BODY:\n")
|
||||
// resultBuilder.append(firFile.render(rendererOption))
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// val expectedFileName = testDataFile.name.replace(".kt", ".txt")
|
||||
// KotlinTestUtils.assertEqualsToFile(testDataFile.parentFile.resolve(expectedFileName), resultBuilder.toString())
|
||||
// }
|
||||
//
|
||||
// override fun getProjectDescriptor(): LightProjectDescriptor = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||
//}
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.fir.low.level.api
|
||||
|
||||
import org.jetbrains.kotlin.fir.*
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.visitors.FirVisitorVoid
|
||||
import org.jetbrains.kotlin.idea.fir.low.level.api.api.withFirDeclaration
|
||||
import org.jetbrains.kotlin.idea.fir.low.level.api.lazy.resolve.ResolveType
|
||||
import org.jetbrains.kotlin.idea.fir.low.level.api.test.base.AbstractLowLevelApiSingleFileTest
|
||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives
|
||||
import org.jetbrains.kotlin.test.services.TestModuleStructure
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import org.jetbrains.kotlin.test.services.assertions
|
||||
import org.junit.jupiter.api.parallel.Execution
|
||||
import org.junit.jupiter.api.parallel.ExecutionMode
|
||||
|
||||
/**
|
||||
* Test that we do not resolve declarations we do not need & do not build bodies for them
|
||||
*/
|
||||
@Execution(ExecutionMode.SAME_THREAD)
|
||||
abstract class AbstractFirLazyDeclarationResolveTest : AbstractLowLevelApiSingleFileTest() {
|
||||
|
||||
private fun FirFile.findResolveMe(): FirDeclaration {
|
||||
val visitor = object : FirVisitorVoid() {
|
||||
var result: FirDeclaration? = null
|
||||
override fun visitElement(element: FirElement) {
|
||||
if (result != null) return
|
||||
val declaration = element.realPsi as? KtDeclaration
|
||||
if (element is FirDeclaration && declaration != null && declaration.name == "resolveMe") {
|
||||
result = element
|
||||
return
|
||||
}
|
||||
element.acceptChildren(this)
|
||||
}
|
||||
|
||||
}
|
||||
accept(visitor)
|
||||
return visitor.result ?: error("declaration with name `resolveMe` was not found")
|
||||
}
|
||||
|
||||
override fun doTestByFileStructure(ktFile: KtFile, moduleStructure: TestModuleStructure, testServices: TestServices) {
|
||||
val rendererOption = FirRenderer.RenderMode.WithDeclarationAttributes.copy(renderDeclarationResolvePhase = true)
|
||||
val resultBuilder = StringBuilder()
|
||||
resolveWithClearCaches(ktFile) { firModuleResolveState ->
|
||||
check(firModuleResolveState is FirModuleResolveStateImpl)
|
||||
val declarationToResolve = firModuleResolveState
|
||||
.getOrBuildFirFile(ktFile)
|
||||
.findResolveMe()
|
||||
for (currentPhase in FirResolvePhase.values()) {
|
||||
if (currentPhase.pluginPhase || currentPhase == FirResolvePhase.SEALED_CLASS_INHERITORS) continue
|
||||
declarationToResolve.withFirDeclaration(firModuleResolveState, currentPhase) {
|
||||
val firFile = firModuleResolveState.getOrBuildFirFile(ktFile)
|
||||
resultBuilder.append("\n${currentPhase.name}:\n")
|
||||
resultBuilder.append(firFile.render(rendererOption))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (resolveType in ResolveType.values()) {
|
||||
resolveWithClearCaches(ktFile) { firModuleResolveState ->
|
||||
check(firModuleResolveState is FirModuleResolveStateImpl)
|
||||
val declarationToResolve = firModuleResolveState
|
||||
.getOrBuildFirFile(ktFile)
|
||||
.findResolveMe()
|
||||
|
||||
when (resolveType) {
|
||||
ResolveType.CallableReturnType,
|
||||
ResolveType.CallableBodyResolve,
|
||||
ResolveType.CallableContracts -> if (declarationToResolve !is FirCallableDeclaration<*>) return@resolveWithClearCaches
|
||||
ResolveType.ClassSuperTypes -> if (declarationToResolve !is FirClassLikeDeclaration<*>) return@resolveWithClearCaches
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
|
||||
declarationToResolve.withFirDeclaration(resolveType, firModuleResolveState) {
|
||||
val firFile = firModuleResolveState.getOrBuildFirFile(ktFile)
|
||||
resultBuilder.append("\n${resolveType.name}:\n")
|
||||
resultBuilder.append(firFile.render(rendererOption))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resolveWithClearCaches(ktFile) { firModuleResolveState ->
|
||||
check(firModuleResolveState is FirModuleResolveStateImpl)
|
||||
val firFile = firModuleResolveState.getOrBuildFirFile(ktFile)
|
||||
firFile.withFirDeclaration(firModuleResolveState, FirResolvePhase.BODY_RESOLVE) {
|
||||
resultBuilder.append("\nFILE RAW TO BODY:\n")
|
||||
resultBuilder.append(firFile.render(rendererOption))
|
||||
}
|
||||
}
|
||||
|
||||
testServices.assertions.assertEqualsToFile(testDataFileSibling(".txt"), resultBuilder.toString())
|
||||
}
|
||||
|
||||
override fun configureTest(builder: TestConfigurationBuilder) {
|
||||
super.configureTest(builder)
|
||||
with(builder) {
|
||||
defaultDirectives {
|
||||
+JvmEnvironmentConfigurationDirectives.WITH_STDLIB
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+146
-80
@@ -1,80 +1,146 @@
|
||||
///*
|
||||
// * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
// * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
// */
|
||||
//
|
||||
//package org.jetbrains.kotlin.idea.fir.low.level.api;
|
||||
//
|
||||
//import com.intellij.testFramework.TestDataPath;
|
||||
//import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
//import org.jetbrains.kotlin.test.TestMetadata;
|
||||
//import org.junit.jupiter.api.Nested;
|
||||
//import org.junit.jupiter.api.Test;
|
||||
//
|
||||
//import java.io.File;
|
||||
//import java.util.regex.Pattern;
|
||||
//
|
||||
///** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
|
||||
//@SuppressWarnings("all")
|
||||
//@TestMetadata("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve")
|
||||
//@TestDataPath("$PROJECT_ROOT")
|
||||
//public class FirLazyDeclarationResolveTestGenerated extends AbstractFirLazyDeclarationResolveTest {
|
||||
// @Test
|
||||
// public void testAllFilesPresentInLazyResolve() throws Exception {
|
||||
// KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// @TestMetadata("classMembers.kt")
|
||||
// public void testClassMembers() throws Exception {
|
||||
// runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/classMembers.kt");
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// @TestMetadata("delegates.kt")
|
||||
// public void testDelegates() throws Exception {
|
||||
// runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/delegates.kt");
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// @TestMetadata("propertyWithGetter.kt")
|
||||
// public void testPropertyWithGetter() throws Exception {
|
||||
// runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/propertyWithGetter.kt");
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// @TestMetadata("propertyWithGetterAndSetter.kt")
|
||||
// public void testPropertyWithGetterAndSetter() throws Exception {
|
||||
// runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/propertyWithGetterAndSetter.kt");
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// @TestMetadata("propertyWithInitializer.kt")
|
||||
// public void testPropertyWithInitializer() throws Exception {
|
||||
// runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/propertyWithInitializer.kt");
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// @TestMetadata("secondaryConstructor.kt")
|
||||
// public void testSecondaryConstructor() throws Exception {
|
||||
// runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/secondaryConstructor.kt");
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// @TestMetadata("topLevelFunctions.kt")
|
||||
// public void testTopLevelFunctions() throws Exception {
|
||||
// runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/topLevelFunctions.kt");
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// @TestMetadata("topLevelFunctionsWithExpressionBodyAndExplicitType.kt")
|
||||
// public void testTopLevelFunctionsWithExpressionBodyAndExplicitType() throws Exception {
|
||||
// runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/topLevelFunctionsWithExpressionBodyAndExplicitType.kt");
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// @TestMetadata("topLevelFunctionsWithImplicitType.kt")
|
||||
// public void testTopLevelFunctionsWithImplicitType() throws Exception {
|
||||
// runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/topLevelFunctionsWithImplicitType.kt");
|
||||
// }
|
||||
//}
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.fir.low.level.api;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FirLazyDeclarationResolveTestGenerated extends AbstractFirLazyDeclarationResolveTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInLazyResolve() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotations.kt")
|
||||
public void testAnnotations() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/annotations.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("classMembers.kt")
|
||||
public void testClassMembers() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/classMembers.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegates.kt")
|
||||
public void testDelegates() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/delegates.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localDeclaration.kt")
|
||||
public void testLocalDeclaration() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/localDeclaration.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localFunction.kt")
|
||||
public void testLocalFunction() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/localFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("parameterOfLocalSetter.kt")
|
||||
public void testParameterOfLocalSetter() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/parameterOfLocalSetter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("parameterOfNonLocalSetter.kt")
|
||||
public void testParameterOfNonLocalSetter() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/parameterOfNonLocalSetter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyWithGetter.kt")
|
||||
public void testPropertyWithGetter() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/propertyWithGetter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyWithGetterAndSetter.kt")
|
||||
public void testPropertyWithGetterAndSetter() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/propertyWithGetterAndSetter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyWithInitializer.kt")
|
||||
public void testPropertyWithInitializer() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/propertyWithInitializer.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("secondaryConstructor.kt")
|
||||
public void testSecondaryConstructor() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/secondaryConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superTypes.kt")
|
||||
public void testSuperTypes() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/superTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superTypesLoop.kt")
|
||||
public void testSuperTypesLoop() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/superTypesLoop.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topLevelFunctions.kt")
|
||||
public void testTopLevelFunctions() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/topLevelFunctions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topLevelFunctionsWithExpressionBodyAndExplicitType.kt")
|
||||
public void testTopLevelFunctionsWithExpressionBodyAndExplicitType() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/topLevelFunctionsWithExpressionBodyAndExplicitType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topLevelFunctionsWithImplicitType.kt")
|
||||
public void testTopLevelFunctionsWithImplicitType() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/topLevelFunctionsWithImplicitType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeParameterOfLocalFunction.kt")
|
||||
public void testTypeParameterOfLocalFunction() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/typeParameterOfLocalFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeParameterOfNonLocalFunction.kt")
|
||||
public void testTypeParameterOfNonLocalFunction() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/typeParameterOfNonLocalFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeParameterOfTopFunction.kt")
|
||||
public void testTypeParameterOfTopFunction() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/typeParameterOfTopFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeParameterOfTopSetter.kt")
|
||||
public void testTypeParameterOfTopSetter() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/lazyResolve/typeParameterOfTopSetter.kt");
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.idea.fir.low.level.api.compiler.based
|
||||
|
||||
import com.intellij.mock.MockProject
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.psi.PsiElementFinder
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import com.intellij.psi.search.ProjectScope
|
||||
@@ -89,7 +90,7 @@ abstract class AbstractCompilerBasedTest : AbstractKotlinCompilerTest() {
|
||||
|
||||
val moduleInfo = TestModuleInfo(module)
|
||||
testServices.firModuleInfoProvider.registerModuleData(module, FirModuleInfoBasedModuleData(moduleInfo))
|
||||
val configurator = FirModuleResolveStateConfiguratorForSingleModuleTestImpl(testServices, module, ktFiles, moduleInfo)
|
||||
val configurator = FirModuleResolveStateConfiguratorForSingleModuleTestImpl(testServices, module, ktFiles, moduleInfo, project)
|
||||
|
||||
with(project as MockProject) {
|
||||
registerTestServices(configurator, ktFiles)
|
||||
@@ -162,6 +163,7 @@ class FirModuleResolveStateConfiguratorForSingleModuleTestImpl(
|
||||
private val testModule: TestModule,
|
||||
private val ktFiles: Map<TestFile, KtFile>,
|
||||
private val moduleInfo: ModuleInfo,
|
||||
private val parentDisposable: Disposable,
|
||||
) : FirModuleResolveStateConfigurator() {
|
||||
val moduleInfoProvider = testServices.firModuleInfoProvider
|
||||
val compilerConfigurationProvider = testServices.compilerConfigurationProvider
|
||||
@@ -220,8 +222,7 @@ class FirModuleResolveStateConfiguratorForSingleModuleTestImpl(
|
||||
}
|
||||
|
||||
override fun configureSourceSession(session: FirSession) {
|
||||
@Suppress("IncorrectParentDisposable")
|
||||
PsiElementFinder.EP.getPoint(project).registerExtension(FirJavaElementFinder(session, project), project)
|
||||
PsiElementFinder.EP.getPoint(project).registerExtension(FirJavaElementFinder(session, project), parentDisposable)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+24
-1
@@ -6,6 +6,8 @@
|
||||
package org.jetbrains.kotlin.idea.fir.low.level.api.test.base
|
||||
|
||||
import com.intellij.mock.MockProject
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.psi.PsiElementFinder
|
||||
import org.jetbrains.kotlin.asJava.finder.JavaElementFinder
|
||||
import org.jetbrains.kotlin.fir.session.FirModuleInfoBasedModuleData
|
||||
@@ -24,6 +26,7 @@ import org.jetbrains.kotlin.test.services.*
|
||||
import org.jetbrains.kotlin.test.services.configuration.CommonEnvironmentConfigurator
|
||||
import org.jetbrains.kotlin.test.services.configuration.JvmEnvironmentConfigurator
|
||||
import org.jetbrains.kotlin.test.services.impl.TemporaryDirectoryManagerImpl
|
||||
import org.junit.jupiter.api.AfterEach
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.TestInfo
|
||||
import java.nio.file.Path
|
||||
@@ -33,6 +36,20 @@ import kotlin.io.path.nameWithoutExtension
|
||||
abstract class AbstractLowLevelApiTest {
|
||||
private lateinit var testInfo: KotlinTestInfo
|
||||
|
||||
private var _disposable: Disposable? = null
|
||||
protected val disposable: Disposable get() = _disposable!!
|
||||
|
||||
@BeforeEach
|
||||
private fun intiDisposable(testInfo: TestInfo) {
|
||||
_disposable = Disposer.newDisposable("disposable for ${testInfo.displayName}")
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
private fun disposeDisposable() {
|
||||
_disposable?.let { Disposer.dispose(it) }
|
||||
_disposable = null
|
||||
}
|
||||
|
||||
private val configure: TestConfigurationBuilder.() -> Unit = {
|
||||
globalDefaults {
|
||||
frontend = FrontendKinds.FIR
|
||||
@@ -84,7 +101,13 @@ abstract class AbstractLowLevelApiTest {
|
||||
|
||||
val moduleInfo = TestModuleInfo(singleModule)
|
||||
testServices.firModuleInfoProvider.registerModuleData(singleModule, FirModuleInfoBasedModuleData(moduleInfo))
|
||||
val configurator = FirModuleResolveStateConfiguratorForSingleModuleTestImpl(testServices, singleModule, ktFiles, moduleInfo)
|
||||
val configurator = FirModuleResolveStateConfiguratorForSingleModuleTestImpl(
|
||||
testServices,
|
||||
singleModule,
|
||||
ktFiles,
|
||||
moduleInfo,
|
||||
disposable
|
||||
)
|
||||
|
||||
with(project as MockProject) {
|
||||
registerTestServices(configurator, ktFiles)
|
||||
|
||||
Reference in New Issue
Block a user