[Analysis API] Remove obsolete on-air resolution tests

This commit is contained in:
Yan Zhulanow
2024-01-10 23:28:28 +09:00
committed by Space Team
parent a848a0233d
commit 74db837b7d
39 changed files with 0 additions and 410 deletions
@@ -1,9 +0,0 @@
class X<T> {
class Y<K>
open class BASE
/*PLACE*/class PLACE
}
/*ONAIR*/inner class ONAIR : BASE() {
fun x() = Y<T>()
}
@@ -1,10 +0,0 @@
public final inner [ResolvedTo(BODY_RESOLVE)] class ONAIR<[ResolvedTo(STATUS)] Outer(T)> : R|X.BASE| {
public [ResolvedTo(BODY_RESOLVE)] X<T>.constructor(): R|X.ONAIR<T>| {
super<R|X.BASE|>()
}
public final [ResolvedTo(BODY_RESOLVE)] fun x(): R|X.Y<T>| {
^x R|/X.Y.Y|<R|T|>()
}
}
@@ -1,7 +0,0 @@
enum class Foo {
VALUE {
/*PLACE*/fun run() = 1
}
}
/*ONAIR*/fun box(): Int = 0
@@ -1,3 +0,0 @@
public final [ResolvedTo(BODY_RESOLVE)] fun box(): R|kotlin/Int| {
^box Int(0)
}
@@ -1,5 +0,0 @@
/*PLACE*/@file:helloKitty()
fun f() {
/*ONAIR*/@file:Deprecated("hello")
}
@@ -1 +0,0 @@
@FILE:R|kotlin/Deprecated|[Types](message = String(hello))
@@ -1,10 +0,0 @@
fun xxx() {
val f = 2
val g = "x"
/*PLACE*/val x = g
}
fun x() {
/*ONAIR*/val y = f
}
@@ -1 +0,0 @@
[ResolvedTo(BODY_RESOLVE)] lval y: R|kotlin/Int| = R|<local>/f|
@@ -1,6 +0,0 @@
class X {
class Y
fun x(/*PLACE*/x: Int) {}
}
fun y(/*ONAIR*/y: Y) {}
@@ -1 +0,0 @@
[ResolvedTo(BODY_RESOLVE)] y: R|X.Y|
@@ -1,8 +0,0 @@
class A {
class B
}
val a: /*PLACE*/A.B.C
val b: /*ONAIR*/A.B
@@ -1,2 +0,0 @@
public final [ResolvedTo(BODY_RESOLVE)] val b: R|A.B|
public [ResolvedTo(BODY_RESOLVE)] get(): R|A.B|
@@ -1,9 +0,0 @@
fun xxx() {
val x = 2
/*PLACE*/class C
}
/*ONAIR*/class E {
fun e() = x
}
@@ -1,10 +0,0 @@
local final [ResolvedTo(BODY_RESOLVE)] class E : R|kotlin/Any| {
public [ResolvedTo(BODY_RESOLVE)] constructor(): R|<local>/E| {
super<R|kotlin/Any|>()
}
public final [ResolvedTo(BODY_RESOLVE)] fun e(): R|kotlin/Int| {
^e R|<local>/x|
}
}
@@ -1,6 +0,0 @@
fun xxx() {
val x = 3
/*PLACE*/fun lcl() = ""
}
/*ONAIR*/fun x() = x
@@ -1,3 +0,0 @@
local final [ResolvedTo(BODY_RESOLVE)] fun x(): R|kotlin/Int| {
^x R|<local>/x|
}
@@ -1,13 +0,0 @@
class X
fun f(): X {
var x = 3
val y = 4
/*PLACE*/while(true) {}
}
fun g(): X {
/*ONAIR*/while (x < 2) {
x--
val z = y
}
}
@@ -1,9 +0,0 @@
while(CMP(<, R|<local>/x|.R|kotlin/Int.compareTo|(Int(2)))) {
{
[ResolvedTo(BODY_RESOLVE)] lval <unary>: R|kotlin/Int| = R|<local>/x|
R|<local>/x| = R|<local>/<unary>|.R|kotlin/Int.dec|()
R|<local>/<unary>|
}
[ResolvedTo(BODY_RESOLVE)] lval z: R|kotlin/Int| = R|<local>/y|
}
@@ -1,5 +0,0 @@
class Cls<T, K> {
/*PLACE*/fun member<T>(x: Int) = 2
}
/*ONAIR*/fun niewbe<K>(a: Char, b: Double) = "Trololo"
@@ -1,3 +0,0 @@
public final [ResolvedTo(BODY_RESOLVE)] fun <[ResolvedTo(BODY_RESOLVE)] K> niewbe([ResolvedTo(BODY_RESOLVE)] a: R|kotlin/Char|, [ResolvedTo(BODY_RESOLVE)] b: R|kotlin/Double|): R|kotlin/String| {
^niewbe String(Trololo)
}
@@ -1,5 +0,0 @@
class Cls {
/*PLACE*/val memberProperty = 2
}
/*ONAIR*/val niewbe = "Hello"
@@ -1,2 +0,0 @@
public final [ResolvedTo(BODY_RESOLVE)] val niewbe: R|kotlin/String| = String(Hello)
public [ResolvedTo(BODY_RESOLVE)] get(): R|kotlin/String|
@@ -1,9 +0,0 @@
interface Base {
fun baseMember(): Int
}
class Derived : Base {
/*PLACE*/fun someMember() = "Hello"
}
/*ONAIR*/override fun baseMember() = 3
@@ -1,3 +0,0 @@
public open override [ResolvedTo(BODY_RESOLVE)] fun baseMember(): R|kotlin/Int| {
^baseMember Int(3)
}
@@ -1,9 +0,0 @@
open class X {
/*PLACE*/class PLACE
}
/*ONAIR*/class Y {
open class BASE : X()
class DERIVED : BASE()
fun withType(arg: BASE) { }
}
@@ -1,23 +0,0 @@
public final [ResolvedTo(BODY_RESOLVE)] class Y : R|kotlin/Any| {
public [ResolvedTo(BODY_RESOLVE)] constructor(): R|X.Y| {
super<R|kotlin/Any|>()
}
public open [ResolvedTo(BODY_RESOLVE)] class BASE : R|X| {
public [ResolvedTo(BODY_RESOLVE)] constructor(): R|X.Y.BASE| {
super<R|X|>()
}
}
public final [ResolvedTo(BODY_RESOLVE)] class DERIVED : R|X.Y.BASE| {
public [ResolvedTo(BODY_RESOLVE)] constructor(): R|X.Y.DERIVED| {
super<R|X.Y.BASE|>()
}
}
public final [ResolvedTo(BODY_RESOLVE)] fun withType([ResolvedTo(BODY_RESOLVE)] arg: R|X.Y.BASE|): R|kotlin/Unit| {
}
}
@@ -1,9 +0,0 @@
class C<T> {
fun x(/*PLACE*/a: Int) {
}
}
fun y(/*ONAIR*/b: T) {
}
@@ -1 +0,0 @@
[ResolvedTo(BODY_RESOLVE)] b: R|T|
@@ -1,12 +0,0 @@
val x: Int get() {
val qqq = "Hello"
/*PLACE*/val x = 42
2
}
val y: String get() {
/*ONAIR*/val z = qqq
""
}
@@ -1 +0,0 @@
[ResolvedTo(BODY_RESOLVE)] lval z: R|kotlin/String| = R|<local>/qqq|
@@ -1,9 +0,0 @@
var x = 2
set(value) {
/*PLACE*/val inside = ""
}
var y = 2
set(value) {
/*ONAIR*/val inSetter = value
}
@@ -1 +0,0 @@
[ResolvedTo(BODY_RESOLVE)] lval inSetter: R|kotlin/Int| = R|<local>/value|
@@ -1,8 +0,0 @@
/*PLACE*/fun place(): Int {
fun xxx() = 2
}
/*ONAIR*/fun onAir(): Int {
fun yyy() = "hello"
}
@@ -1,6 +0,0 @@
public final [ResolvedTo(BODY_RESOLVE)] fun onAir(): R|kotlin/Int| {
local final [ResolvedTo(BODY_RESOLVE)] fun yyy(): R|kotlin/String| {
^yyy String(hello)
}
}
@@ -1,8 +0,0 @@
class X<T, K> {
/*PLACE*/private typealias A = List<T>
}
class Y {
/*ONAIR*/public typealias B = Set<K>
}
@@ -1 +0,0 @@
public final [ResolvedTo(BODY_RESOLVE)] typealias B = R|kotlin/collections/Set<K>|
@@ -1,44 +0,0 @@
/*
* Copyright 2010-2024 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.analysis.low.level.api.fir
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.LowLevelFirApiFacadeForResolveOnAir
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirSourceTestConfigurator
import org.jetbrains.kotlin.analysis.project.structure.KtSourceModule
import org.jetbrains.kotlin.analysis.test.framework.base.AbstractAnalysisApiBasedTest
import org.jetbrains.kotlin.fir.renderer.FirRenderer
import org.jetbrains.kotlin.psi.KtAnnotated
import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.KtFileAnnotationList
import org.jetbrains.kotlin.test.model.TestModule
import org.jetbrains.kotlin.test.services.TestServices
import org.jetbrains.kotlin.test.services.assertions
import org.jetbrains.kotlin.test.util.findElementByCommentPrefix
abstract class AbstractFirOnAirResolveTest : AbstractAnalysisApiBasedTest() {
override val configurator = AnalysisApiFirSourceTestConfigurator(analyseInDependentSession = false)
override fun doTestByMainFile(mainFile: KtFile, mainModule: TestModule, testServices: TestServices) {
fun fixUpAnnotations(element: KtElement): KtElement = when (element) {
is KtAnnotated -> element.annotationEntries.firstOrNull() ?: element
is KtFileAnnotationList -> element.annotationEntries.first()
else -> element
}
val place = (mainFile.findElementByCommentPrefix("/*PLACE*/") as KtElement).let(::fixUpAnnotations)
val onAir = (mainFile.findElementByCommentPrefix("/*ONAIR*/") as KtElement).let(::fixUpAnnotations)
check(place::class == onAir::class)
resolveWithClearCaches(mainFile) { firResolveSession ->
check(firResolveSession.useSiteKtModule is KtSourceModule)
val firElement = LowLevelFirApiFacadeForResolveOnAir.onAirResolveElement(firResolveSession, place, onAir)
val rendered = FirRenderer.withResolvePhase().renderElementAsString(firElement)
testServices.assertions.assertEqualsToTestDataFileSibling(rendered)
}
}
}
@@ -1,134 +0,0 @@
/*
* Copyright 2010-2024 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.analysis.low.level.api.fir;
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 org.jetbrains.kotlin.generators.tests.analysis.api.GenerateAnalysisApiTestsKt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("analysis/low-level-api-fir/testData/onAirResolve")
@TestDataPath("$PROJECT_ROOT")
public class FirOnAirResolveTestGenerated extends AbstractFirOnAirResolveTest {
@Test
public void testAllFilesPresentInOnAirResolve() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testData/onAirResolve"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("classInClass.kt")
public void testClassInClass() throws Exception {
runTest("analysis/low-level-api-fir/testData/onAirResolve/classInClass.kt");
}
@Test
@TestMetadata("enumValueMember.kt")
public void testEnumValueMember() throws Exception {
runTest("analysis/low-level-api-fir/testData/onAirResolve/enumValueMember.kt");
}
@Test
@TestMetadata("fileAnnotation.kt")
public void testFileAnnotation() throws Exception {
runTest("analysis/low-level-api-fir/testData/onAirResolve/fileAnnotation.kt");
}
@Test
@TestMetadata("identifierInContext.kt")
public void testIdentifierInContext() throws Exception {
runTest("analysis/low-level-api-fir/testData/onAirResolve/identifierInContext.kt");
}
@Test
@TestMetadata("inParameter.kt")
public void testInParameter() throws Exception {
runTest("analysis/low-level-api-fir/testData/onAirResolve/inParameter.kt");
}
@Test
@TestMetadata("incompleteIdentifier.kt")
public void testIncompleteIdentifier() throws Exception {
runTest("analysis/low-level-api-fir/testData/onAirResolve/incompleteIdentifier.kt");
}
@Test
@TestMetadata("localClass.kt")
public void testLocalClass() throws Exception {
runTest("analysis/low-level-api-fir/testData/onAirResolve/localClass.kt");
}
@Test
@TestMetadata("localFunction.kt")
public void testLocalFunction() throws Exception {
runTest("analysis/low-level-api-fir/testData/onAirResolve/localFunction.kt");
}
@Test
@TestMetadata("loopConstruction.kt")
public void testLoopConstruction() throws Exception {
runTest("analysis/low-level-api-fir/testData/onAirResolve/loopConstruction.kt");
}
@Test
@TestMetadata("memberInClass.kt")
public void testMemberInClass() throws Exception {
runTest("analysis/low-level-api-fir/testData/onAirResolve/memberInClass.kt");
}
@Test
@TestMetadata("memberPropertyInClass.kt")
public void testMemberPropertyInClass() throws Exception {
runTest("analysis/low-level-api-fir/testData/onAirResolve/memberPropertyInClass.kt");
}
@Test
@TestMetadata("memberWithOverride.kt")
public void testMemberWithOverride() throws Exception {
runTest("analysis/low-level-api-fir/testData/onAirResolve/memberWithOverride.kt");
}
@Test
@TestMetadata("onAirTypesResolve.kt")
public void testOnAirTypesResolve() throws Exception {
runTest("analysis/low-level-api-fir/testData/onAirResolve/onAirTypesResolve.kt");
}
@Test
@TestMetadata("replacementInHeader.kt")
public void testReplacementInHeader() throws Exception {
runTest("analysis/low-level-api-fir/testData/onAirResolve/replacementInHeader.kt");
}
@Test
@TestMetadata("replacementInsidePropertyBody.kt")
public void testReplacementInsidePropertyBody() throws Exception {
runTest("analysis/low-level-api-fir/testData/onAirResolve/replacementInsidePropertyBody.kt");
}
@Test
@TestMetadata("replacementInsidePropertyBody2.kt")
public void testReplacementInsidePropertyBody2() throws Exception {
runTest("analysis/low-level-api-fir/testData/onAirResolve/replacementInsidePropertyBody2.kt");
}
@Test
@TestMetadata("topLevelFunction.kt")
public void testTopLevelFunction() throws Exception {
runTest("analysis/low-level-api-fir/testData/onAirResolve/topLevelFunction.kt");
}
@Test
@TestMetadata("typeAlias.kt")
public void testTypeAlias() throws Exception {
runTest("analysis/low-level-api-fir/testData/onAirResolve/typeAlias.kt");
}
}
@@ -45,10 +45,6 @@ internal fun TestGroupSuite.generateFirLowLevelApiTests() {
}
testGroup("analysis/low-level-api-fir/tests", "analysis/low-level-api-fir/testData") {
testClass<AbstractFirOnAirResolveTest> {
model("onAirResolve")
}
testClass<AbstractFirSourceLazyDeclarationResolveTest> {
model("lazyResolve", pattern = TestGeneratorUtil.KT)
}