From 1843eeb16be1ae40995c4b0ca362fefa1dc6ed8b Mon Sep 17 00:00:00 2001 From: Ivan Kylchik Date: Tue, 12 Sep 2023 12:18:31 +0200 Subject: [PATCH] [FIR] Drop `visualizer` module This module was created to compare type resolve in K1 and K2. But overall, these tests contain a lot of bugs, and it is quite hard to use it. --- .space/CODEOWNERS | 1 - build.gradle.kts | 4 - .../build.gradle.kts | 1 - .../generators/GenerateJUnit5CompilerTests.kt | 22 - compiler/visualizer/build.gradle.kts | 53 - compiler/visualizer/common/build.gradle.kts | 14 - .../kotlin/compiler/visualizer/Annotator.kt | 65 -- .../compiler/visualizer/BaseRenderer.kt | 34 - .../visualizer/render-fir/build.gradle.kts | 22 - .../compiler/visualizer/FirVisualizer.kt | 904 ------------------ .../compiler/visualizer/Psi2FirMapper.kt | 38 - .../visualizer/render-psi/build.gradle.kts | 14 - .../compiler/visualizer/PsiVisualizer.kt | 596 ------------ .../testData/rawBuilder/declarations/F.kt | 4 - .../declarations/NestedOfAliasedType.kt | 13 - .../declarations/NestedSuperType.kt | 21 - .../rawBuilder/declarations/annotation.kt | 85 -- .../rawBuilder/declarations/complexTypes.kt | 15 - .../declarations/constructorInObject.kt | 24 - .../constructorOfAnonymousObject.kt | 30 - ...hBothOldAndNewSyntaxContractDescription.kt | 17 - .../propertyAccessorsContractDescription.kt | 60 -- .../simpleFunctionsContractDescription.kt | 16 - .../oldSyntax/contractDescription.kt | 126 --- .../rawBuilder/declarations/delegates.kt | 31 - .../rawBuilder/declarations/derivedClass.kt | 12 - .../declarations/emptyAnonymousObject.kt | 5 - .../testData/rawBuilder/declarations/enums.kt | 81 -- .../rawBuilder/declarations/enums2.kt | 30 - .../rawBuilder/declarations/expectActual.kt | 17 - .../rawBuilder/declarations/external.kt | 24 - .../rawBuilder/declarations/functionTypes.kt | 15 - .../declarations/genericFunctions.kt | 10 - .../declarations/genericProperty.kt | 8 - .../rawBuilder/declarations/nestedClass.kt | 12 - .../declarations/noPrimaryConstructor.kt | 14 - .../rawBuilder/declarations/simpleClass.kt | 39 - .../rawBuilder/declarations/simpleFun.kt | 3 - .../declarations/simpleTypeAlias.kt | 7 - .../declarations/typeAliasWithGeneric.kt | 9 - .../declarations/typeParameterVsNested.kt | 28 - .../rawBuilder/declarations/typeParameters.kt | 23 - .../testData/rawBuilder/declarations/where.kt | 6 - .../rawBuilder/expressions/annotated.kt | 52 - .../rawBuilder/expressions/arrayAccess.kt | 25 - .../rawBuilder/expressions/arrayAssignment.kt | 32 - .../rawBuilder/expressions/branches.kt | 92 -- .../expressions/callableReferences.kt | 58 -- .../testData/rawBuilder/expressions/calls.kt | 72 -- .../rawBuilder/expressions/classReference.kt | 27 - .../expressions/collectionLiterals.kt | 34 - .../rawBuilder/expressions/destructuring.kt | 28 - .../testData/rawBuilder/expressions/for.kt | 89 -- .../rawBuilder/expressions/genericCalls.kt | 19 - .../testData/rawBuilder/expressions/in.kt | 13 - .../rawBuilder/expressions/inBrackets.kt | 14 - .../testData/rawBuilder/expressions/init.kt | 12 - .../rawBuilder/expressions/labelForInfix.kt | 8 - .../testData/rawBuilder/expressions/lambda.kt | 97 -- .../expressions/lambdaAndAnonymousFunction.kt | 20 - .../testData/rawBuilder/expressions/locals.kt | 48 - .../rawBuilder/expressions/modifications.kt | 45 - .../rawBuilder/expressions/namedArgument.kt | 26 - .../rawBuilder/expressions/nullability.kt | 10 - .../expressions/qualifierWithTypeArguments.kt | 5 - .../rawBuilder/expressions/simpleReturns.kt | 7 - .../testData/rawBuilder/expressions/super.kt | 25 - .../testData/rawBuilder/expressions/these.kt | 43 - .../testData/rawBuilder/expressions/try.kt | 24 - .../rawBuilder/expressions/typeOperators.kt | 19 - .../testData/rawBuilder/expressions/unary.kt | 79 -- .../rawBuilder/expressions/variables.kt | 29 - .../testData/rawBuilder/expressions/while.kt | 62 -- .../uncommonCases/resultFiles/dataClass.kt | 55 -- .../uncommonCases/resultFiles/delegation.kt | 41 - .../uncommonCases/resultFiles/innerWith.kt | 94 -- .../uncommonCases/resultFiles/lists.kt | 32 - .../resultFiles/overrideEquals.kt | 55 -- .../uncommonCases/resultFiles/properties.kt | 83 -- .../uncommonCases/resultFiles/receiver.kt | 27 - .../uncommonCases/resultFiles/superTypes.kt | 25 - .../uncommonCases/resultFiles/variance.kt | 24 - .../uncommonCases/resultFiles/where.kt | 29 - .../uncommonCases/testFiles/dataClass.kt | 14 - .../uncommonCases/testFiles/delegation.kt | 19 - .../uncommonCases/testFiles/innerWith.kt | 38 - .../testData/uncommonCases/testFiles/lists.kt | 12 - .../uncommonCases/testFiles/overrideEquals.kt | 19 - .../uncommonCases/testFiles/properties.kt | 34 - .../uncommonCases/testFiles/receiver.kt | 12 - .../uncommonCases/testFiles/superTypes.kt | 15 - .../uncommonCases/testFiles/variance.kt | 16 - .../testData/uncommonCases/testFiles/where.kt | 10 - .../VisualizerBlackBoxTestGenerated.java | 0 .../FirVisualizerForRawFirDataGenerated.java | 668 ------------- ...irVisualizerForUncommonCasesGenerated.java | 86 -- .../PsiVisualizerForRawFirDataGenerated.java | 668 ------------- ...siVisualizerForUncommonCasesGenerated.java | 86 -- .../AbstractVisualizerBlackBoxTest.kt | 91 -- .../visualizer/AbstractVisualizerTest.kt | 69 -- .../visualizer/GenerateVisualizerTests.kt | 20 - .../kotlin/visualizer/VisualizerDirectives.kt | 17 - .../fir/AbstractFirVisualizerTest.kt | 16 - .../kotlin/visualizer/fir/FirOutputHandler.kt | 37 - .../psi/AbstractPsiVisualizerTest.kt | 16 - .../kotlin/visualizer/psi/PsiOutputHandler.kt | 30 - .../pill/generate-all-tests/build.gradle.kts | 1 - 107 files changed, 6126 deletions(-) delete mode 100644 compiler/visualizer/build.gradle.kts delete mode 100644 compiler/visualizer/common/build.gradle.kts delete mode 100644 compiler/visualizer/common/src/org/jetbrains/kotlin/compiler/visualizer/Annotator.kt delete mode 100644 compiler/visualizer/common/src/org/jetbrains/kotlin/compiler/visualizer/BaseRenderer.kt delete mode 100644 compiler/visualizer/render-fir/build.gradle.kts delete mode 100644 compiler/visualizer/render-fir/src/org/jetbrains/kotlin/compiler/visualizer/FirVisualizer.kt delete mode 100644 compiler/visualizer/render-fir/src/org/jetbrains/kotlin/compiler/visualizer/Psi2FirMapper.kt delete mode 100644 compiler/visualizer/render-psi/build.gradle.kts delete mode 100644 compiler/visualizer/render-psi/src/org/jetbrains/kotlin/compiler/visualizer/PsiVisualizer.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/F.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/NestedOfAliasedType.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/NestedSuperType.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/annotation.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/complexTypes.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/constructorInObject.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/constructorOfAnonymousObject.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/contracts/newSyntax/functionWithBothOldAndNewSyntaxContractDescription.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/contracts/newSyntax/propertyAccessorsContractDescription.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/contracts/newSyntax/simpleFunctionsContractDescription.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/contracts/oldSyntax/contractDescription.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/delegates.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/derivedClass.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/emptyAnonymousObject.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/enums.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/enums2.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/expectActual.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/external.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/functionTypes.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/genericFunctions.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/genericProperty.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/nestedClass.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/noPrimaryConstructor.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/simpleClass.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/simpleFun.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/simpleTypeAlias.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/typeAliasWithGeneric.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/typeParameterVsNested.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/typeParameters.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/declarations/where.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/annotated.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/arrayAccess.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/arrayAssignment.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/branches.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/callableReferences.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/calls.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/classReference.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/collectionLiterals.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/destructuring.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/for.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/genericCalls.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/in.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/inBrackets.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/init.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/labelForInfix.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/lambda.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/lambdaAndAnonymousFunction.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/locals.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/modifications.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/namedArgument.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/nullability.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/qualifierWithTypeArguments.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/simpleReturns.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/super.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/these.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/try.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/typeOperators.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/unary.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/variables.kt delete mode 100644 compiler/visualizer/testData/rawBuilder/expressions/while.kt delete mode 100644 compiler/visualizer/testData/uncommonCases/resultFiles/dataClass.kt delete mode 100644 compiler/visualizer/testData/uncommonCases/resultFiles/delegation.kt delete mode 100644 compiler/visualizer/testData/uncommonCases/resultFiles/innerWith.kt delete mode 100644 compiler/visualizer/testData/uncommonCases/resultFiles/lists.kt delete mode 100644 compiler/visualizer/testData/uncommonCases/resultFiles/overrideEquals.kt delete mode 100644 compiler/visualizer/testData/uncommonCases/resultFiles/properties.kt delete mode 100644 compiler/visualizer/testData/uncommonCases/resultFiles/receiver.kt delete mode 100644 compiler/visualizer/testData/uncommonCases/resultFiles/superTypes.kt delete mode 100644 compiler/visualizer/testData/uncommonCases/resultFiles/variance.kt delete mode 100644 compiler/visualizer/testData/uncommonCases/resultFiles/where.kt delete mode 100644 compiler/visualizer/testData/uncommonCases/testFiles/dataClass.kt delete mode 100644 compiler/visualizer/testData/uncommonCases/testFiles/delegation.kt delete mode 100644 compiler/visualizer/testData/uncommonCases/testFiles/innerWith.kt delete mode 100644 compiler/visualizer/testData/uncommonCases/testFiles/lists.kt delete mode 100644 compiler/visualizer/testData/uncommonCases/testFiles/overrideEquals.kt delete mode 100644 compiler/visualizer/testData/uncommonCases/testFiles/properties.kt delete mode 100644 compiler/visualizer/testData/uncommonCases/testFiles/receiver.kt delete mode 100644 compiler/visualizer/testData/uncommonCases/testFiles/superTypes.kt delete mode 100644 compiler/visualizer/testData/uncommonCases/testFiles/variance.kt delete mode 100644 compiler/visualizer/testData/uncommonCases/testFiles/where.kt delete mode 100644 compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/VisualizerBlackBoxTestGenerated.java delete mode 100644 compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/fir/FirVisualizerForRawFirDataGenerated.java delete mode 100644 compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/fir/FirVisualizerForUncommonCasesGenerated.java delete mode 100644 compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/psi/PsiVisualizerForRawFirDataGenerated.java delete mode 100644 compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/psi/PsiVisualizerForUncommonCasesGenerated.java delete mode 100644 compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/AbstractVisualizerBlackBoxTest.kt delete mode 100644 compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/AbstractVisualizerTest.kt delete mode 100644 compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/GenerateVisualizerTests.kt delete mode 100644 compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/VisualizerDirectives.kt delete mode 100644 compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/fir/AbstractFirVisualizerTest.kt delete mode 100644 compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/fir/FirOutputHandler.kt delete mode 100644 compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/psi/AbstractPsiVisualizerTest.kt delete mode 100644 compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/psi/PsiOutputHandler.kt diff --git a/.space/CODEOWNERS b/.space/CODEOWNERS index 7034bc7dd7e..dc8e24977b5 100644 --- a/.space/CODEOWNERS +++ b/.space/CODEOWNERS @@ -207,7 +207,6 @@ /compiler/util-klib/ "Kotlin Native" /compiler/util-klib-abi/ "Kotlin Native" /compiler/util-klib-metadata/ "Kotlin Native" -/compiler/visualizer/ "Kotlin Compiler Core" /core/builtins/ "Kotlin Compiler Core" /core/compiler.common/ "Kotlin Compiler Core" diff --git a/build.gradle.kts b/build.gradle.kts index 5046da5572c..fc9d6792e8c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -702,10 +702,6 @@ tasks { dependsOn(":compiler:fir:fir2ir:nightlyTests") } - register("compilerFrontendVisualizerTest") { - dependsOn("compiler:visualizer:test") - } - register("scriptingJvmTest") { dependsOn("dist") dependsOn(":kotlin-scripting-compiler:test") diff --git a/compiler/tests-for-compiler-generator/build.gradle.kts b/compiler/tests-for-compiler-generator/build.gradle.kts index f466193b785..e3c658ad8b8 100644 --- a/compiler/tests-for-compiler-generator/build.gradle.kts +++ b/compiler/tests-for-compiler-generator/build.gradle.kts @@ -17,7 +17,6 @@ dependencies { testImplementation(projectTests(":compiler:fir:raw-fir:light-tree2fir")) testImplementation(projectTests(":compiler:fir:fir2ir")) testImplementation(projectTests(":compiler:fir:analysis-tests:legacy-fir-tests")) - testImplementation(projectTests(":compiler:visualizer")) testImplementation(projectTests(":js:js.tests")) testImplementation(projectTests(":generators:test-generator")) } diff --git a/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt b/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt index 17d14c1c296..90c92605658 100644 --- a/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt +++ b/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt @@ -14,8 +14,6 @@ import org.jetbrains.kotlin.test.runners.ir.* import org.jetbrains.kotlin.test.runners.ir.interpreter.AbstractJvmIrInterpreterAfterFirPsi2IrTest import org.jetbrains.kotlin.test.runners.ir.interpreter.AbstractJvmIrInterpreterAfterPsi2IrTest import org.jetbrains.kotlin.test.utils.CUSTOM_TEST_DATA_EXTENSION_PATTERN -import org.jetbrains.kotlin.visualizer.fir.AbstractFirVisualizerTest -import org.jetbrains.kotlin.visualizer.psi.AbstractPsiVisualizerTest fun generateJUnit5CompilerTests(args: Array, mainClassName: String?) { val excludedCustomTestdataPattern = CUSTOM_TEST_DATA_EXTENSION_PATTERN @@ -385,25 +383,5 @@ fun generateJUnit5CompilerTests(args: Array, mainClassName: String?) { model("codegen/bytecodeText") } } - - testGroup("compiler/visualizer/tests-gen", "compiler/fir/raw-fir/psi2fir/testData") { - testClass("PsiVisualizerForRawFirDataGenerated") { - model("rawBuilder") - } - - testClass("FirVisualizerForRawFirDataGenerated") { - model("rawBuilder") - } - } - - testGroup("compiler/visualizer/tests-gen", "compiler/visualizer/testData") { - testClass("PsiVisualizerForUncommonCasesGenerated") { - model("uncommonCases/testFiles") - } - - testClass("FirVisualizerForUncommonCasesGenerated") { - model("uncommonCases/testFiles") - } - } } } diff --git a/compiler/visualizer/build.gradle.kts b/compiler/visualizer/build.gradle.kts deleted file mode 100644 index 55c30f09e46..00000000000 --- a/compiler/visualizer/build.gradle.kts +++ /dev/null @@ -1,53 +0,0 @@ -import org.jetbrains.kotlin.ideaExt.idea - -plugins { - kotlin("jvm") - id("jps-compatible") -} - -dependencies { - testCompileOnly(project(":compiler:fir:raw-fir:psi2fir")) - - testImplementation(project(":compiler:visualizer:render-psi")) - testImplementation(project(":compiler:visualizer:render-fir")) - - testApi(platform(libs.junit.bom)) - testImplementation(libs.junit.jupiter.api) - testRuntimeOnly(libs.junit.jupiter.engine) - - testApi(projectTests(":compiler:tests-compiler-utils")) - testApi(projectTests(":compiler:tests-common-new")) - testApi(projectTests(":compiler:test-infrastructure")) - testApi(projectTests(":compiler:fir:analysis-tests:legacy-fir-tests")) - testImplementation(projectTests(":generators:test-generator")) - - testRuntimeOnly(commonDependency("org.jetbrains.intellij.deps.fastutil:intellij-deps-fastutil")) - testRuntimeOnly(commonDependency("org.jetbrains.intellij.deps.jna:jna")) -} - -val generationRoot = projectDir.resolve("tests-gen") - -sourceSets { - "main" { projectDefault() } - "test" { - projectDefault() - this.java.srcDir(generationRoot.name) - } -} - -if (kotlinBuildProperties.isInJpsBuildIdeaSync) { - apply(plugin = "idea") - idea { - this.module.generatedSourceDirs.add(generationRoot) - } -} - -projectTest(parallel = true, jUnitMode = JUnitMode.JUnit5) { - workingDir = rootDir - - useJUnitPlatform() -} - -testsJar() - -val generateVisualizerTests by generator("org.jetbrains.kotlin.visualizer.GenerateVisualizerTestsKt") diff --git a/compiler/visualizer/common/build.gradle.kts b/compiler/visualizer/common/build.gradle.kts deleted file mode 100644 index 62157d89d32..00000000000 --- a/compiler/visualizer/common/build.gradle.kts +++ /dev/null @@ -1,14 +0,0 @@ -plugins { - kotlin("jvm") - id("jps-compatible") -} - -dependencies { - api(project(":compiler:frontend")) - compileOnly(intellijCore()) -} - -sourceSets { - "main" { projectDefault() } - "test" { } -} \ No newline at end of file diff --git a/compiler/visualizer/common/src/org/jetbrains/kotlin/compiler/visualizer/Annotator.kt b/compiler/visualizer/common/src/org/jetbrains/kotlin/compiler/visualizer/Annotator.kt deleted file mode 100644 index 23985b12253..00000000000 --- a/compiler/visualizer/common/src/org/jetbrains/kotlin/compiler/visualizer/Annotator.kt +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2010-2019 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.compiler.visualizer - -import com.intellij.openapi.util.TextRange -import kotlin.math.max - -object Annotator { - private const val verticalLine = "│" - private const val comment = "//" - - data class AnnotationInfo(val text: String, val range: TextRange) - - private fun putAnnotationToLines(annotations: List, lineStart: Int, lineSize: Int): List { - val annotationLines = mutableListOf(StringBuilder(comment + " ".repeat(lineSize - comment.length))) - val levelToOffset = mutableMapOf(0 to 0) - - for (ann in annotations) { - val lastLevel = levelToOffset.values.takeWhile { ann.range.startOffset + ann.text.length >= it }.size - - if (annotationLines.size <= lastLevel) { - annotationLines.add(StringBuilder(comment + " ".repeat(lineSize - comment.length))) - } - - val startReplace = max(comment.length, ann.range.startOffset - lineStart) - annotationLines[lastLevel].replace(startReplace, startReplace + ann.text.length, ann.text) - - for (i in 0 until lastLevel) { - if (annotationLines[i].getOrNull(startReplace) == ' ') { //to avoid char replacement for a multilevel annotation - annotationLines[i].replace(startReplace, startReplace + 1, verticalLine) - } - } - - for (i in 1..lastLevel) { - levelToOffset[i] = ann.range.startOffset - } - } - - return annotationLines.map { it.trim().toString() } - } - - fun annotate(text: String, annotation: Set): List { - val lines = text.lines() - val resultLines = mutableListOf() - var lineStartOffset = 0 - for (line in lines) { - val lineEndOffset = lineStartOffset + line.length - val annotations = annotation - .filter { it.range.startOffset in lineStartOffset until lineEndOffset } - .sortedByDescending { it.range.startOffset } - - if (annotations.isNotEmpty()) { - val annotationLines = putAnnotationToLines(annotations, lineStartOffset, line.length) - resultLines += annotationLines.asReversed() - } - resultLines.add(line) - - lineStartOffset = lineEndOffset + 1 - } - return resultLines - } -} \ No newline at end of file diff --git a/compiler/visualizer/common/src/org/jetbrains/kotlin/compiler/visualizer/BaseRenderer.kt b/compiler/visualizer/common/src/org/jetbrains/kotlin/compiler/visualizer/BaseRenderer.kt deleted file mode 100644 index c9768ace466..00000000000 --- a/compiler/visualizer/common/src/org/jetbrains/kotlin/compiler/visualizer/BaseRenderer.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2010-2019 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.compiler.visualizer - -import com.intellij.psi.PsiElement - -abstract class BaseRenderer { - private val annotations = mutableSetOf() - private val unnecessaryData = mapOf( - "kotlin/" to "" - ) - - open fun addAnnotation(annotationText: String, element: PsiElement?, deleteDuplicate: Boolean = true) { - if (element == null) return - annotations.removeIf { it.range.startOffset == element.textRange.startOffset && deleteDuplicate } - - var textWithOutUnnecessaryData = annotationText - for ((key, value) in unnecessaryData) { - textWithOutUnnecessaryData = textWithOutUnnecessaryData.replace(key, value) - } - if (textWithOutUnnecessaryData != element.text && textWithOutUnnecessaryData.isNotEmpty()) { - annotations.add(Annotator.AnnotationInfo(textWithOutUnnecessaryData, element.textRange)) - } - } - - protected fun getAnnotations(): Set { - return annotations - } - - abstract fun render(): String -} \ No newline at end of file diff --git a/compiler/visualizer/render-fir/build.gradle.kts b/compiler/visualizer/render-fir/build.gradle.kts deleted file mode 100644 index 91dfb11e2da..00000000000 --- a/compiler/visualizer/render-fir/build.gradle.kts +++ /dev/null @@ -1,22 +0,0 @@ -plugins { - kotlin("jvm") - id("jps-compatible") -} - -dependencies { - api(project(":compiler:fir:raw-fir:psi2fir")) - api(project(":compiler:fir:resolve")) - api(project(":compiler:visualizer:common")) - compileOnly(intellijCore()) -} - -sourceSets { - "main" { projectDefault() } - "test" { } -} - -tasks.withType> { - kotlinOptions { - freeCompilerArgs += "-opt-in=org.jetbrains.kotlin.fir.symbols.SymbolInternals" - } -} diff --git a/compiler/visualizer/render-fir/src/org/jetbrains/kotlin/compiler/visualizer/FirVisualizer.kt b/compiler/visualizer/render-fir/src/org/jetbrains/kotlin/compiler/visualizer/FirVisualizer.kt deleted file mode 100644 index 7a8050d8b29..00000000000 --- a/compiler/visualizer/render-fir/src/org/jetbrains/kotlin/compiler/visualizer/FirVisualizer.kt +++ /dev/null @@ -1,904 +0,0 @@ -/* - * Copyright 2010-2022 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.compiler.visualizer - -import com.intellij.psi.PsiElement -import org.jetbrains.kotlin.KtNodeTypes -import org.jetbrains.kotlin.descriptors.ClassKind -import org.jetbrains.kotlin.fir.* -import org.jetbrains.kotlin.fir.declarations.* -import org.jetbrains.kotlin.fir.declarations.utils.isLocal -import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic -import org.jetbrains.kotlin.fir.expressions.* -import org.jetbrains.kotlin.fir.references.* -import org.jetbrains.kotlin.fir.renderer.ConeTypeRendererForDebugging -import org.jetbrains.kotlin.fir.resolve.defaultType -import org.jetbrains.kotlin.fir.resolve.fullyExpandedType -import org.jetbrains.kotlin.fir.resolve.toFirRegularClassSymbol -import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol -import org.jetbrains.kotlin.fir.symbols.impl.* -import org.jetbrains.kotlin.fir.types.* -import org.jetbrains.kotlin.fir.visitors.FirVisitor -import org.jetbrains.kotlin.name.CallableId -import org.jetbrains.kotlin.name.ClassId -import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.psi -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.getChildOfType -import org.jetbrains.kotlin.psi.psiUtil.getChildrenOfType -import org.jetbrains.kotlin.renderer.replacePrefixesInTypeRepresentations -import org.jetbrains.kotlin.types.AbstractStrictEqualityTypeChecker -import org.jetbrains.kotlin.types.ConstantValueKind -import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly - -private const val ANONYMOUS_NAME = "" -private typealias Stack = MutableList>> - -class FirVisualizer(private val firFile: FirFile) : BaseRenderer() { - private val implicitReceivers = mutableListOf() - - private fun FirElement.render(): String = buildString { this@render.accept(FirRendererForVisualizer(), this) } - - private val stack = mutableListOf("" to mutableListOf()) - - private fun Stack.push( - levelName: String, - defaultValues: MutableList = mutableListOf(), - ) = this.add(levelName to defaultValues) - - private fun Stack.pop() = this.removeAt(this.size - 1) - private fun Stack.addName(name: String) = this.last().second.add(name) - private fun Stack.addName(name: Name) = this.addName(name.asString()) - private fun Stack.getPathByName(name: String): String { - if (name == ANONYMOUS_NAME) return "" - for ((reversedIndex, names) in this.asReversed().map { it.second }.withIndex()) { - if (names.contains(name)) { - return this.filterIndexed { index, _ -> index < this.size - reversedIndex && index > 0 } - .joinToString(separator = ".", postfix = ".") { it.first } - } - } - if (name == "it") { - return this.subList(1, this.size) - .joinToString(separator = ".", postfix = ".") { it.first } - } - return "[NOT FOUND]." - } - - override fun addAnnotation(annotationText: String, element: PsiElement?, deleteDuplicate: Boolean) { - super.addAnnotation(annotationText, element, false) - } - - override fun render(): String { - val map = mutableMapOf>().apply { Psi2FirMapper(this).visitFile(firFile) } - map.keys.firstOrNull { it is KtFile }?.accept(PsiVisitor(map)) - return Annotator.annotate(firFile.psi!!.text, getAnnotations()).joinToString("\n") - } - - inner class PsiVisitor(private val map: Map>) : KtVisitorVoid() { - private var lastCallWithLambda: String? = null - - private inline fun KtElement.firstOfType(): T? { - val firList = map[this] - return firList?.filterIsInstance()?.firstOrNull() - } - - /** - * @return rendered element or null if there is no such type - */ - private inline fun KtElement.firstOfTypeWithRender( - psi: PsiElement? = this, - getRendererElement: T.() -> FirElement = { this } - ): FirElement? { - return firstOfType()?.also { addAnnotation(it.getRendererElement().render(), psi) } - } - - /** - * @return rendered element or null if there is no such type - */ - private inline fun KtElement.firstOfTypeWithLocalReplace( - psi: PsiElement? = this, - getName: T.() -> String - ): FirElement? { - return firstOfType()?.also { addAnnotation(it.render().replace("/", stack.getPathByName(it.getName())), psi) } - } - - /** - * @return first rendered element or null if there is no such type - */ - private inline fun KtElement.allOfTypeWithLocalReplace( - psi: PsiElement? = this, - getName: T.() -> String - ): FirElement? { - val firList = map[this] - val firElements = firList?.filterIsInstance() - if (firElements == null || firElements.isEmpty()) return null - firElements.forEach { addAnnotation(it.render().replace("/", stack.getPathByName(it.getName())), psi) } - - return firElements.first() - } - - override fun visitElement(element: PsiElement) { - element.acceptChildren(this) - } - - override fun visitKtElement(element: KtElement) { - when (element) { - is KtClassInitializer, is KtSecondaryConstructor, is KtPrimaryConstructor, is KtSuperTypeCallEntry, is KtDelegatedSuperTypeEntry -> { - val valueParameters = element.getChildrenOfType() - valueParameters.flatMap { it.parameters }.forEach { stack.addName(it.nameAsSafeName) } - - //add to init values from last block - //because when we are out of primary constructor information about properties will be removed - //is used in ClassInitializer block and in SuperTypeCallEntry - stack.push("", stack.last().second) - element.acceptChildren(this) - stack.pop() - } - is KtClassOrObject -> { - if (element.isLocal) stack.addName((element.name ?: ANONYMOUS_NAME)) - stack.push((element.name ?: ANONYMOUS_NAME)) - element.acceptChildren(this) - stack.pop() - } - else -> element.acceptChildren(this) - } - } - - override fun visitPackageDirective(directive: KtPackageDirective) { - //don't resolve package names - } - - override fun visitSuperExpression(expression: KtSuperExpression) { - //don't resolve super expression - } - - override fun visitThisExpression(expression: KtThisExpression) { - //don't resolve this expression - } - - override fun visitNamedFunction(function: KtNamedFunction) { - if (function.isLocal) stack.addName(function.name ?: ANONYMOUS_NAME) - stack.push((function.name ?: ANONYMOUS_NAME)) - if (function.equalsToken != null) { - function.bodyExpression!!.firstOfTypeWithRender(function.equalsToken) { this.result.resolvedType.toFirResolvedTypeRef() } - ?: function.firstOfTypeWithRender(function.equalsToken) { this.returnTypeRef } - } - super.visitNamedFunction(function) - stack.pop() - } - - private fun renderVariableType(variable: KtVariableDeclaration) { - stack.addName(variable.nameAsSafeName) - variable.firstOfTypeWithRender(variable.nameIdentifier) - variable.acceptChildren(this) - } - - override fun visitProperty(property: KtProperty) = - renderVariableType(property) - - override fun visitDestructuringDeclarationEntry(multiDeclarationEntry: KtDestructuringDeclarationEntry) = - renderVariableType(multiDeclarationEntry) - - override fun visitAnnotationEntry(annotationEntry: KtAnnotationEntry) { - annotationEntry.firstOfTypeWithRender(annotationEntry.getChildOfType()) - super.visitAnnotationEntry(annotationEntry) - } - - override fun visitConstructorCalleeExpression(constructorCalleeExpression: KtConstructorCalleeExpression) { - constructorCalleeExpression.firstOfTypeWithRender() - } - - override fun visitParameter(parameter: KtParameter) { - stack.addName(parameter.nameAsSafeName) - if ((parameter.isLoopParameter && parameter.destructuringDeclaration == null) || parameter.ownerFunction is KtPropertyAccessor) { - parameter.firstOfTypeWithRender(parameter.nameIdentifier) - } - super.visitParameter(parameter) - } - - override fun visitTypeReference(typeReference: KtTypeReference) { - typeReference.firstOfTypeWithRender() - super.visitTypeReference(typeReference) - } - - override fun visitConstantExpression(expression: KtConstantExpression) { - expression.firstOfTypeWithRender>() - } - - override fun visitReferenceExpression(expression: KtReferenceExpression) { - if (expression is KtOperationReferenceExpression) return - - expression.firstOfTypeWithLocalReplace { this.name.asString() } - ?: expression.firstOfTypeWithLocalReplace { this.name.asString() } - ?: expression.firstOfTypeWithRender() - ?: expression.firstOfTypeWithRender() //fallback for errors - super.visitReferenceExpression(expression) - } - - override fun visitUnaryExpression(expression: KtUnaryExpression) { - if (expression.operationReference.getReferencedName() == "!!") { - expression.baseExpression?.accept(this) - return - } - expression.allOfTypeWithLocalReplace(expression.operationReference) { this.calleeReference.name.asString() } - super.visitUnaryExpression(expression) - } - - override fun visitBinaryExpression(expression: KtBinaryExpression) { - val operation = expression.operationReference - when { - operation.getReferencedName() == "?:" -> { - expression.left?.accept(this) - expression.right?.accept(this) - } - operation.getReferencedName() in setOf("==", "!=") -> { - expression.left?.accept(this) - expression.firstOfTypeWithRender(operation) - expression.right?.accept(this) - } - else -> { - expression.allOfTypeWithLocalReplace(operation) { this.calleeReference.name.asString() } - ?: expression.firstOfTypeWithLocalReplace(operation) { this.calleeReference.toString() } - super.visitBinaryExpression(expression) - } - } - } - - override fun visitIfExpression(expression: KtIfExpression) { - expression.firstOfTypeWithRender { this.resolvedType.toFirResolvedTypeRef() } - super.visitIfExpression(expression) - } - - override fun visitWhenExpression(expression: KtWhenExpression) { - expression.firstOfTypeWithRender { this.resolvedType.toFirResolvedTypeRef() } - super.visitWhenExpression(expression) - } - - override fun visitDotQualifiedExpression(expression: KtDotQualifiedExpression) { - expression.firstOfTypeWithLocalReplace(expression.selectorExpression) { this.calleeReference.name.asString() } - super.visitDotQualifiedExpression(expression) - } - - override fun visitCallExpression(expression: KtCallExpression) { - expression.firstOfTypeWithLocalReplace { this.calleeReference.name.asString() } - ?: expression.firstOfTypeWithRender() - expression.children.filter { it.node.elementType != KtNodeTypes.REFERENCE_EXPRESSION }.forEach { psi -> - when (psi) { - is KtLambdaArgument -> { - val firLambda = (psi.firstOfType()?.expression as? FirAnonymousFunctionExpression)?.anonymousFunction - firLambda?.receiverParameter?.typeRef?.let { - lastCallWithLambda = psi.getLambdaExpression()?.firstOfType()?.name - implicitReceivers += it.coneType - psi.accept(this) - implicitReceivers -= it.coneType - lastCallWithLambda = null - } ?: psi.accept(this) - } - else -> psi.accept(this) - } - } - } - - override fun visitLambdaExpression(lambdaExpression: KtLambdaExpression) { - stack.push(ANONYMOUS_NAME) - lastCallWithLambda?.let { addAnnotation("$it@${implicitReceivers.size - 1}", lambdaExpression) } - super.visitLambdaExpression(lambdaExpression) - stack.pop() - } - - override fun visitArrayAccessExpression(expression: KtArrayAccessExpression) { - //this method explicitly accept children and prevent default fallback to other fir element - expression.acceptChildren(this) - } - - override fun visitPropertyAccessor(accessor: KtPropertyAccessor) { - if (accessor.isSetter) { - stack.push("", mutableListOf("field")) - super.visitPropertyAccessor(accessor) - stack.pop() - } else { - super.visitPropertyAccessor(accessor) - } - } - - override fun visitWhenEntry(ktWhenEntry: KtWhenEntry) { - ktWhenEntry.firstOfTypeWithRender(ktWhenEntry.expression) { this.result.resolvedType.toFirResolvedTypeRef() } - super.visitWhenEntry(ktWhenEntry) - } - - override fun visitClassLiteralExpression(expression: KtClassLiteralExpression) { - expression.firstOfTypeWithRender() - } - - override fun visitPrefixExpression(expression: KtPrefixExpression) { - expression.firstOfTypeWithRender>(expression.baseExpression) ?: super.visitPrefixExpression(expression) - } - } - - inner class FirRendererForVisualizer : FirVisitor() { - private val session = firFile.moduleData.session - private val filePackage = firFile.packageFqName.toString() - private val filePackageWithSlash = filePackage.replace(".", "/") - - private fun ConeTypeProjection.tryToRenderConeAsFunctionTypeString(): String { - return buildString { - tryToRenderConeAsFunctionType(this@buildString) - } - } - - private fun ConeTypeProjection.tryToRenderConeAsFunctionType(builder: StringBuilder) { - if (this !is ConeKotlinType) { - localTypeProjectionRenderer(builder) - return - } - val projectionBuilder = StringBuilder() - ConeTypeRendererForDebugging(projectionBuilder).renderAsPossibleFunctionType( - this, - { it.functionTypeKind(session) } - ) { - localTypeProjectionRenderer(projectionBuilder) - } - builder.append(projectionBuilder.toString().removeCurrentFilePackage()) - } - - private fun tryToSquashFlexibleType(lowerRendered: String, upperRendered: String): String? { - val simpleCollection = replacePrefixesInTypeRepresentations( - lowerRendered, - "kotlin/collections/Mutable", - upperRendered, - "kotlin/collections/", - "kotlin/collections/(Mutable)" - ) - if (simpleCollection != null) return simpleCollection - - val mutableEntry = replacePrefixesInTypeRepresentations( - lowerRendered, - "kotlin/collections/MutableMap.MutableEntry", - upperRendered, - "kotlin/collections/Map.Entry", - "kotlin/collections/(Mutable)Map.(Mutable)Entry" - ) - if (mutableEntry != null) return mutableEntry - - val array = replacePrefixesInTypeRepresentations( - lowerRendered, - "kotlin/Array<", - upperRendered, - "kotlin/Array nullability.suffix - else -> "" - } - - when (this) { - is ConeKotlinTypeProjectionIn -> { - builder.append("in ") - type.tryToRenderConeAsFunctionType(builder) - } - is ConeKotlinTypeProjectionOut -> { - builder.append("out ") - type.tryToRenderConeAsFunctionType(builder) - } - is ConeStarProjection -> builder.append("*") - is ConeClassLikeType -> { - val type = this.fullyExpandedType(session) - if (type != this) { - type.tryToRenderConeAsFunctionType(builder) - return - } - val classId = type.lookupTag.classId - when { - classId.isLocal -> builder.append(classId.shortClassName.asString().let { stack.getPathByName(it) + it }) - else -> builder.append(classId.asString()) - } - if (type.typeArguments.isNotEmpty()) { - builder.append("<") - for ((index, typeArgument) in type.typeArguments.withIndex()) { - if (index != 0) { - builder.append(", ") - } - typeArgument.tryToRenderConeAsFunctionType(builder) - } - builder.append(">") - } - builder.append(nullabilitySuffix) - } - is ConeLookupTagBasedType -> builder.append(lookupTag.name.asString() + nullabilitySuffix) - is ConeFlexibleType -> { - val lowerBuilder = StringBuilder() - lowerBound.tryToRenderConeAsFunctionType(lowerBuilder) - if (lowerBound.nullability == ConeNullability.NOT_NULL && upperBound.nullability == ConeNullability.NULLABLE && - AbstractStrictEqualityTypeChecker - .strictEqualTypes( - session.typeContext, - lowerBound, - upperBound.withNullability(ConeNullability.NOT_NULL, session.typeContext) - ) - ) { - builder.append(lowerBuilder) - } else { - val upperBuilder = StringBuilder() - upperBound.tryToRenderConeAsFunctionType(upperBuilder) - builder.append( - tryToSquashFlexibleType(lowerBuilder.toString(), upperBuilder.toString()) ?: "$lowerBuilder..$upperBuilder" - ) - } - } - is ConeIntersectionType -> { - intersectedTypes.map { it.renderForDebugging().replace("/", ".").replace("kotlin.", "") }.sorted() - .joinToString(separator = " & ", prefix = "{", postfix = "}") - } - else -> builder.append((this as ConeKotlinType).renderForDebugging()) - } - } - - private fun String.removeCurrentFilePackage(): String { - val withoutPackage = this.replaceFirst("$filePackage.", "").replaceFirst("$filePackageWithSlash/", "") - - return withoutPackage.let { if (it.startsWith("/")) it.substring(1) else it } - } - - private fun ClassId.getWithoutCurrentPackage() = this.asString().removeCurrentFilePackage() - - private fun renderListInTriangles(list: List, data: StringBuilder, withSpace: Boolean = false) { - if (list.isNotEmpty()) { - list.joinTo(data, separator = ", ", prefix = "<", postfix = ">") { - it.render() - } - if (withSpace) data.append(" ") - } - } - - private fun renderImplicitReceiver(symbol: FirBasedSymbol<*>, psi: PsiElement?) { - val receiverType = (symbol.fir as? FirCallableDeclaration)?.dispatchReceiverType ?: return - val implicitReceiverIndex = implicitReceivers.indexOf(receiverType) - if (implicitReceiverIndex != -1) addAnnotation("this@$implicitReceiverIndex", psi) - } - - private fun renderConstructorSymbol(symbol: FirConstructorSymbol, data: StringBuilder) { - data.append("constructor ") - data.append(getSymbolId(symbol)) - renderListInTriangles(symbol.fir.typeParameters, data) - } - - private fun renderField(field: FirField, data: StringBuilder) { - val original = field.unwrapFakeOverridesOrDelegated() - if (original.isVal) data.append("val ") else if (original.isVar) data.append("var ") - - data.append("(") - original.dispatchReceiverType?.tryToRenderConeAsFunctionType(data) - data.append(").") - .append(original.name) - .append(": ") - original.returnTypeRef.coneType.tryToRenderConeAsFunctionType(data) - } - - private fun renderVariable(variable: FirVariable, data: StringBuilder) { - when { - variable is FirEnumEntry -> { - data.append("enum entry ") - variable.returnTypeRef.accept(this, data) - data.append(".${variable.name}") - return - } - variable !is FirValueParameter || variable.name.asString() == "e" /* hack to match render with psi */ -> when { - variable.isVar -> data.append("var ") - variable.isVal -> data.append("val ") - } - } - val returnType = if ((variable as? FirValueParameter)?.isVararg == true) { - data.append("vararg ") - variable.returnTypeRef.coneType.arrayElementType() - } else { - variable.returnTypeRef.coneType - } - - val receiver = when (variable) { - is FirField -> variable.dispatchReceiverType?.tryToRenderConeAsFunctionTypeString() - else -> getSymbolId(variable.symbol) - } - - data.append(receiver) - .append(variable.symbol.callableId.callableName) - .append(": ") - returnType?.tryToRenderConeAsFunctionType(data) - data.append((variable as? FirValueParameter)?.defaultValue?.let { " = ..." } ?: "") - } - - private fun renderPropertySymbol(symbol: FirPropertySymbol, data: StringBuilder) { - val fir = symbol.fir.unwrapFakeOverridesOrDelegated() - data.append(if (fir.isVar) "var" else "val").append(" ") - renderListInTriangles(fir.typeParameters, data, withSpace = true) - - val receiver = fir.receiverParameter?.typeRef?.render() - when { - receiver != null -> data.append(receiver).append(".").append(symbol.callableId.callableName) - fir.dispatchReceiverType != null -> { - val dispatchReceiver = fir.dispatchReceiverType?.tryToRenderConeAsFunctionTypeString() - data.append("($dispatchReceiver)").append(".").append(symbol.callableId.callableName) - } - else -> { - val name = symbol.callableId.let { if (it.packageName.asString().isEmpty()) it.callableName else it } - data.append(name.toString().removeCurrentFilePackage()) - } - } - - data.append(": ").append(fir.returnTypeRef.render()) - } - - private fun renderFunctionSymbol(symbol: FirNamedFunctionSymbol, data: StringBuilder, call: FirFunctionCall? = null) { - data.append("fun ") - val fir = symbol.fir.unwrapFakeOverridesOrDelegated() - renderListInTriangles(fir.typeParameters, data, true) - - val id = getSymbolId(symbol) - val callableName = symbol.callableId.callableName - val receiverParameterType = fir.receiverParameter?.typeRef - - if (call == null) { - // call is null for callable reference - if (receiverParameterType == null) { - symbol.callableId.className?.let { data.append("($it).$callableName") } ?: data.append(callableName) - } else { - data.append("${receiverParameterType.render()}.$callableName") - } - return - } - - var withExtensionFunctionType = false - - val extensionReceiver = call.extensionReceiver - val dispatchReceiver = call.dispatchReceiver - when { - extensionReceiver != null -> { - // render type from symbol because this way it will be consistent with psi render - fir.receiverParameter?.accept(this, data) - data.append(".").append(callableName) - } - dispatchReceiver?.resolvedType?.isExtensionFunctionType == true-> { - withExtensionFunctionType = true - fir.valueParameters.first().returnTypeRef.accept(this, data) - data.append(".").append(callableName) - } - dispatchReceiver != null -> { - data.append("(") - val dispatch = fir.dispatchReceiverType!!.tryToRenderConeAsFunctionTypeString() - .let { if (it.endsWith("!")) it.dropLast(1) else it } // this hack drop flexible annotation for receiver - data.append(dispatch).append(").").append(callableName) - } - else -> { - data.append(id) - if (symbol.callableId.className != null) data.append(".") - data.append(callableName) - } - } - - renderListInTriangles(call.typeArguments, data) - val valueParameters = fir.valueParameters.let { if (withExtensionFunctionType) it.drop(1) else it } - visitValueParameters(valueParameters, data) - data.append(": ") - fir.returnTypeRef.accept(this, data) - } - - override fun visitElement(element: FirElement, data: StringBuilder) { - element.acceptChildren(this, data) - } - - override fun visitErrorNamedReference(errorNamedReference: FirErrorNamedReference, data: StringBuilder) { - data.append(errorNamedReference.name) - } - - private fun visitConstructor(call: FirResolvable, data: StringBuilder) { - when (val calleeReference = call.calleeReference) { - !is FirResolvedNamedReference -> data.append("[ERROR: Unresolved]") - else -> visitConstructor(calleeReference.resolvedSymbol.fir as FirConstructor, data) - } - } - - override fun visitConstructor(constructor: FirConstructor, data: StringBuilder) { - renderConstructorSymbol(constructor.symbol, data) - visitValueParameters(constructor.unwrapFakeOverridesOrDelegated().valueParameters, data) - } - - override fun visitTypeParameterRef(typeParameterRef: FirTypeParameterRef, data: StringBuilder) { - visitTypeParameter(typeParameterRef.symbol.fir, data) - } - - override fun visitOuterClassTypeParameterRef(outerClassTypeParameterRef: FirOuterClassTypeParameterRef, data: StringBuilder) { - visitTypeParameterRef(outerClassTypeParameterRef, data) - } - - override fun visitConstructedClassTypeParameterRef(constructedClassTypeParameterRef: FirConstructedClassTypeParameterRef, data: StringBuilder - ) { - visitTypeParameterRef(constructedClassTypeParameterRef, data) - } - - override fun visitTypeParameter(typeParameter: FirTypeParameter, data: StringBuilder) { - data.append(typeParameter.name) - val bounds = typeParameter.bounds.filterNot { it.render() == "kotlin/Any?" } - if (bounds.isNotEmpty()) { - data.append(" : ") - bounds.joinTo(data, separator = ", ") { it.render() } - } - } - - override fun visitBackingFieldReference(backingFieldReference: FirBackingFieldReference, data: StringBuilder) { - val firProperty = backingFieldReference.resolvedSymbol.fir - data.append(if (firProperty.isVar) "var " else "val ") - .append(stack.getPathByName("field")) - .append("field: ") - .append(firProperty.returnTypeRef.render()) - } - - override fun visitProperty(property: FirProperty, data: StringBuilder) { - if (property.isLocal) { - visitVariable(property, data) - return - } - data.append(property.returnTypeRef.render()) - } - - private fun visitValueParameters(valueParameters: List, data: StringBuilder) { - valueParameters.joinTo(data, separator = ", ", prefix = "(", postfix = ")") { - it.render() - } - } - - override fun visitValueParameter(valueParameter: FirValueParameter, data: StringBuilder) { - if (valueParameter.isVararg) { - data.append("vararg ") - valueParameter.returnTypeRef.coneType.arrayElementType()?.localTypeProjectionRenderer(data) - } else { - valueParameter.returnTypeRef.accept(this, data) - } - valueParameter.defaultValue?.let { data.append(" = ...") } - } - - override fun visitVariable(variable: FirVariable, data: StringBuilder) { - data.append(variable.returnTypeRef.render()) - } - - override fun visitNamedReference(namedReference: FirNamedReference, data: StringBuilder) { - if (namedReference is FirErrorNamedReference) { - data.append(namedReference.diagnostic.dump()) - return - } - visitElement(namedReference, data) - } - - private fun ConeDiagnostic.dump(): String { - return "[ERROR : ${reason}]" - } - - override fun visitResolvedNamedReference(resolvedNamedReference: FirResolvedNamedReference, data: StringBuilder) { - val symbol = resolvedNamedReference.resolvedSymbol - renderImplicitReceiver(symbol, resolvedNamedReference.source.psi) - when { - symbol is FirPropertySymbol && !symbol.fir.isLocal -> renderPropertySymbol(symbol, data) - symbol is FirNamedFunctionSymbol -> { - val fir = symbol.fir - data.append(stack.getPathByName(resolvedNamedReference.name.asString())) - .append(resolvedNamedReference.name) - .append(": ") - fir.dispatchReceiverType?.tryToRenderConeAsFunctionType(data) - } - symbol is FirFieldSymbol -> renderField(symbol.fir, data) - else -> (symbol.fir as? FirVariable)?.let { renderVariable(it, data) } - } - } - - override fun visitResolvedErrorReference(resolvedErrorReference: FirResolvedErrorReference, data: StringBuilder) { - visitResolvedNamedReference(resolvedErrorReference, data) - data.append(resolvedErrorReference.diagnostic.dump()) - } - - override fun visitResolvedCallableReference(resolvedCallableReference: FirResolvedCallableReference, data: StringBuilder) { - when (val symbol = resolvedCallableReference.resolvedSymbol) { - is FirPropertySymbol -> renderPropertySymbol(symbol, data) - is FirFieldSymbol -> renderField(symbol.fir, data) - is FirConstructorSymbol -> visitConstructor(symbol.fir, data) - is FirNamedFunctionSymbol -> { - renderFunctionSymbol(symbol, data) - - val fir = symbol.fir - visitValueParameters(fir.valueParameters, data) - data.append(": ") - fir.returnTypeRef.accept(this, data) - } - } - } - - override fun visitAnnotationCall(annotationCall: FirAnnotationCall, data: StringBuilder) { - visitConstructor(annotationCall, data) - } - - override fun visitAnnotation(annotation: FirAnnotation, data: StringBuilder) {} - - override fun visitDelegatedConstructorCall(delegatedConstructorCall: FirDelegatedConstructorCall, data: StringBuilder) { - val coneClassType = delegatedConstructorCall.constructedTypeRef.coneTypeSafe() - if (coneClassType != null) { - visitConstructor(delegatedConstructorCall, data) - } else { - data.append("[ERROR : ${delegatedConstructorCall.constructedTypeRef.render()}]") - } - } - - override fun visitComparisonExpression(comparisonExpression: FirComparisonExpression, data: StringBuilder) { - data.append("CMP(${comparisonExpression.operation.operator}, ") - comparisonExpression.compareToCall.accept(this, data) - data.append(")") - } - - override fun visitTypeOperatorCall(typeOperatorCall: FirTypeOperatorCall, data: StringBuilder) { - //skip rendering for as/as?/is/!is - } - - override fun visitAssignmentOperatorStatement(assignmentOperatorStatement: FirAssignmentOperatorStatement, data: StringBuilder) { - data.append("assignment operator statement ${assignmentOperatorStatement.operation}") - } - - override fun visitEqualityOperatorCall(equalityOperatorCall: FirEqualityOperatorCall, data: StringBuilder) { - data.append("EQ operator call") - } - - override fun visitSafeCallExpression(safeCallExpression: FirSafeCallExpression, data: StringBuilder) { - safeCallExpression.receiver.accept(this, data) - data.append("?.{ ") - safeCallExpression.selector.accept(this, data) - data.append(" }") - } - - override fun visitCheckedSafeCallSubject(checkedSafeCallSubject: FirCheckedSafeCallSubject, data: StringBuilder) { - data.append("\$subj\$") - } - - override fun visitImplicitInvokeCall(implicitInvokeCall: FirImplicitInvokeCall, data: StringBuilder) { - visitFunctionCall(implicitInvokeCall, data) - } - - override fun visitFunctionCall(functionCall: FirFunctionCall, data: StringBuilder) { - when (val callee = functionCall.calleeReference) { - is FirResolvedNamedReference -> { - if (functionCall.explicitReceiver == null) { - renderImplicitReceiver(callee.resolvedSymbol, functionCall.source.psi) - } - when (callee.resolvedSymbol) { - is FirConstructorSymbol -> visitConstructor(callee.resolvedSymbol.fir as FirConstructor, data) - else -> renderFunctionSymbol(callee.resolvedSymbol as FirNamedFunctionSymbol, data, functionCall) - } - if (callee is FirResolvedErrorReference) { - data.append(callee.diagnostic.dump()) - } - } - is FirErrorNamedReference -> data.append(callee.diagnostic.dump()) - } - } - - override fun visitConstExpression(constExpression: FirConstExpression, data: StringBuilder) { - when (constExpression.kind) { - ConstantValueKind.String -> return - ConstantValueKind.Null -> constExpression.resolvedType.tryToRenderConeAsFunctionType(data) - else -> data.append(constExpression.kind) - } - } - - override fun visitResolvedQualifier(resolvedQualifier: FirResolvedQualifier, data: StringBuilder) { - val fir = resolvedQualifier.symbol?.fir - when { - fir is FirRegularClass && fir.classKind != ClassKind.ENUM_CLASS && fir.companionObjectSymbol?.defaultType() == resolvedQualifier.coneTypeSafe() -> { - data.append("companion object ") - data.append(resolvedQualifier.resolvedType.toFirResolvedTypeRef().render()).append(": ") - data.append(fir.symbol.classId.asString().removeCurrentFilePackage()) - } - fir is FirClass -> { - data.append(fir.classKind.name.toLowerCaseAsciiOnly().replace("_", " ")).append(" ") - data.append(fir.symbol.classId.asString().removeCurrentFilePackage()) - renderListInTriangles(fir.typeParameters, data) - val superTypes = fir.superTypeRefs - .map { it.render() } - .filter { it != "kotlin/Any" } - .sorted() - if (superTypes.isNotEmpty()) superTypes.joinTo(data, prefix = ": ", separator = ", ") - } - } - } - - override fun visitVariableAssignment(variableAssignment: FirVariableAssignment, data: StringBuilder) { - //data.append("variable assignment") - } - - override fun visitStarProjection(starProjection: FirStarProjection, data: StringBuilder) { - data.append("*") - } - - override fun visitTypeProjectionWithVariance(typeProjectionWithVariance: FirTypeProjectionWithVariance, data: StringBuilder) { - val variance = typeProjectionWithVariance.variance.label - if (variance.isNotEmpty()) data.append("$variance ") - typeProjectionWithVariance.typeRef.accept(this, data) - } - - override fun visitResolvedTypeRef(resolvedTypeRef: FirResolvedTypeRef, data: StringBuilder) { - resolvedTypeRef.type.tryToRenderConeAsFunctionType(data) - } - - override fun visitErrorTypeRef(errorTypeRef: FirErrorTypeRef, data: StringBuilder) { - data.append("[ERROR : ${errorTypeRef.diagnostic.reason}]") - } - - override fun visitTypeRefWithNullability(typeRefWithNullability: FirTypeRefWithNullability, data: StringBuilder) { - if (typeRefWithNullability.isMarkedNullable) { - data.append("?") - } - } - - override fun visitGetClassCall(getClassCall: FirGetClassCall, data: StringBuilder) { - getClassCall.argument.accept(this, data) - } - - override fun visitArrayLiteral(arrayLiteral: FirArrayLiteral, data: StringBuilder) { - val name = arrayLiteral.resolvedType.classId!!.shortClassName.asString() - val typeArguments = arrayLiteral.resolvedType.typeArguments - val typeParameters = if (typeArguments.isEmpty()) "" else " " - data.append("fun$typeParameters ${name.replaceFirstChar(Char::lowercaseChar)}Of") - typeArguments.firstOrNull()?.let { - data.append("<") - it.tryToRenderConeAsFunctionType(data) - data.append(">") - } - val valueParameter = name.replace("Array", "").takeIf { it.isNotEmpty() } ?: "T" - data.append("(vararg $valueParameter): $name${typeParameters.trim()}") // TODO change "T" to concrete type is array is primitive - } - - private fun FirBasedSymbol<*>.isLocalDeclaration(): Boolean { - return when (val fir = this.fir) { - is FirConstructor -> fir.returnTypeRef.coneType.isLocal() - is FirCallableDeclaration -> { - fir.dispatchReceiverClassLookupTagOrNull()?.toFirRegularClassSymbol(session)?.isLocal ?: false - } - else -> false - } - } - - private fun ConeKotlinType.isLocal(): Boolean { - if (this !is ConeClassLikeType) return false - return this.lookupTag.toFirRegularClassSymbol(session)?.isLocal == true - } - - // id == packageName + className - private fun getSymbolId(symbol: FirBasedSymbol<*>?): String { - return when (symbol) { - is FirCallableSymbol<*> -> { - if (symbol.isLocalDeclaration()) { - val callableName = symbol.callableId.callableName.asString() - stack.getPathByName(callableName) + callableName - } else { - symbol.callableId.withoutName().removeCurrentFilePackage() - } - } - is FirClassLikeSymbol<*> -> symbol.classId.getWithoutCurrentPackage() - else -> "" - } - } - - private fun CallableId.withoutName(): String { - return buildString { - append(packageName.asString().replace('.', '/')) - append("/") - if (className != null) { - append(className) - } - } - } - } -} diff --git a/compiler/visualizer/render-fir/src/org/jetbrains/kotlin/compiler/visualizer/Psi2FirMapper.kt b/compiler/visualizer/render-fir/src/org/jetbrains/kotlin/compiler/visualizer/Psi2FirMapper.kt deleted file mode 100644 index c389348a51e..00000000000 --- a/compiler/visualizer/render-fir/src/org/jetbrains/kotlin/compiler/visualizer/Psi2FirMapper.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2010-2019 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.compiler.visualizer - -import com.intellij.psi.PsiElement -import org.jetbrains.kotlin.fir.FirElement -import org.jetbrains.kotlin.fir.expressions.FirCallableReferenceAccess -import org.jetbrains.kotlin.fir.psi -import org.jetbrains.kotlin.fir.visitors.FirVisitorVoid -import org.jetbrains.kotlin.psi -import org.jetbrains.kotlin.psi.KtCallableReferenceExpression - -class Psi2FirMapper(val map: MutableMap>) : FirVisitorVoid() { - override fun visitElement(element: FirElement) { - val psi = element.psi - if (psi != null) { - if (map.putIfAbsent(psi, mutableListOf(element)) != null) { - map[psi]?.add(element) - } - } - element.acceptChildren(this) - } - - override fun visitCallableReferenceAccess(callableReferenceAccess: FirCallableReferenceAccess) { - callableReferenceAccess.extensionReceiver?.let { visitElement(it) } - callableReferenceAccess.dispatchReceiver?.let { visitElement(it) } - callableReferenceAccess.explicitReceiver?.let { visitElement(it) } - - val psi = (callableReferenceAccess.calleeReference.psi as? KtCallableReferenceExpression)?.children?.last() - ?: return callableReferenceAccess.calleeReference.accept(this) - if (map.putIfAbsent(psi, mutableListOf(callableReferenceAccess.calleeReference)) != null) { - map[psi]?.add(callableReferenceAccess.calleeReference) - } - } -} diff --git a/compiler/visualizer/render-psi/build.gradle.kts b/compiler/visualizer/render-psi/build.gradle.kts deleted file mode 100644 index 0ffe9e91cfd..00000000000 --- a/compiler/visualizer/render-psi/build.gradle.kts +++ /dev/null @@ -1,14 +0,0 @@ -plugins { - kotlin("jvm") - id("jps-compatible") -} - -dependencies { - api(project(":compiler:visualizer:common")) - compileOnly(intellijCore()) -} - -sourceSets { - "main" { projectDefault() } - "test" { } -} diff --git a/compiler/visualizer/render-psi/src/org/jetbrains/kotlin/compiler/visualizer/PsiVisualizer.kt b/compiler/visualizer/render-psi/src/org/jetbrains/kotlin/compiler/visualizer/PsiVisualizer.kt deleted file mode 100644 index 2c762b87cfa..00000000000 --- a/compiler/visualizer/render-psi/src/org/jetbrains/kotlin/compiler/visualizer/PsiVisualizer.kt +++ /dev/null @@ -1,596 +0,0 @@ -/* - * Copyright 2010-2019 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.compiler.visualizer - -import com.intellij.psi.PsiElement -import org.jetbrains.kotlin.KtNodeTypes -import org.jetbrains.kotlin.analyzer.AnalysisResult -import org.jetbrains.kotlin.builtins.KotlinBuiltIns -import org.jetbrains.kotlin.compiler.visualizer.Annotator.annotate -import org.jetbrains.kotlin.descriptors.* -import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor -import org.jetbrains.kotlin.descriptors.impl.TypeAliasConstructorDescriptor -import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.name.SpecialNames -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.getChildOfType -import org.jetbrains.kotlin.renderer.ClassifierNamePolicy -import org.jetbrains.kotlin.renderer.DescriptorRenderer -import org.jetbrains.kotlin.renderer.ParameterNameRenderingPolicy -import org.jetbrains.kotlin.renderer.render -import org.jetbrains.kotlin.resolve.BindingContext.* -import org.jetbrains.kotlin.resolve.bindingContextUtil.getAbbreviatedTypeOrType -import org.jetbrains.kotlin.resolve.calls.util.getCall -import org.jetbrains.kotlin.resolve.calls.util.getResolvedCall -import org.jetbrains.kotlin.resolve.calls.util.getType -import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall -import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind -import org.jetbrains.kotlin.resolve.calls.util.isSingleUnderscore -import org.jetbrains.kotlin.resolve.descriptorUtil.declaresOrInheritsDefaultValue -import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe -import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue -import org.jetbrains.kotlin.types.* -import org.jetbrains.kotlin.types.expressions.DoubleColonLHS -import java.util.* - -class PsiVisualizer(private val file: KtFile, analysisResult: AnalysisResult) : BaseRenderer() { - private val bindingContext = analysisResult.bindingContext - private val filePackage = file.packageFqName.toString().replace(".", "/") - private val argumentsLabel = "" - - val descriptorRenderer = PsiDescriptorRenderer() - - override fun render(): String { - file.accept(Renderer()) - return annotate(file.text, getAnnotations()).joinToString("\n") - } - - inner class Renderer : KtVisitorVoid() { - private val implicitReceivers = mutableListOf() - private var lastCallWithLambda = "" - - private fun renderType(type: KotlinType?): String { - return type?.let { descriptorRenderer.renderType(it) } ?: "[ERROR: unknown type]" - } - - private fun renderType(descriptor: CallableDescriptor?): String { - return renderType(descriptor?.returnType) - } - - private fun renderType(expression: KtExpression?): String { - return renderType(expression?.let { bindingContext.getType(it) }) - } - - override fun visitElement(element: PsiElement) { - element.acceptChildren(this) - } - - override fun visitKtElement(element: KtElement) { - element.acceptChildren(this) - } - - override fun visitPackageDirective(directive: KtPackageDirective) { - //don't resolve package names - } - - override fun visitSuperExpression(expression: KtSuperExpression) { - //don't resolve super expression - } - - override fun visitThisExpression(expression: KtThisExpression) { - //don't resolve this expression - } - - override fun visitNamedFunction(function: KtNamedFunction) { - if (function.bodyExpression != null && function.equalsToken != null) { - addAnnotation(renderType(function.bodyExpression!!.getType(bindingContext)), function.equalsToken!!) - } - super.visitNamedFunction(function) - } - - private fun renderVariableType(variable: KtVariableDeclaration) { - val descriptor = bindingContext[VARIABLE, variable] - if (variable.isSingleUnderscore) return - addAnnotation(renderType(descriptor), variable.nameIdentifier!!) - variable.acceptChildren(this) - } - - override fun visitProperty(property: KtProperty) = - renderVariableType(property) - - override fun visitDestructuringDeclarationEntry(multiDeclarationEntry: KtDestructuringDeclarationEntry) = - renderVariableType(multiDeclarationEntry) - - override fun visitParameter(parameter: KtParameter) { - if ((parameter.isLoopParameter && parameter.destructuringDeclaration == null) || parameter.ownerFunction is KtPropertyAccessor) { - addAnnotation(renderType(bindingContext[VALUE_PARAMETER, parameter]?.returnType), parameter.nameIdentifier!!) - } - super.visitParameter(parameter) - } - - override fun visitTypeReference(typeReference: KtTypeReference) { - if (typeReference.text.isEmpty()) { - return super.visitTypeReference(typeReference) - } - - val hasResolvedCall = with(object : KtVisitorVoid() { - var hasCall: Boolean = false - override fun visitKtElement(element: KtElement) { - if (!hasCall) { - element.getResolvedCall(bindingContext)?.let { - hasCall = true - element.accept(this@Renderer) - } ?: element.acceptChildren(this) - } - } - }) { - typeReference.accept(this) - this.hasCall - } - - if (!hasResolvedCall) { - val type = typeReference.getAbbreviatedTypeOrType(bindingContext) - addAnnotation(renderType(type), typeReference) - } - } - - override fun visitConstantExpression(expression: KtConstantExpression) { - addAnnotation(renderType(expression), expression) - } - - override fun visitConstructorCalleeExpression(constructorCalleeExpression: KtConstructorCalleeExpression) { - // this is hack for JvmField annotation, for some reason it is not represented as KtAnnotationEntry - if (constructorCalleeExpression.text == "JvmField") { - return addAnnotation("constructor jvm/JvmField()", constructorCalleeExpression) - } - super.visitConstructorCalleeExpression(constructorCalleeExpression) - } - - private fun renderCall(expression: KtExpression, renderOn: PsiElement = expression): ResolvedCall? { - val call = expression.getCall(bindingContext) - val resolvedCall = expression.getResolvedCall(bindingContext) - if (call == null) { - return null - } else if (resolvedCall == null) { - addAnnotation("[ERROR: not resolved]", expression) - return null - } - - fun addReceiverAnnotation(receiver: ReceiverValue?, receiverKind: ExplicitReceiverKind) { - if (receiver != null && resolvedCall.explicitReceiverKind != receiverKind) { - val index = implicitReceivers.indexOf(receiver) - if (index != -1) { - addAnnotation("this@$index", expression, deleteDuplicate = false) - } - } - } - - addReceiverAnnotation(resolvedCall.extensionReceiver, ExplicitReceiverKind.EXTENSION_RECEIVER) - addReceiverAnnotation(resolvedCall.dispatchReceiver, ExplicitReceiverKind.DISPATCH_RECEIVER) - - val descriptor = resolvedCall.candidateDescriptor.let { - if (it is TypeAliasConstructorDescriptor) it.underlyingConstructorDescriptor else it - } - val typeArguments = resolvedCall.typeArguments - .takeIf { it.isNotEmpty() } - ?.values?.joinToString(", ", "<", ">") { renderType(it) } ?: "" - val annotation = descriptorRenderer.render(descriptor).replace(argumentsLabel, typeArguments) - addAnnotation(annotation, renderOn, deleteDuplicate = false) - - return resolvedCall - } - - override fun visitDotQualifiedExpression(expression: KtDotQualifiedExpression) { - val descriptor = bindingContext[QUALIFIER, expression]?.descriptor - if (descriptor is ClassDescriptor && descriptor.kind == ClassKind.ENUM_ENTRY) { - // if not here, enum entry will be processed as KtSimpleNameExpression - // at this point it is easier to get corresponding qualifier - addAnnotation(descriptorRenderer.render(descriptor), expression.selectorExpression) - } - super.visitDotQualifiedExpression(expression) - } - - override fun visitSimpleNameExpression(expression: KtSimpleNameExpression) { - val descriptor = bindingContext[QUALIFIER, expression]?.descriptor - if (descriptor != null) { - addAnnotation(descriptorRenderer.render(descriptor), expression) - } else { - renderCall(expression) - } - } - - override fun visitBinaryExpression(expression: KtBinaryExpression) { - val opName = expression.operationReference.getReferencedName() - if (opName == "==" || opName == "!=") { - addAnnotation("EQ operator call", expression.operationReference) - expression.left?.accept(this) - expression.right?.accept(this) - return - } - expression.left?.takeIf { it.node.elementType == KtNodeTypes.ARRAY_ACCESS_EXPRESSION && opName == "=" }?.let { - renderCall(it, expression.operationReference) - } - super.visitBinaryExpression(expression) - } - - override fun visitIfExpression(expression: KtIfExpression) { - addAnnotation(renderType(expression), expression.ifKeyword) - super.visitIfExpression(expression) - } - - override fun visitWhenExpression(expression: KtWhenExpression) { - addAnnotation(renderType(expression), expression.whenKeyword) - super.visitWhenExpression(expression) - } - - override fun visitWhenEntry(ktWhenEntry: KtWhenEntry) { - addAnnotation(renderType(ktWhenEntry.expression), ktWhenEntry.expression!!) - super.visitWhenEntry(ktWhenEntry) - } - - override fun visitLambdaExpression(lambdaExpression: KtLambdaExpression) { - val descriptor = bindingContext[DECLARATION_TO_DESCRIPTOR, lambdaExpression.functionLiteral] as AnonymousFunctionDescriptor - val extensionReceiver = descriptor.extensionReceiverParameter ?: return super.visitLambdaExpression(lambdaExpression) - addAnnotation("$lastCallWithLambda@${implicitReceivers.size}", lambdaExpression) - - implicitReceivers += extensionReceiver.value - super.visitLambdaExpression(lambdaExpression) - implicitReceivers -= extensionReceiver.value - } - - override fun visitCallExpression(expression: KtCallExpression) { - val resolvedCall = renderCall(expression) ?: return super.visitCallExpression(expression) - - if (expression.getChildOfType() != null) { - lastCallWithLambda = resolvedCall.resultingDescriptor.name.asString() - } - for (child in expression.children) { - if (child.node.elementType != KtNodeTypes.REFERENCE_EXPRESSION) { - child.accept(this) - } - } - } - - override fun visitClassLiteralExpression(expression: KtClassLiteralExpression) { - val doubleColonLhs = bindingContext[DOUBLE_COLON_LHS, expression.receiverExpression] - doubleColonLhs?.takeIf { it is DoubleColonLHS.Type }?.let { - addAnnotation(descriptorRenderer.render(it.type.constructor.declarationDescriptor!!), expression) - } ?: super.visitClassLiteralExpression(expression) - } - - override fun visitPrefixExpression(expression: KtPrefixExpression) { - val opName = expression.operationReference.getReferencedName() - if (expression.baseExpression?.node?.elementType == KtNodeTypes.INTEGER_CONSTANT && opName == "-") { - return expression.baseExpression!!.accept(this) - } - super.visitPrefixExpression(expression) - } - } - - inner class PsiDescriptorRenderer( - private val needToRenderSpecialFun: Boolean = false - ) : DeclarationDescriptorVisitor { - private val typeRenderer: DescriptorRenderer = DescriptorRenderer.withOptions { - withDefinedIn = false - modifiers = emptySet() - classifierNamePolicy = object : ClassifierNamePolicy { - override fun renderClassifier(classifier: ClassifierDescriptor, renderer: DescriptorRenderer): String { - if (classifier.name == SpecialNames.NO_NAME_PROVIDED) return "" - return renderFqName(classifier) - } - } - includeAdditionalModifiers = false - parameterNameRenderingPolicy = ParameterNameRenderingPolicy.NONE - parameterNamesInFunctionalTypes = false - - withoutTypeParameters = true - renderUnabbreviatedType = false - renderTypeExpansions = true - } - - private fun CallableDescriptor.isSpecial(): Boolean { - return this.name.asString().contains("SPECIAL-FUNCTION") - } - - private fun DeclarationDescriptor.resolveFakeOverride(): DeclarationDescriptor { - fun CallableMemberDescriptor.isFakeOverrideOrDelegate(): Boolean { - return kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE || kind == CallableMemberDescriptor.Kind.DELEGATION - } - - var current = this as? CallableMemberDescriptor - while (current != null && current.isFakeOverrideOrDelegate()) { - current = current.overriddenDescriptors.singleOrNull { !it.isFakeOverrideOrDelegate() } - ?: current.overriddenDescriptors.firstOrNull() - } - return current ?: this - } - - fun render(declarationDescriptor: DeclarationDescriptor): String { - if (declarationDescriptor is CallableDescriptor && declarationDescriptor.isSpecial()) { - return if (needToRenderSpecialFun) this.renderSpecialFunction(declarationDescriptor) else "" - } - return buildString { - declarationDescriptor.resolveFakeOverride().original.accept(this@PsiDescriptorRenderer, this) - } - } - - fun renderType(type: KotlinType): String { - return typeRenderer.renderType(type) - } - - private fun renderName(descriptor: DeclarationDescriptor, hasReceiver: Boolean = false): String { - return if (hasReceiver) { - descriptor.name.asString() - } else { - renderFqName(descriptor) - } - } - - private fun renderFqName(descriptor: DeclarationDescriptor, removeCurrentPackage: Boolean = true): String { - if (descriptor is TypeParameterDescriptor) return descriptor.name.render() - val fqName = qualifierNameCombine(descriptor) - return if (removeCurrentPackage) removeCurrentFilePackage(fqName) else fqName - } - - private fun qualifierNameCombine(descriptor: DeclarationDescriptor): String { - val nameString = descriptor.name.render().let { if (it == SpecialNames.NO_NAME_PROVIDED.asString()) "" else it } - if (nameString == FqName.ROOT.toString()) return "" - - val containingDeclaration = descriptor.containingDeclaration - val qualifier = qualifierName(containingDeclaration) - val separator = - if (containingDeclaration is PackageFragmentDescriptor || containingDeclaration is PackageViewDescriptor) "/" else "." - return if (qualifier != "") qualifier + separator + nameString else nameString - } - - private fun qualifierName(descriptor: DeclarationDescriptor?): String = when (descriptor) { - is ModuleDescriptor, null -> "" - is PackageFragmentDescriptor, is PackageViewDescriptor -> descriptor.fqNameUnsafe.render().replace(".", "/") - else -> qualifierNameCombine(descriptor) - } - - private fun removeCurrentFilePackage(fqName: String): String { - return if (fqName.startsWith(filePackage) && !fqName.substring(filePackage.length + 1).contains("/")) { - fqName.replaceFirst("$filePackage/", "") - } else { - fqName - } - } - - private fun renderReceiver(descriptor: CallableDescriptor, data: StringBuilder): ReceiverParameterDescriptor? { - return descriptor.extensionReceiverParameter?.also { - visitReceiverParameterDescriptor(it, data) - data.append(".") - } ?: descriptor.dispatchReceiverParameter?.also { - data.append("(") - visitReceiverParameterDescriptor(it, data) - data.append(").") - } - } - - private fun renderSuperTypes(klass: ClassDescriptor, builder: StringBuilder) { - if (KotlinBuiltIns.isNothing(klass.defaultType)) return - - val supertypes = klass.typeConstructor.supertypes - .filter { !KotlinBuiltIns.isAnyOrNullableAny(it) } - .map { renderType(it) } - .sorted() - - if (supertypes.isEmpty()) return - supertypes.joinTo(builder, prefix = ": ", separator = ", ") - } - - private fun renderValueParameter( - parameter: ValueParameterDescriptor, includeNames: Boolean, data: StringBuilder, topLevel: Boolean - ) { - renderVariable(parameter, includeNames, data, topLevel) - if (parameter.declaresOrInheritsDefaultValue()) { - data.append(" = ...") - } - } - - private fun renderVariable(variable: VariableDescriptor, includeName: Boolean, data: StringBuilder, topLevel: Boolean) { - val realType = variable.type - - val varargElementType = (variable as? ValueParameterDescriptor)?.varargElementType - val typeToRender = varargElementType ?: realType - if (varargElementType != null) data.append("vararg ") - - if (topLevel && variable !is ValueParameterDescriptor) data.append(if (variable.isVar) "var" else "val").append(" ") - if (includeName) { - data.append(renderName(variable)).append(": ") - } - - data.append(renderType(typeToRender)) - } - - private fun renderSpecialFunction(descriptor: CallableDescriptor): String { - val descriptorName = descriptor.name.asString() - val name = when { - descriptorName.contains("ELVIS") -> "?:" - descriptorName.contains("EXCLEXCL") -> "!!" - else -> "UNKNOWN" - } - val valueParameters = buildString { visitValueParameters(descriptor.valueParameters, this) } - val returnType = descriptor.returnType?.let { renderType(it) } ?: "[ERROR: unknown type]" - - return "fun $name $valueParameters: $returnType" - } - - override fun visitPackageFragmentDescriptor(descriptor: PackageFragmentDescriptor, data: StringBuilder) { - //data.append("package-fragment ${renderFqName(descriptor, removeCurrentPackage = false)}") - } - - override fun visitPackageViewDescriptor(descriptor: PackageViewDescriptor, data: StringBuilder) { - // don't render package because support the same logic in fir is very hard - //data.append("package ${renderFqName(descriptor, removeCurrentPackage = false)}") - } - - override fun visitVariableDescriptor(variable: VariableDescriptor, data: StringBuilder) { - renderVariable(variable, true, data, true) - } - - override fun visitFunctionDescriptor(function: FunctionDescriptor, data: StringBuilder) { - data.append("fun ") - - visitTypeParameters(function.typeParameters, data) - if (function.typeParameters.isNotEmpty()) data.append(" ") - - //render receiver - val receiver = renderReceiver(function, data) - - //render name - data.append(renderName(function, receiver != null)) - - //render type arguments - data.append(argumentsLabel) - - //render value parameters - visitValueParameters(function.valueParameters, data) - - //render return type - val returnType = function.returnType - data.append(": ").append(if (returnType == null) "[NULL]" else renderType(returnType)) - - renderWhereSuffix(function.typeParameters, data) - } - - private fun renderWhereSuffix(typeParameters: List, data: StringBuilder) { - val upperBoundStrings = ArrayList(0) - - for (typeParameter in typeParameters) { - typeParameter.upperBounds - .drop(1) // first parameter is rendered by renderTypeParameter - .mapTo(upperBoundStrings) { renderName(typeParameter) + " : " + renderType(it) } - } - - if (upperBoundStrings.isNotEmpty()) { - data.append(" where ") - upperBoundStrings.joinTo(data, ", ") - } - } - - private fun visitTypeParameters(typeParameters: List, data: StringBuilder) { - if (typeParameters.isNotEmpty()) { - data.append("<") - val iterator = typeParameters.iterator() - while (iterator.hasNext()) { - val typeParameterDescriptor = iterator.next() - visitTypeParameterDescriptor(typeParameterDescriptor, data) - if (iterator.hasNext()) { - data.append(", ") - } - } - data.append(">") - } - } - - override fun visitTypeParameterDescriptor(typeParameter: TypeParameterDescriptor, data: StringBuilder) { - data.append(renderName(typeParameter, true)) - val upperBoundsCount = typeParameter.upperBounds.size - if (upperBoundsCount >= 1) { - val upperBound = typeParameter.upperBounds.iterator().next() - if (!KotlinBuiltIns.isDefaultBound(upperBound)) { - data.append(" : ").append(renderType(upperBound)) - } - } - } - - override fun visitClassDescriptor(klass: ClassDescriptor, data: StringBuilder) { - data.append(DescriptorRenderer.getClassifierKindPrefix(klass)).append(" ") - - //render name - data.append(renderName(klass)) - - if (klass.kind == ClassKind.ENUM_ENTRY) return - - visitTypeParameters(klass.declaredTypeParameters, data) - - renderSuperTypes(klass, data) - renderWhereSuffix(klass.declaredTypeParameters, data) - } - - override fun visitTypeAliasDescriptor(typeAlias: TypeAliasDescriptor, data: StringBuilder) { - data.append("typealias").append(" ") - data.append(renderName(typeAlias)) - - visitTypeParameters(typeAlias.declaredTypeParameters, data) - - data.append(" = ").append(renderType(typeAlias.underlyingType)) - } - - override fun visitModuleDeclaration(descriptor: ModuleDescriptor, data: StringBuilder) { - data.append(renderName(descriptor)) - } - - override fun visitConstructorDescriptor(constructor: ConstructorDescriptor, data: StringBuilder) { - data.append("constructor").append(" ") - - val classDescriptor = constructor.containingDeclaration - - data.append(renderName(classDescriptor)) - visitTypeParameters(constructor.typeParameters, data) - - visitValueParameters(constructor.valueParameters, data) - - renderWhereSuffix(constructor.typeParameters, data) - } - - override fun visitScriptDescriptor(scriptDescriptor: ScriptDescriptor, data: StringBuilder) { - visitClassDescriptor(scriptDescriptor, data) - } - - override fun visitPropertyDescriptor(property: PropertyDescriptor, data: StringBuilder) { - data.append(if (property.isVar) "var" else "val").append(" ") - - if (property !is SyntheticPropertyDescriptor) { - visitTypeParameters(property.typeParameters, data) - if (property.typeParameters.isNotEmpty()) data.append(" ") - } - - //render receiver - val receiver = when (property) { - is SyntheticPropertyDescriptor -> renderReceiver(property.getMethod, data) - else -> renderReceiver(property, data) - } - - //render name - data.append(renderName(property, receiver != null)) - - //render return type - data.append(": ").append(renderType(property.type)) - - renderWhereSuffix(property.typeParameters, data) - } - - private fun visitValueParameters(parameters: List, data: StringBuilder) { - data.append("(") - for ((index, parameter) in parameters.withIndex()) { - renderValueParameter(parameter, false, data, false) - if (index != parameters.size - 1) { - data.append(", ") - } - } - data.append(")") - } - - override fun visitValueParameterDescriptor(parameter: ValueParameterDescriptor, data: StringBuilder) { - renderValueParameter(parameter, true, data, true) - } - - override fun visitPropertyGetterDescriptor(descriptor: PropertyGetterDescriptor, data: StringBuilder) { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun visitPropertySetterDescriptor(descriptor: PropertySetterDescriptor, data: StringBuilder) { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } - - override fun visitReceiverParameterDescriptor(descriptor: ReceiverParameterDescriptor, data: StringBuilder) { - data.append(renderType(descriptor.type)) - } - } -} diff --git a/compiler/visualizer/testData/rawBuilder/declarations/F.kt b/compiler/visualizer/testData/rawBuilder/declarations/F.kt deleted file mode 100644 index 56206509976..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/F.kt +++ /dev/null @@ -1,4 +0,0 @@ -open class A - - -class B : A diff --git a/compiler/visualizer/testData/rawBuilder/declarations/NestedOfAliasedType.kt b/compiler/visualizer/testData/rawBuilder/declarations/NestedOfAliasedType.kt deleted file mode 100644 index 2b5dde9d8c9..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/NestedOfAliasedType.kt +++ /dev/null @@ -1,13 +0,0 @@ -abstract class A { - abstract class Nested -} - -typealias TA = A - -// constructor A() -// │ -class B : TA() { -// constructor A.Nested() -// │ - class NestedInB : Nested() -} diff --git a/compiler/visualizer/testData/rawBuilder/declarations/NestedSuperType.kt b/compiler/visualizer/testData/rawBuilder/declarations/NestedSuperType.kt deleted file mode 100644 index d98bd7697e4..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/NestedSuperType.kt +++ /dev/null @@ -1,21 +0,0 @@ -package p - -abstract class My { -// constructor My() -// │ - abstract class NestedOne : My() { -// constructor My.NestedOne() -// │ - abstract class NestedTwo : NestedOne() { - - } - } -} - -// constructor My() -// │ -class Your : My() { -// constructor My.NestedOne() -// │ - class NestedThree : NestedOne() -} diff --git a/compiler/visualizer/testData/rawBuilder/declarations/annotation.kt b/compiler/visualizer/testData/rawBuilder/declarations/annotation.kt deleted file mode 100644 index d92c3b6449f..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/annotation.kt +++ /dev/null @@ -1,85 +0,0 @@ -// FIR_IGNORE -//constructor annotation/Target(vararg annotation/AnnotationTarget) -//│ -@Target( -// enum class annotation/AnnotationTarget: Enum -// │ enum entry annotation/AnnotationTarget.CLASS -// │ │ - AnnotationTarget.CLASS, -// enum class annotation/AnnotationTarget: Enum -// │ enum entry annotation/AnnotationTarget.PROPERTY -// │ │ - AnnotationTarget.PROPERTY, -// enum class annotation/AnnotationTarget: Enum -// │ enum entry annotation/AnnotationTarget.LOCAL_VARIABLE -// │ │ - AnnotationTarget.LOCAL_VARIABLE, -// enum class annotation/AnnotationTarget: Enum -// │ enum entry annotation/AnnotationTarget.VALUE_PARAMETER -// │ │ - AnnotationTarget.VALUE_PARAMETER, -// enum class annotation/AnnotationTarget: Enum -// │ enum entry annotation/AnnotationTarget.CONSTRUCTOR -// │ │ - AnnotationTarget.CONSTRUCTOR, -// enum class annotation/AnnotationTarget: Enum -// │ enum entry annotation/AnnotationTarget.FUNCTION -// │ │ - AnnotationTarget.FUNCTION, -// enum class annotation/AnnotationTarget: Enum -// │ enum entry annotation/AnnotationTarget.TYPE -// │ │ - AnnotationTarget.TYPE -) annotation class base - -//constructor base() -//│ -@base annotation class derived - -//constructor base() constructor base() -//│ │ -@base class correct(@base val x: Int) { -// constructor base() Int -// │ │ - @base constructor(): this(0) -} - -//constructor base() -//│ -@base enum class My { -// constructor base() -// │ - @base FIRST, -// constructor base() -// │ - @base SECOND -} - -//constructor base() -//│ constructor base() -//│ │ constructor base() -//│ │ │ -@base fun foo(@base y: @base Int): Int { -// constructor base() -// │ constructor base() -// │ │ constructor base() -// │ │ │ Int -// │ │ │ │ foo.bar.z: Int -// │ │ │ │ │ fun (Int).plus(Int): Int -// │ │ │ │ │ │ Int -// │ │ │ │ │ │ │ - @base fun bar(@base z: @base Int) = z + 1 -// constructor base() -// │ fun foo.bar(Int): Int -// │ Int │ foo.y: Int -// │ │ │ │ - @base val local = bar(y) -// val foo.local: Int -// │ - return local -} - -//constructor base() -//│ Int Int -//│ │ │ -@base val z = 0 diff --git a/compiler/visualizer/testData/rawBuilder/declarations/complexTypes.kt b/compiler/visualizer/testData/rawBuilder/declarations/complexTypes.kt deleted file mode 100644 index c5fc2fe6a69..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/complexTypes.kt +++ /dev/null @@ -1,15 +0,0 @@ -// FIR_IGNORE -package a.b - -class C { - inner class D { - - } -} - -interface Test { -// C.D, *> -// │ C.D, *> -// │ │ - val x: a.b.C.D, *> -} diff --git a/compiler/visualizer/testData/rawBuilder/declarations/constructorInObject.kt b/compiler/visualizer/testData/rawBuilder/declarations/constructorInObject.kt deleted file mode 100644 index 3e7c2800f67..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/constructorInObject.kt +++ /dev/null @@ -1,24 +0,0 @@ -object A { - constructor() - init {} -} - -enum class B { -// constructor B() -// │ - X() { - constructor() - } -} - -class C { - companion object { - constructor() - } -} - -// Any -// │ -val anonObject = object { - constructor() -} diff --git a/compiler/visualizer/testData/rawBuilder/declarations/constructorOfAnonymousObject.kt b/compiler/visualizer/testData/rawBuilder/declarations/constructorOfAnonymousObject.kt deleted file mode 100644 index e892121f09c..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/constructorOfAnonymousObject.kt +++ /dev/null @@ -1,30 +0,0 @@ -// FIR_IGNORE -private fun resolveAccessorCall( -// [ERROR : PropertyDescriptor] -// │ - suspendPropertyDescriptor: PropertyDescriptor, -// [ERROR : TranslationContext] -// │ - context: TranslationContext -// [ERROR : ResolvedCall]<[ERROR : PropertyDescriptor]> -// │ -): ResolvedCall { -// [ERROR : ResolvedCall]<[ERROR : PropertyDescriptor]> -// │ - return object : ResolvedCall { -// [ERROR : ] -// │ [ERROR: not resolved] -// │ │ [ERROR: not resolved] -// │ │ │ - override fun getStatus() = ResolutionStatus.SUCCESS - -// [ERROR : PropertyDescriptor] -// │ resolveAccessorCall.suspendPropertyDescriptor: [ERROR : PropertyDescriptor] -// │ │ - override fun getCandidateDescriptor() = suspendPropertyDescriptor -// [ERROR : PropertyDescriptor] -// │ resolveAccessorCall.suspendPropertyDescriptor: [ERROR : PropertyDescriptor] -// │ │ - override fun getResultingDescriptor() = suspendPropertyDescriptor - } -} diff --git a/compiler/visualizer/testData/rawBuilder/declarations/contracts/newSyntax/functionWithBothOldAndNewSyntaxContractDescription.kt b/compiler/visualizer/testData/rawBuilder/declarations/contracts/newSyntax/functionWithBothOldAndNewSyntaxContractDescription.kt deleted file mode 100644 index fc637b2bdd4..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/contracts/newSyntax/functionWithBothOldAndNewSyntaxContractDescription.kt +++ /dev/null @@ -1,17 +0,0 @@ -// FIR_IGNORE -fun test1(s: String?) contract [returnsNotNull()] { -// [ERROR: not resolved] -// │ - contract { -// [ERROR: not resolved] -// │ [ERROR: not resolved] -// │ │ test1.s: String? -// │ │ │ EQ operator call -// │ │ │ │ Nothing? -// │ │ │ │ │ - returns() implies (s != null) - } -// fun test1(String?): Unit -// │ - test1() -} diff --git a/compiler/visualizer/testData/rawBuilder/declarations/contracts/newSyntax/propertyAccessorsContractDescription.kt b/compiler/visualizer/testData/rawBuilder/declarations/contracts/newSyntax/propertyAccessorsContractDescription.kt deleted file mode 100644 index 80fe82f8fcd..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/contracts/newSyntax/propertyAccessorsContractDescription.kt +++ /dev/null @@ -1,60 +0,0 @@ -// new contracts syntax for property accessors -class MyClass { -// Int Int -// │ │ - var myInt: Int = 0 -// Int -// │ - get() contract [returnsNotNull()] = 1 -// Int -// │ - set(value) { -// var MyClass..field: Int -// │ MyClass..value: Int -// │ │ fun (Int).times(Int): Int -// │ │ │ Int -// │ │ │ │ - field = value * 10 - } -} - -class AnotherClass(multiplier: Int) { -// Int Int -// │ │ - var anotherInt: Int = 0 -// Int -// │ - get() contract [returnsNotNull()] = 1 -// Int -// │ - set(value) contract [returns()] { -// var AnotherClass..field: Int -// │ AnotherClass..value: Int -// │ │ [ERROR: not resolved] -// │ │ │ [ERROR: not resolved] -// │ │ │ │ - field = value * multiplier - } -} - -class SomeClass(multiplier: Int?) { -// Int Int -// │ │ - var someInt: Int = 0 -// Int -// │ - get() contract [returnsNotNull()] = 1 -// EQ operator call -// Int │ [ERROR: unknown type] -// │ │ │ - set(value) contract [returns() implies (value != null)] { -// SomeClass..value: Int -// │ [ERROR: not resolved] -// │ │ - value ?: throw NullArgumentException() -// var SomeClass..field: Int -// │ SomeClass..value: Int -// │ │ - field = value - } -} diff --git a/compiler/visualizer/testData/rawBuilder/declarations/contracts/newSyntax/simpleFunctionsContractDescription.kt b/compiler/visualizer/testData/rawBuilder/declarations/contracts/newSyntax/simpleFunctionsContractDescription.kt deleted file mode 100644 index a7b4bb684f9..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/contracts/newSyntax/simpleFunctionsContractDescription.kt +++ /dev/null @@ -1,16 +0,0 @@ -// FIR_IGNORE -// new contracts syntax for simple functions -// EQ operator call -// [ERROR : MyClass]? │ [ERROR: unknown type] [ERROR: unknown type] -// │ │ │ │ -fun test1(s: MyClass?) contract [returns() implies (s != null), returns() implies (s is MySubClass)] { -// [ERROR: not resolved] -// │ - test_1() -} - -fun test2() contract [returnsNotNull()] { -// fun test2(): Unit -// │ - test2() -} diff --git a/compiler/visualizer/testData/rawBuilder/declarations/contracts/oldSyntax/contractDescription.kt b/compiler/visualizer/testData/rawBuilder/declarations/contracts/oldSyntax/contractDescription.kt deleted file mode 100644 index 3c7afcfe45e..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/contracts/oldSyntax/contractDescription.kt +++ /dev/null @@ -1,126 +0,0 @@ -// FIR_IGNORE -// Should have raw description -fun test_1() { -// [ERROR: not resolved] -// │ - contract { -// [ERROR: not resolved] -// │ - callsInPlace() - } -// fun test_1(): Unit -// │ - test_1() -} - -fun test_2() { -// fun contracts/contract(contracts/ContractBuilder.() -> Unit): Unit -// │ contract@0 -// │ │ - kotlin.contracts.contract { -// fun (contracts/ContractBuilder).callsInPlace(Function, contracts/InvocationKind = ...): contracts/CallsInPlace -// this@0 -// │ - callsInPlace() -// fun (contracts/ContractBuilder).callsInPlace(Function, contracts/InvocationKind = ...): contracts/CallsInPlace -// this@0 -// │ - callsInPlace() - } -// fun test_2(): Unit -// │ - test_2() -} - -// Int Int -// │ │ -var test_3: Int = 1 - get() { -// [ERROR: not resolved] -// │ - contract { -// [ERROR: not resolved] -// │ - callsInPlace() - } -// Int -// │ - return 1 - } -// Int -// │ - set(value) { -// fun contracts/contract(contracts/ContractBuilder.() -> Unit): Unit -// │ contract@0 -// │ │ - kotlin.contracts.contract { -// fun (contracts/ContractBuilder).callsInPlace(Function, contracts/InvocationKind = ...): contracts/CallsInPlace -// this@0 -// │ - callsInPlace() -// fun (contracts/ContractBuilder).callsInPlace(Function, contracts/InvocationKind = ...): contracts/CallsInPlace -// this@0 -// │ - callsInPlace() - } - } - -fun test_4() { -// [ERROR: not resolved] -// │ - contract() -// fun test_4(): Unit -// │ - test_4() -} - -// should not have raw description - -fun test_5() { -// fun test_5(): Unit -// │ - test_5() -// [ERROR: not resolved] -// │ - contract() -} - -fun test_6() { -// [ERROR: not resolved] -// │ [ERROR: not resolved] -// │ │ [ERROR: not resolved] -// │ │ │ [ERROR: not resolved] -// │ │ │ │ - aaa.bbb.ccc.contract { - - } -// fun test_6(): Unit -// │ - test_6() -} - -fun test_7() { -// [ERROR: not resolved] -// │ [ERROR: not resolved] -// │ │ - contracts.contract { - - } -// fun test_7(): Unit -// │ - test_7() -} - -fun test_8() { -// [ERROR: not resolved] -// │ [ERROR: not resolved] -// │ │ [ERROR: not resolved] -// │ │ │ [ERROR: not resolved] -// │ │ │ │ - aaa.kotlin.contracts.contract { - - } -// fun test_8(): Unit -// │ - test_8() -} diff --git a/compiler/visualizer/testData/rawBuilder/declarations/delegates.kt b/compiler/visualizer/testData/rawBuilder/declarations/delegates.kt deleted file mode 100644 index 9472f19c4ee..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/delegates.kt +++ /dev/null @@ -1,31 +0,0 @@ -import kotlin.properties.ReadWriteProperty -import kotlin.reflect.KProperty - -// fun lazy(() -> T): Lazy -// │ Int -// │ │ fun (Int).plus(Int): Int -// Int │ │ │ Int -// │ │ │ │ │ -val x: Int by lazy { 1 + 2 } - -// properties/ReadWriteProperty -// │ properties/ReadWriteProperty -// │ │ -val delegate = object: ReadWriteProperty { -// reflect/KProperty<*> -// │ Int -// │ │ Int -// │ │ │ - override fun getValue(thisRef: Any?, property: KProperty<*>): Int = 1 -// reflect/KProperty<*> -// │ - override fun setValue(thisRef: Any?, property: KProperty<*>, value: Int) {} -} - -// Int val delegate: properties/ReadWriteProperty -// │ │ -val value by delegate - -// Int val delegate: properties/ReadWriteProperty -// │ │ -var variable by delegate diff --git a/compiler/visualizer/testData/rawBuilder/declarations/derivedClass.kt b/compiler/visualizer/testData/rawBuilder/declarations/derivedClass.kt deleted file mode 100644 index cd67ecf9e8b..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/derivedClass.kt +++ /dev/null @@ -1,12 +0,0 @@ -open class Base(val x: T) - -// constructor Base(T) -// │ Derived..x: T -// │ │ -class Derived(x: T) : Base(x) - -// Derived -// │ constructor Derived(T) -// │ │ create.x: T -// │ │ │ -fun create(x: T): Derived = Derived(x) diff --git a/compiler/visualizer/testData/rawBuilder/declarations/emptyAnonymousObject.kt b/compiler/visualizer/testData/rawBuilder/declarations/emptyAnonymousObject.kt deleted file mode 100644 index 560b3ccd42c..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/emptyAnonymousObject.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun test() { -// -// │ - val x = object {} -} diff --git a/compiler/visualizer/testData/rawBuilder/declarations/enums.kt b/compiler/visualizer/testData/rawBuilder/declarations/enums.kt deleted file mode 100644 index 3e0897c3f6a..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/enums.kt +++ /dev/null @@ -1,81 +0,0 @@ -import my.println - -enum class Order { - FIRST, - SECOND, - THIRD -} - -enum class Planet(val m: Double, internal val r: Double) { -// constructor Planet(Double, Double) -// │Double -// ││ Double -// ││ │ - MERCURY(1.0, 2.0) { - override fun sayHello() { -// fun io/println(Any?): Unit -// │ - println("Hello!!!") - } - }, -// constructor Planet(Double, Double) -// │Double -// ││ Double -// ││ │ - VENERA(3.0, 4.0) { - override fun sayHello() { -// fun io/println(Any?): Unit -// │ - println("Ola!!!") - } - }, -// constructor Planet(Double, Double) -// │Double -// ││ Double -// ││ │ - EARTH(5.0, 6.0) { - override fun sayHello() { -// fun io/println(Any?): Unit -// │ - println("Privet!!!") - } - }; - -// val (Planet.Companion).G: Double -// │ fun (Double).times(Double): Double -// │ │ val (Planet).m: Double -// │ │ │ fun (Double).div(Double): Double -// │ │ │ │ val (Planet).r: Double -// │ │ │ │ │ fun (Double).times(Double): Double -// Double │ │ │ │ │ │ val (Planet).r: Double -// │ │ │ │ │ │ │ │ - val g: Double = G * m / (r * r) - - abstract fun sayHello() - - companion object { -// Double -// │ Double -// │ │ - const val G = 6.67e-11 - } -} - -enum class PseudoInsn(val signature: String = "()V") { - FIX_STACK_BEFORE_JUMP, -// constructor PseudoInsn(String = ...) -// │ - FAKE_ALWAYS_TRUE_IFEQ("()I"), -// constructor PseudoInsn(String = ...) -// │ - FAKE_ALWAYS_FALSE_IFEQ("()I"), - SAVE_STACK_BEFORE_TRY, - RESTORE_STACK_IN_TRY_CATCH, - STORE_NOT_NULL, -// constructor PseudoInsn(String = ...) -// │ - AS_NOT_NULL("(Ljava/lang/Object;)Ljava/lang/Object;") - ; - - fun emit() {} -} diff --git a/compiler/visualizer/testData/rawBuilder/declarations/enums2.kt b/compiler/visualizer/testData/rawBuilder/declarations/enums2.kt deleted file mode 100644 index 7c0c5c29432..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/enums2.kt +++ /dev/null @@ -1,30 +0,0 @@ -interface Some - -object O1 : Some - -object O2 : Some - -enum class SomeEnum(val x: Some) { -// constructor SomeEnum(Some) -// │object O1: Some -// ││ - FIRST(O1) { -// Boolean -// │ Boolean -// │ │ - override fun check(y: Some): Boolean = true - }, -// constructor SomeEnum(Some) -// │object O2: Some -// ││ - SECOND(O2) { -// Boolean -// │ SomeEnum.SECOND.check.y: Some -// │ │ EQ operator call -// │ │ │ object O2: Some -// │ │ │ │ - override fun check(y: Some): Boolean = y == O2 - }; - - abstract fun check(y: Some): Boolean -} diff --git a/compiler/visualizer/testData/rawBuilder/declarations/expectActual.kt b/compiler/visualizer/testData/rawBuilder/declarations/expectActual.kt deleted file mode 100644 index 3236df9b544..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/expectActual.kt +++ /dev/null @@ -1,17 +0,0 @@ -expect class MyClass - -expect fun foo(): String - -// Int -// │ -expect val x: Int - -actual class MyClass - -// String -// │ -actual fun foo() = "Hello" - -// Int Int -// │ │ -actual val x = 42 diff --git a/compiler/visualizer/testData/rawBuilder/declarations/external.kt b/compiler/visualizer/testData/rawBuilder/declarations/external.kt deleted file mode 100644 index 0750ce02f38..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/external.kt +++ /dev/null @@ -1,24 +0,0 @@ -external class External - -external fun foo(): String - -// Int -// │ -external val x: Int - -class NotExternal { - external fun bar(): String -// Int -// │ - var y: Int - external get -// Int -// │ - set(value) {} -} - -// Int -// │ -var z: Int - external get - external set diff --git a/compiler/visualizer/testData/rawBuilder/declarations/functionTypes.kt b/compiler/visualizer/testData/rawBuilder/declarations/functionTypes.kt deleted file mode 100644 index ad2f7f71cf1..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/functionTypes.kt +++ /dev/null @@ -1,15 +0,0 @@ -// T fun (() -> R).invoke(): R -// │ │ -fun simpleRun(f: () -> T): T = f() - -// collections/List -// │ -fun List.simpleMap(f: (T) -> R): R { - -} - -// Unit -// │ simpleWith.t: T -// │ │ fun P1.invoke(): R -// │ │ │ -fun simpleWith(t: T, f: T.() -> Unit): Unit = t.f() diff --git a/compiler/visualizer/testData/rawBuilder/declarations/genericFunctions.kt b/compiler/visualizer/testData/rawBuilder/declarations/genericFunctions.kt deleted file mode 100644 index 95b9f2f9366..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/genericFunctions.kt +++ /dev/null @@ -1,10 +0,0 @@ -// FIR_IGNORE -interface Any - -// T? -// │ -inline fun Any.safeAs(): T? = this as? T - -abstract class Summator { - abstract fun plus(first: T, second: T): T -} diff --git a/compiler/visualizer/testData/rawBuilder/declarations/genericProperty.kt b/compiler/visualizer/testData/rawBuilder/declarations/genericProperty.kt deleted file mode 100644 index 501af9d41aa..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/genericProperty.kt +++ /dev/null @@ -1,8 +0,0 @@ -// Nothing -// │ fun TODO(): Nothing -// │ │ -fun genericFoo(): T = TODO() - -// T fun genericFoo(): T -// │ │ -val T.generic: T get() = genericFoo() diff --git a/compiler/visualizer/testData/rawBuilder/declarations/nestedClass.kt b/compiler/visualizer/testData/rawBuilder/declarations/nestedClass.kt deleted file mode 100644 index 5efca20b0b2..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/nestedClass.kt +++ /dev/null @@ -1,12 +0,0 @@ -abstract class Base(val s: String) - -class Outer { -// constructor Base(String) -// │ Outer.Derived..s: String -// │ │ - class Derived(s: String) : Base(s) - -// constructor Base(String) -// │ - object Obj : Base("") -} diff --git a/compiler/visualizer/testData/rawBuilder/declarations/noPrimaryConstructor.kt b/compiler/visualizer/testData/rawBuilder/declarations/noPrimaryConstructor.kt deleted file mode 100644 index 5a2d35e9013..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/noPrimaryConstructor.kt +++ /dev/null @@ -1,14 +0,0 @@ -class NoPrimary { -// String -// │ - val x: String - - constructor(x: String) { -// val (NoPrimary).x: String -// │ NoPrimary..x: String -// │ │ - this.x = x - } - - constructor(): this("") -} diff --git a/compiler/visualizer/testData/rawBuilder/declarations/simpleClass.kt b/compiler/visualizer/testData/rawBuilder/declarations/simpleClass.kt deleted file mode 100644 index 4a018731bdc..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/simpleClass.kt +++ /dev/null @@ -1,39 +0,0 @@ -interface SomeInterface { - fun foo(x: Int, y: String): String - -// Boolean -// │ - val bar: Boolean -} - -class SomeClass : SomeInterface { -// Int Int -// │ │ - private val baz = 42 - - override fun foo(x: Int, y: String): String { -// SomeClass.foo.y: String -// │ fun (String).plus(Any?): String -// │ │ SomeClass.foo.x: Int -// │ │ │ fun (String).plus(Any?): String -// │ │ │ │ val (SomeClass).baz: Int -// │ │ │ │ │ - return y + x + baz - } - -// Boolean -// │ - override var bar: Boolean -// Boolean -// │ - get() = true -// Boolean -// │ - set(value) {} - -// Double -// │ - lateinit var fau: Double -} - -inline class InlineClass diff --git a/compiler/visualizer/testData/rawBuilder/declarations/simpleFun.kt b/compiler/visualizer/testData/rawBuilder/declarations/simpleFun.kt deleted file mode 100644 index 1a3d7d35be4..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/simpleFun.kt +++ /dev/null @@ -1,3 +0,0 @@ -fun foo() {} - -suspend fun bar() {} diff --git a/compiler/visualizer/testData/rawBuilder/declarations/simpleTypeAlias.kt b/compiler/visualizer/testData/rawBuilder/declarations/simpleTypeAlias.kt deleted file mode 100644 index 0a549422d7e..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/simpleTypeAlias.kt +++ /dev/null @@ -1,7 +0,0 @@ -interface B - -typealias C = B - -// B -// │ -class D : C diff --git a/compiler/visualizer/testData/rawBuilder/declarations/typeAliasWithGeneric.kt b/compiler/visualizer/testData/rawBuilder/declarations/typeAliasWithGeneric.kt deleted file mode 100644 index cc85e4732f3..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/typeAliasWithGeneric.kt +++ /dev/null @@ -1,9 +0,0 @@ -open class A - -interface B - -typealias C = B - -// B -// │ -class D : C diff --git a/compiler/visualizer/testData/rawBuilder/declarations/typeParameterVsNested.kt b/compiler/visualizer/testData/rawBuilder/declarations/typeParameterVsNested.kt deleted file mode 100644 index 3cc0b285c05..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/typeParameterVsNested.kt +++ /dev/null @@ -1,28 +0,0 @@ -// FIR_IGNORE -package test - -interface Some - -abstract class My { - inner class T - -// T -// │ - abstract val x: T - - abstract fun foo(arg: T) - -// [ERROR : T] -// │ [ERROR : T] -// │ │ - abstract val y: My.T - -// [ERROR : T] -// │ [ERROR : T] -// │ │ - abstract val z: test.My.T - -// [ERROR : T] -// │ - class Some : T() -} diff --git a/compiler/visualizer/testData/rawBuilder/declarations/typeParameters.kt b/compiler/visualizer/testData/rawBuilder/declarations/typeParameters.kt deleted file mode 100644 index 761bb7e3469..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/typeParameters.kt +++ /dev/null @@ -1,23 +0,0 @@ -interface List { - operator fun get(index: Int): T - - infix fun concat(other: List): List -} - -typealias StringList = List -typealias AnyList = List<*> - -abstract class AbstractList : List - -// constructor AbstractList() -// │ -class SomeList : AbstractList() { -// Int -// │ Int -// │ │ - override fun get(index: Int): Int = 42 - -// SomeList -// │ - override fun concat(other: List): List = this -} diff --git a/compiler/visualizer/testData/rawBuilder/declarations/where.kt b/compiler/visualizer/testData/rawBuilder/declarations/where.kt deleted file mode 100644 index 2dfb8095b21..00000000000 --- a/compiler/visualizer/testData/rawBuilder/declarations/where.kt +++ /dev/null @@ -1,6 +0,0 @@ -interface A -interface B - -class C where T : A, T : B { - -} diff --git a/compiler/visualizer/testData/rawBuilder/expressions/annotated.kt b/compiler/visualizer/testData/rawBuilder/expressions/annotated.kt deleted file mode 100644 index db38fac6d69..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/annotated.kt +++ /dev/null @@ -1,52 +0,0 @@ -//constructor annotation/Target(vararg annotation/AnnotationTarget) -//│ enum class annotation/AnnotationTarget: Enum -//│ │ enum entry annotation/AnnotationTarget.EXPRESSION -//│ │ │ enum class annotation/AnnotationTarget: Enum -//│ │ │ │ enum entry annotation/AnnotationTarget.LOCAL_VARIABLE -//│ │ │ │ │ -@Target(AnnotationTarget.EXPRESSION, AnnotationTarget.LOCAL_VARIABLE) -//constructor annotation/Retention(annotation/AnnotationRetention = ...) -//│ enum class annotation/AnnotationRetention: Enum -//│ │ enum entry annotation/AnnotationRetention.SOURCE -//│ │ │ -@Retention(AnnotationRetention.SOURCE) -annotation class Ann - -fun foo(arg: Int): Int { -// constructor Ann() -// │ foo.arg: Int -// │ │ EQ operator call -// Unit │ │ │ Int -// │ │ │ │ │ - if (@Ann arg == 0) { -// constructor Ann() -// │ Int -// │ │ - @Ann return 1 - } -// constructor Ann() -// │ Unit -// │ │ foo.arg: Int -// │ │ │ EQ operator call -// │ │ │ │ Int -// │ │ │ │ │ - @Ann if (arg == 1) { -// constructor Ann() -// │ Int -// │ │ - return (@Ann 1) - } -// Int -// │ - return 42 -} - -data class Two(val x: Int, val y: Int) - -fun bar(two: Two) { -// constructor Ann() -// │ constructor Ann() -// │ Int │ Int bar.two: Two -// │ │ │ │ │ - val (@Ann x, @Ann y) = two -} diff --git a/compiler/visualizer/testData/rawBuilder/expressions/arrayAccess.kt b/compiler/visualizer/testData/rawBuilder/expressions/arrayAccess.kt deleted file mode 100644 index aea4b04c0db..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/arrayAccess.kt +++ /dev/null @@ -1,25 +0,0 @@ -// Int Int -// │ │ -val p = 0 -// Int -// │ Int -// │ │ -fun foo() = 1 - -class Wrapper(val v: IntArray) - -// Int -// │ test.a: IntArray -// │ │ Int -// │ │ │ fun (Int).plus(Int): Int -// │ │ │ │ test.a: IntArray -// │ │ │ │ │ val p: Int -// │ │ │ │ │ │ fun (Int).plus(Int): Int -// │ │ │ │ │ │ │ test.a: IntArray -// │ │ │ │ │ │ │ │ fun foo(): Int -// │ │ │ │ │ │ │ │ │ fun (Int).plus(Int): Int -// │ │ │ │ │ │ │ │ │ │ test.w: Wrapper -// │ │ │ │ │ │ │ │ │ │ │ val (Wrapper).v: IntArray -// │ │ │ │ │ │ │ │ │ │ │ │ Int -// │ │ │ │ │ │ │ │ │ │ │ │ │ -fun test(a: IntArray, w: Wrapper) = a[0] + a[p] + a[foo()] + w.v[0] diff --git a/compiler/visualizer/testData/rawBuilder/expressions/arrayAssignment.kt b/compiler/visualizer/testData/rawBuilder/expressions/arrayAssignment.kt deleted file mode 100644 index a6aca43eed2..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/arrayAssignment.kt +++ /dev/null @@ -1,32 +0,0 @@ -fun test() { -// IntArray -// │ fun intArrayOf(vararg Int): IntArray -// │ │ Int -// │ │ │ Int -// │ │ │ │ Int -// │ │ │ │ │ - val x = intArrayOf(1, 2, 3) -// val test.x: IntArray -// │ Int -// │ │ fun (IntArray).set(Int, Int): Unit -// │ │ │ Int -// │ │ │ │ - x[1] = 0 -} - -// Int -// │ Int -// │ │ -fun foo() = 1 - -fun test2() { -// fun intArrayOf(vararg Int): IntArray -// │ Int -// │ │ Int -// │ │ │ Int -// │ │ │ │ fun foo(): Int -// │ │ │ │ │ fun (IntArray).set(Int, Int): Unit -// │ │ │ │ │ │ Int -// │ │ │ │ │ │ │ - intArrayOf(1, 2, 3)[foo()] = 1 -} diff --git a/compiler/visualizer/testData/rawBuilder/expressions/branches.kt b/compiler/visualizer/testData/rawBuilder/expressions/branches.kt deleted file mode 100644 index d8c13220a49..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/branches.kt +++ /dev/null @@ -1,92 +0,0 @@ -// FIR_IGNORE -// WITH_STDLIB -// foo.a: Int -// │ fun (Int).compareTo(Int): Int -// │ │ foo.b: Int -// Int │ │ │ foo.a: Int -// │ Int │ │ │ │ foo.b: Int -// │ │ │ │ │ │ │ -fun foo(a: Int, b: Int) = if (a > b) a else b - -fun bar(a: Double, b: Double): Double { -// Nothing -// │ bar.a: Double -// │ │ fun (Double).compareTo(Double): Int -// │ │ │ bar.b: Double -// │ │ │ │ - if (a > b) { -// fun io/println(Double): Unit -// │ bar.a: Double -// │ │ - println(a) -// bar.a: Double -// │ - return a - } else { -// fun io/println(Double): Unit -// │ bar.b: Double -// │ │ - println(b) -// bar.b: Double -// │ - return b - } -} - -fun baz(a: Long, b: Long): Long { -// Nothing -// │ - when { -// baz.a: Long -// │ fun (Long).compareTo(Long): Int -// │ │ baz.b: Long -// │ │ │ Nothing -// │ │ │ │ - a > b -> { -// fun io/println(Long): Unit -// │ baz.a: Long -// │ │ - println(a) -// baz.a: Long -// │ - return a - } -// Nothing -// │ baz.b: Long -// │ │ - else -> return b - } -} - -fun grade(g: Int): String { -// String -// │ grade.g: Int -// │ │ - return when (g) { -// Int -// │ Int String -// │ │ │ - 6, 7 -> "Outstanding" -// Int String -// │ │ - 5 -> "Excellent" -// Int String -// │ │ - 4 -> "Good" -// Int String -// │ │ - 3 -> "Mediocre" -// fun (ranges/IntRange).contains(Int): Boolean -// │ Int -// │ │fun (Int).rangeTo(Int): ranges/IntRange -// │ ││ Int String -// │ ││ │ │ - in 1..2 -> "Fail" -// String -// │ - is Number -> "Number" -// String -// │ - else -> "Unknown" - } -} diff --git a/compiler/visualizer/testData/rawBuilder/expressions/callableReferences.kt b/compiler/visualizer/testData/rawBuilder/expressions/callableReferences.kt deleted file mode 100644 index 38501462e52..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/callableReferences.kt +++ /dev/null @@ -1,58 +0,0 @@ -// FIR_IGNORE -class A { - fun foo() {} -// Int Int -// │ │ - val bar = 0 -} - -fun A.qux() {} - -fun baz() {} - -// reflect/KFunction0 -// │ constructor A() -// │ │ fun (A).foo(): Unit -// │ │ │ -val test1 = A()::foo - -// reflect/KProperty0 -// │ constructor A() -// │ │ val (A).bar: Int -// │ │ │ -val test2 = A()::bar - -// reflect/KFunction0 -// │ constructor A() -// │ │ fun A.qux(): Unit -// │ │ │ -val test3 = A()::qux - -// reflect/KFunction1 -// │ class A -// │ │ fun (A).foo(): Unit -// │ │ │ -val test4 = A::foo - -// reflect/KProperty1 -// │ class A -// │ │ val (A).bar: Int -// │ │ │ -val test5 = A::bar - -// reflect/KFunction1 -// │ class A -// │ │ fun A.qux(): Unit -// │ │ │ -val test6 = A::qux - -// reflect/KFunction0 -// │ fun baz(): Unit -// │ │ -val test7 = ::baz - -// reflect/KFunction1 -// │ class A -// │ │ fun (A).foo(): Unit -// │ │ │ -val test8 = A?::foo diff --git a/compiler/visualizer/testData/rawBuilder/expressions/calls.kt b/compiler/visualizer/testData/rawBuilder/expressions/calls.kt deleted file mode 100644 index 338db3ef446..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/calls.kt +++ /dev/null @@ -1,72 +0,0 @@ -// WITH_STDLIB -// fun (Int).plus(Int): Int -// Int │ distance.y: Int -// │ │ │ -infix fun Int.distance(y: Int) = this + y - -// Int -// │ Int -// │ │ fun Int.distance(Int): Int -// │ │ │ Int -// │ │ │ │ -fun test(): Int = 3 distance 4 - -// Int -// │ Int -// │ │ fun Int.distance(Int): Int -// │ │ │ Int -// │ │ │ │ -fun testRegular(): Int = 3.distance(4) - -class My(var x: Int) { -// Int -// │ var (My).x: Int -// │ │ - operator fun invoke() = x - - fun foo() {} - -// My -// │ constructor My(Int) -// │ │ var (My).x: Int -// │ │ │ - fun copy() = My(x) -} - -// Int -// │ constructor My(Int) -// │ fun (My).invoke(): Int -// │ │ Int -// │ │ │ -fun testInvoke(): Int = My(13)() - -fun testQualified(first: My, second: My?) { -// fun io/println(Int): Unit -// │ testQualified.first: My -// │ │ var (My).x: Int -// │ │ │ - println(first.x) -// fun io/println(Any?): Unit -// │ testQualified.second: My? -// │ │ var (My).x: Int -// │ │ │ - println(second?.x) -// testQualified.first: My -// │ fun (My).foo(): Unit -// │ │ - first.foo() -// testQualified.second: My? -// │ fun (My).foo(): Unit -// │ │ - second?.foo() -// testQualified.first: My -// │ fun (My).copy(): My -// │ │ fun (My).foo(): Unit -// │ │ │ - first.copy().foo() -// testQualified.first: My -// │ var (My).x: Int -// │ │ Int -// │ │ │ - first.x = 42 -} diff --git a/compiler/visualizer/testData/rawBuilder/expressions/classReference.kt b/compiler/visualizer/testData/rawBuilder/expressions/classReference.kt deleted file mode 100644 index 528cc2af2fd..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/classReference.kt +++ /dev/null @@ -1,27 +0,0 @@ -// WITH_STDLIB -package test - -class A - -fun test() { -// class A -// │ - A::class -// class A -// │ - test.A::class -// constructor A() -// │ - A()::class - -// class A val reflect/KClass.java: java/lang/Class -// │ │ - A::class.java -// class A val reflect/KClass.java: java/lang/Class -// │ │ - test.A::class.java -// constructor A() -// │ val reflect/KClass.java: java/lang/Class -// │ │ - A()::class.java -} diff --git a/compiler/visualizer/testData/rawBuilder/expressions/collectionLiterals.kt b/compiler/visualizer/testData/rawBuilder/expressions/collectionLiterals.kt deleted file mode 100644 index 36409ef9de0..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/collectionLiterals.kt +++ /dev/null @@ -1,34 +0,0 @@ -annotation class Ann1(val arr: IntArray) - -annotation class Ann2(val arr: DoubleArray) - -annotation class Ann3(val arr: Array) - -//constructor Ann1(IntArray) -//│ -@Ann1([]) -//constructor Ann2(DoubleArray) -//│ -@Ann2([]) -//constructor Ann3(Array) -//│ -@Ann3([]) -class Zero - -//constructor Ann1(IntArray) -//│ Int -//│ │ Int -//│ │ │ -@Ann1([1, 2]) -class First - -//constructor Ann2(DoubleArray) -//│ Double -//│ │ -@Ann2([3.14]) -class Second - -//constructor Ann3(Array) -//│ -@Ann3(["Alpha", "Omega"]) -class Third diff --git a/compiler/visualizer/testData/rawBuilder/expressions/destructuring.kt b/compiler/visualizer/testData/rawBuilder/expressions/destructuring.kt deleted file mode 100644 index 736a6a34b16..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/destructuring.kt +++ /dev/null @@ -1,28 +0,0 @@ -data class Some(val first: Int, val second: Double, val third: String) - -fun foo(some: Some) { -// Int -// │ Double -// │ │ String foo.some: Some -// │ │ │ │ - var (x, y, z: String) = some - -// var foo.x: Int -// │fun (Int).inc(): Int -// ││ - x++ -// var foo.y: Double -// │ fun (Double).times(Double): Double -// │ │ Double -// │ │ │ - y *= 2.0 -// var foo.z: String -// │ - z = "" -} - -fun bar(some: Some) { -// Int String bar.some: Some -// │ │ │ - val (a, _, `_`) = some -} diff --git a/compiler/visualizer/testData/rawBuilder/expressions/for.kt b/compiler/visualizer/testData/rawBuilder/expressions/for.kt deleted file mode 100644 index ce2f60fed88..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/for.kt +++ /dev/null @@ -1,89 +0,0 @@ -fun foo() { -// Int -// │fun (Int).rangeTo(Int): ranges/IntRange -// Int ││ Int -// │ ││ │ - for (i in 1..10) { -// fun io/println(Int): Unit -// │ val foo.i: Int -// │ │ - println(i) - } -} - -fun fooLabeled() { -// fun io/println(Any?): Unit -// │ - println("!!!") -// Int -// │fun (Int).rangeTo(Int): ranges/IntRange -// Int ││ Int -// │ ││ │ - label@ for (i in 1..10) { -// Unit -// │ val fooLabeled.i: Int -// │ │ EQ operator call -// │ │ │ Int -// │ │ │ │ - if (i == 5) continue@label -// fun io/println(Int): Unit -// │ val fooLabeled.i: Int -// │ │ - println(i) - } -// fun io/println(Any?): Unit -// │ - println("!!!") -} - -// collections/List -// │ -fun bar(list: List) { -// bar.list: collections/List -// │ fun (collections/List).subList(Int, Int): collections/List -// │ │ Int -// String │ │ │ Int -// │ │ │ │ │ - for (element in list.subList(0, 10)) { -// fun io/println(Any?): Unit -// │ val bar.element: String -// │ │ - println(element) - } -// bar.list: collections/List -// │ fun (collections/List).subList(Int, Int): collections/List -// │ │ fun io/println(Any?): Unit -// String │ │ Int Int │ val bar.element: String -// │ │ │ │ │ │ │ - for (element in list.subList(10, 20)) println(element) -} - -data class Some(val x: Int, val y: Int) - -// collections/Set -// │ -fun baz(set: Set) { -// Int -// │ Int baz.set: collections/Set -// │ │ │ - for ((x, y) in set) { -// fun io/println(Any?): Unit -// │ val baz.x: Int -// │ │ val baz.y: Int -// │ │ │ - println("x = $x y = $y") - } -} - -// collections/List -// │ -fun withParameter(list: List) { -// Some withParameter.list: collections/List -// │ │ - for (s: Some in list) { -// fun io/println(Any?): Unit -// │ val withParameter.s: Some -// │ │ - println(s) - } -} diff --git a/compiler/visualizer/testData/rawBuilder/expressions/genericCalls.kt b/compiler/visualizer/testData/rawBuilder/expressions/genericCalls.kt deleted file mode 100644 index 34ab7f12045..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/genericCalls.kt +++ /dev/null @@ -1,19 +0,0 @@ -// Nothing? -// │ Nothing? -// │ │ -fun nullableValue(): T? = null - -fun test() { -// Int? -// │ fun nullableValue(): T? -// │ │ - val n = nullableValue() -// Double? -// │ fun nullableValue(): T? -// │ │ - val x = nullableValue() -// String? -// │ fun nullableValue(): T? -// │ │ - val s = nullableValue() -} diff --git a/compiler/visualizer/testData/rawBuilder/expressions/in.kt b/compiler/visualizer/testData/rawBuilder/expressions/in.kt deleted file mode 100644 index 7086704d4e3..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/in.kt +++ /dev/null @@ -1,13 +0,0 @@ -// FIR_IGNORE -// collections/Collection -// │ Boolean -// │ │ -fun foo(x: Int, y: Int, c: Collection) = -// foo.x: Int -// │ fun (collections/Collection).contains(E): Boolean -// │ │ foo.c: collections/Collection -// │ │ │ foo.y: Int -// │ │ │ │ fun (collections/Collection).contains(E): Boolean -// │ │ │ │ │ foo.c: collections/Collection -// │ │ │ │ │ │ - x in c && y !in c diff --git a/compiler/visualizer/testData/rawBuilder/expressions/inBrackets.kt b/compiler/visualizer/testData/rawBuilder/expressions/inBrackets.kt deleted file mode 100644 index 5afdd3478ce..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/inBrackets.kt +++ /dev/null @@ -1,14 +0,0 @@ -// FIR_IGNORE -fun test(e: Int.() -> String) { -// String -// │ Int -// │ │ fun P1.invoke(): R -// │ │ │ - val s = 3.e() -// String -// │ Int -// │ │ fun P1.invoke(): R -// │ │ │test.e: Int.() -> String -// │ │ ││ - val ss = 3.(e)() -} diff --git a/compiler/visualizer/testData/rawBuilder/expressions/init.kt b/compiler/visualizer/testData/rawBuilder/expressions/init.kt deleted file mode 100644 index 9129d0df8ca..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/init.kt +++ /dev/null @@ -1,12 +0,0 @@ -class WithInit(x: Int) { -// Int -// │ - val x: Int - - init { -// val (WithInit).x: Int -// │ WithInit..x: Int -// │ │ - this.x = x - } -} diff --git a/compiler/visualizer/testData/rawBuilder/expressions/labelForInfix.kt b/compiler/visualizer/testData/rawBuilder/expressions/labelForInfix.kt deleted file mode 100644 index b09d9c0ab35..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/labelForInfix.kt +++ /dev/null @@ -1,8 +0,0 @@ -// FIR_IGNORE -fun main() { -// [ERROR: not resolved] -// │ [ERROR: not resolved] -// │ │ [ERROR: not resolved] -// │ │ │ - { length } foo { bar() } -} diff --git a/compiler/visualizer/testData/rawBuilder/expressions/lambda.kt b/compiler/visualizer/testData/rawBuilder/expressions/lambda.kt deleted file mode 100644 index d65169996b6..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/lambda.kt +++ /dev/null @@ -1,97 +0,0 @@ -// FIR_IGNORE -// WITH_STDLIB -data class Tuple(val x: Int, val y: Int) - -// Int -// │ fun ((P1) -> R).invoke(P1): R -// │ │ constructor Tuple(Int, Int) -// │ │ │ Int -// │ │ │ │ Int -// │ │ │ │ │ -inline fun use(f: (Tuple) -> Int) = f(Tuple(1, 2)) - -fun foo(): Int { -// (Tuple) -> Int -// │ - val l1 = { t: Tuple -> -// foo..t: Tuple -// Int │ val (Tuple).x: Int -// │ │ │ - val x = t.x -// foo..t: Tuple -// Int │ val (Tuple).y: Int -// │ │ │ - val y = t.y -// val foo..x: Int -// │ fun (Int).plus(Int): Int -// │ │ val foo..y: Int -// │ │ │ - x + y - } -// fun use((Tuple) -> Int): Int -// │ val foo..x: Int -// │ Int │ fun (Int).plus(Int): Int -// │ │ Int │ │ val foo..y: Int -// │ │ │ │ │ │ - use { (x, y) -> x + y } - -// fun use((Tuple) -> Int): Int -// │ - return use { -// Unit -// │ foo..it: Tuple -// │ │ val (Tuple).x: Int -// │ │ │ EQ operator call -// │ │ │ │ Int Int -// │ │ │ │ │ │ - if (it.x == 0) return@foo 0 -// foo..it: Tuple -// │ val (Tuple).y: Int -// │ │ - return@use it.y - } -} - -fun bar(): Int { -// fun use((Tuple) -> Int): Int -// │ - return use lambda@{ -// Unit -// │ bar..it: Tuple -// │ │ val (Tuple).x: Int -// │ │ │ EQ operator call -// │ │ │ │ Int Int -// │ │ │ │ │ │ - if (it.x == 0) return@bar 0 -// bar..it: Tuple -// │ val (Tuple).y: Int -// │ │ - return@lambda it.y - } -} - -// collections/List -// │ -fun test(list: List) { -// collections/MutableMap -// │ fun collections/mutableMapOf(): collections/MutableMap -// │ │ - val map = mutableMapOf() -// test.list: collections/List -// │ fun collections/Iterable.forEach((T) -> Unit): Unit -// │ │ val test.map: collections/MutableMap -// │ │ │ fun collections/MutableMap.getOrPut(K, () -> V): V -// │ │ │ │ test..it: Int -// │ │ │ │ │ fun collections/mutableListOf(): collections/MutableList -// │ │ │ │ │ │ fun (String).plus(Any?): String -// │ │ │ │ │ │ │ - list.forEach { map.getOrPut(it, { mutableListOf() }) += "" } -} - -// () -> Unit -// │ -val simple = { } - -// () -> Int Int -// │ │ -val another = { 42 } diff --git a/compiler/visualizer/testData/rawBuilder/expressions/lambdaAndAnonymousFunction.kt b/compiler/visualizer/testData/rawBuilder/expressions/lambdaAndAnonymousFunction.kt deleted file mode 100644 index 4db6e4e269f..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/lambdaAndAnonymousFunction.kt +++ /dev/null @@ -1,20 +0,0 @@ -// FIR_IGNORE -// T fun (() -> R).invoke(): R -// │ │ -fun run(block: () -> T): T = block() - -fun test_1() { -// fun run(() -> T): T -// │ - run { return@run } -// fun run(() -> T): T -// │ - run { return } -} - -fun test_2() { -// fun run(() -> T): T -// │ Int -// │ │ - run(fun (): Int { return 1 }) -} diff --git a/compiler/visualizer/testData/rawBuilder/expressions/locals.kt b/compiler/visualizer/testData/rawBuilder/expressions/locals.kt deleted file mode 100644 index 3185c8dc533..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/locals.kt +++ /dev/null @@ -1,48 +0,0 @@ -fun withLocals(p: Int): Int { - class Local(val pp: Int) { -// Int -// │ val (withLocals.Local).pp: Int -// │ │ fun (Int).minus(Int): Int -// │ │ │ withLocals.p: Int -// │ │ │ │ - fun diff() = pp - p - } - -// constructor withLocals.Local(Int) -// Int │ Int fun (withLocals.Local).diff(): Int -// │ │ │ │ - val x = Local(42).diff() - - fun sum(y: Int, z: Int, f: (Int, Int) -> Int): Int { -// val withLocals.x: Int -// │ fun (Int).plus(Int): Int -// │ │ fun ((P1, P2) -> R).invoke(P1, P2): R -// │ │ │ withLocals.sum.y: Int -// │ │ │ │ withLocals.sum.z: Int -// │ │ │ │ │ - return x + f(y, z) - } - -// Int constructor Any() -// │ │ - val code = (object : Any() { -// Int -// │ fun (Any).hashCode(): Int -// │ │ - fun foo() = hashCode() -// fun ().foo(): Int -// │ - }).foo() - -// fun withLocals.sum(Int, Int, (Int, Int) -> Int): Int -// │ val withLocals.code: Int -// │ │ constructor withLocals.Local(Int) -// │ │ │ Int -// │ │ │ │ fun (withLocals.Local).diff(): Int -// │ │ │ │ │ Int -// │ │ │ │ │ │ withLocals..x: Int -// │ │ │ │ │ │ │ fun (Int).plus(Int): Int -// │ │ │ │ │ │ │ │ withLocals..y: Int -// │ │ │ │ │ │ │ │ │ - return sum(code, Local(1).diff(), fun(x: Int, y: Int) = x + y) -} diff --git a/compiler/visualizer/testData/rawBuilder/expressions/modifications.kt b/compiler/visualizer/testData/rawBuilder/expressions/modifications.kt deleted file mode 100644 index ce1cc5ecabf..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/modifications.kt +++ /dev/null @@ -1,45 +0,0 @@ -// WITH_STDLIB -fun simple() { -// Int Int -// │ │ - var x = 10 -// var simple.x: Int -// │ fun (Int).plus(Int): Int -// │ │ Int -// │ │ │ - x += 20 -// var simple.x: Int -// │ fun (Int).minus(Int): Int -// │ │ Int -// │ │ │ - x -= 5 -// var simple.x: Int -// │ fun (Int).div(Int): Int -// │ │ Int -// │ │ │ - x /= 5 -// var simple.x: Int -// │ fun (Int).times(Int): Int -// │ │ Int -// │ │ │ - x *= 10 -} - -// collections/List -// │ -fun List.modify() { -// fun collections/Collection.plus(T): collections/List -// │ - this += "Alpha" -// fun collections/Collection.plus(T): collections/List -// │ - this += "Omega" -} - -fun Any.modify() { -// collections/List -// │ fun collections/Collection.plus(T): collections/List -// │ │ Int -// │ │ │ - (this as List) += 42 -} diff --git a/compiler/visualizer/testData/rawBuilder/expressions/namedArgument.kt b/compiler/visualizer/testData/rawBuilder/expressions/namedArgument.kt deleted file mode 100644 index bd2b8d5dd7b..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/namedArgument.kt +++ /dev/null @@ -1,26 +0,0 @@ -// Boolean Double -// │ │ -fun foo(first: String = "", second: Boolean = true, third: Double = 3.1415) {} - -fun test() { -// fun foo(String = ..., Boolean = ..., Double = ...): Unit -// │ - foo() -// fun foo(String = ..., Boolean = ..., Double = ...): Unit -// │ Boolean -// │ │ Double -// │ │ │ - foo("Alpha", false, 2.71) -// fun foo(String = ..., Boolean = ..., Double = ...): Unit -// │ Boolean -// │ │ - foo(first = "Hello", second = true) -// fun foo(String = ..., Boolean = ..., Double = ...): Unit -// │ fun (Double).unaryMinus(): Double -// │ │Double -// │ ││ - foo(third = -1.0, first = "123") -// fun foo(String = ..., Boolean = ..., Double = ...): Unit -// │ - foo(= "") -} diff --git a/compiler/visualizer/testData/rawBuilder/expressions/nullability.kt b/compiler/visualizer/testData/rawBuilder/expressions/nullability.kt deleted file mode 100644 index 3fcc9b65258..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/nullability.kt +++ /dev/null @@ -1,10 +0,0 @@ -// Int -// │ orFourtyTwo.arg: Int? -// │ │ Int -// │ │ │ -fun orFourtyTwo(arg: Int?) = arg ?: 42 - -// Int -// │ bang.arg: Int? -// │ │ -fun bang(arg: Int?) = arg!! diff --git a/compiler/visualizer/testData/rawBuilder/expressions/qualifierWithTypeArguments.kt b/compiler/visualizer/testData/rawBuilder/expressions/qualifierWithTypeArguments.kt deleted file mode 100644 index da5eb616d58..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/qualifierWithTypeArguments.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun test() { -// class Array: java/io/Serializable, Cloneable -// │ - Array::class -} diff --git a/compiler/visualizer/testData/rawBuilder/expressions/simpleReturns.kt b/compiler/visualizer/testData/rawBuilder/expressions/simpleReturns.kt deleted file mode 100644 index 54b503130cf..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/simpleReturns.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun foo() { - return -} - -fun bar(): String { - return "Hello" -} diff --git a/compiler/visualizer/testData/rawBuilder/expressions/super.kt b/compiler/visualizer/testData/rawBuilder/expressions/super.kt deleted file mode 100644 index 899888f7792..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/super.kt +++ /dev/null @@ -1,25 +0,0 @@ -interface A { - fun foo() {} -} - -interface B { - fun foo() {} - fun bar() {} -} - -class C : A, B { - override fun bar() { -// fun (B).bar(): Unit -// │ - super.bar() - } - - override fun foo() { -// fun (A).foo(): Unit -// │ - super.foo() -// fun (B).foo(): Unit -// │ - super.foo() - } -} diff --git a/compiler/visualizer/testData/rawBuilder/expressions/these.kt b/compiler/visualizer/testData/rawBuilder/expressions/these.kt deleted file mode 100644 index e38203d6326..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/these.kt +++ /dev/null @@ -1,43 +0,0 @@ -class Some { -// Int -// │ Int -// │ │ - fun foo(): Int = 1 - - fun bar(): Int { -// fun (Some).foo(): Int -// │ - return this.foo() - } - -// Some -// │ - val instance: Some - get() = this@Some - - fun String.extension(): Int { -// fun (Some).bar(): Int -// │ fun (Int).plus(Int): Int -// │ │ val (String).length: Int -// │ │ │ - return this@Some.bar() + this.length - } -} - -// Int fun (Some).bar(): Int -// │ │ -fun Some.extension() = this.bar() - -fun test(some: Some): Int { -// fun with(T, T.() -> R): R -// │ test.some: Some -// │ │ with@0 -// │ │ │ - return with(some) { -// fun (Some).foo(): Int -// │ fun (Int).plus(Int): Int -// │ │ fun Some.extension(): Int -// │ │ │ - this.foo() + this@with.extension() - } -} diff --git a/compiler/visualizer/testData/rawBuilder/expressions/try.kt b/compiler/visualizer/testData/rawBuilder/expressions/try.kt deleted file mode 100644 index 2ae96381a50..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/try.kt +++ /dev/null @@ -1,24 +0,0 @@ -// WITH_STDLIB -fun some() { - try { -// constructor KotlinNullPointerException() -// │ - throw KotlinNullPointerException() -// java/lang/RuntimeException -// │ - } catch (e: RuntimeException) { -// fun io/println(Any?): Unit -// │ - println("Runtime exception") -// java/lang/Exception -// │ - } catch (e: Exception) { -// fun io/println(Any?): Unit -// │ - println("Some exception") - } finally { -// fun io/println(Any?): Unit -// │ - println("finally") - } -} diff --git a/compiler/visualizer/testData/rawBuilder/expressions/typeOperators.kt b/compiler/visualizer/testData/rawBuilder/expressions/typeOperators.kt deleted file mode 100644 index f907520390f..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/typeOperators.kt +++ /dev/null @@ -1,19 +0,0 @@ -// FIR_IGNORE -interface IThing - -// Boolean -// │ test1.x: Any -// │ │ -fun test1(x: Any) = x is IThing -// Boolean -// │ test2.x: Any -// │ │ -fun test2(x: Any) = x !is IThing -// IThing -// │ test3.x: Any -// │ │ -fun test3(x: Any) = x as IThing -// IThing? -// │ test4.x: Any -// │ │ -fun test4(x: Any) = x as? IThing diff --git a/compiler/visualizer/testData/rawBuilder/expressions/unary.kt b/compiler/visualizer/testData/rawBuilder/expressions/unary.kt deleted file mode 100644 index 7cb8509d84b..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/unary.kt +++ /dev/null @@ -1,79 +0,0 @@ -// FIR_IGNORE -// WITH_STDLIB -fun test() { -// Int Int -// │ │ - var x = 0 -// var test.x: Int -// Int │fun (Int).inc(): Int -// │ ││ - val x1 = x++ -// fun (Int).inc(): Int -// Int │ var test.x: Int -// │ │ │ - val x2 = ++x -// fun (Int).dec(): Int -// Int │ var test.x: Int -// │ │ │ - val x3 = --x -// var test.x: Int -// Int │fun (Int).dec(): Int -// │ ││ - val x4 = x-- -// Unit -// │ fun (Boolean).not(): Boolean -// │ │ var test.x: Int -// │ │ │ EQ operator call -// │ │ │ │ Int -// │ │ │ │ │ - if (!(x == 0)) { -// fun io/println(Any?): Unit -// │ - println("000") - } -} - -class X(val i: Int) - -fun test2(x: X) { -// test2.x: X -// │ val (X).i: Int -// Int │ │fun (Int).inc(): Int -// │ │ ││ - val x1 = x.i++ -// fun (Int).inc(): Int -// │ test2.x: X -// Int │ │ val (X).i: Int -// │ │ │ │ - val x2 = ++x.i -} - -fun test3(arr: Array) { -// test3.arr: Array -// │ Int -// Int │ │ fun (Int).inc(): Int -// │ │ │ │ - val x1 = arr[0]++ -// fun (Int).inc(): Int -// │ test3.arr: Array -// Int │ │ Int -// │ │ │ │ - val x2 = ++arr[1] -} - -class Y(val arr: Array) - -fun test4(y: Y) { -// test4.y: Y -// │ val (Y).arr: Array -// │ │ Int -// Int │ │ │ fun (Int).inc(): Int -// │ │ │ │ │ - val x1 = y.arr[0]++ -// fun (Int).inc(): Int -// │ test4.y: Y -// │ │ val (Y).arr: Array -// Int │ │ │ Int -// │ │ │ │ │ - val x2 = ++y.arr[1] -} diff --git a/compiler/visualizer/testData/rawBuilder/expressions/variables.kt b/compiler/visualizer/testData/rawBuilder/expressions/variables.kt deleted file mode 100644 index 8598d4ce3e6..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/variables.kt +++ /dev/null @@ -1,29 +0,0 @@ -fun foo() { -// Int Int -// │ │ - val x = 1 -// val foo.x: Int -// │ fun (Int).plus(Int): Int -// Int │ │ Int -// │ │ │ │ - var y = x + 1 -// var foo.y: Int -// │ fun (Int).times(Int): Int -// Int │ │ Int -// │ │ │ │ - val z = y * 2 -// var foo.y: Int -// │ var foo.y: Int -// │ │ fun (Int).plus(Int): Int -// │ │ │ val foo.z: Int -// │ │ │ │ - y = y + z -// var foo.y: Int -// │ fun (Int).minus(Int): Int -// Int │ │ val foo.x: Int -// │ │ │ │ - val w = y - x -// val foo.w: Int -// │ - return w -} diff --git a/compiler/visualizer/testData/rawBuilder/expressions/while.kt b/compiler/visualizer/testData/rawBuilder/expressions/while.kt deleted file mode 100644 index 1adaeab3a68..00000000000 --- a/compiler/visualizer/testData/rawBuilder/expressions/while.kt +++ /dev/null @@ -1,62 +0,0 @@ -// WITH_STDLIB -fun foo(limit: Int) { -// Int Int -// │ │ - var k = 0 -// var foo.k: Int -// │ fun (Int).compareTo(Int): Int -// │ │ foo.limit: Int -// │ │ │ - some@ while (k < limit) { -// var foo.k: Int -// │fun (Int).inc(): Int -// ││ - k++ -// fun io/println(Int): Unit -// │ var foo.k: Int -// │ │ - println(k) -// var foo.k: Int -// │ EQ operator call -// │ │ Int -// │ │ │ - while (k == 13) { -// var foo.k: Int -// │fun (Int).inc(): Int -// ││ - k++ -// Unit -// │ var foo.k: Int -// │ │ fun (Int).compareTo(Int): Int -// │ │ │ foo.limit: Int -// │ │ │ │ - if (k < limit) break@some -// Unit -// │ var foo.k: Int -// │ │ fun (Int).compareTo(Int): Int -// │ │ │ foo.limit: Int -// │ │ │ │ - if (k > limit) continue - } - } -} - -fun bar(limit: Int) { -// Int bar.limit: Int -// │ │ - var k = limit - do { -// var bar.k: Int -// │fun (Int).dec(): Int -// ││ - k-- -// fun io/println(Int): Unit -// │ var bar.k: Int -// │ │ - println(k) -// var bar.k: Int -// │ fun (Int).compareTo(Int): Int -// │ │ Int -// │ │ │ - } while (k >= 0) -} diff --git a/compiler/visualizer/testData/uncommonCases/resultFiles/dataClass.kt b/compiler/visualizer/testData/uncommonCases/resultFiles/dataClass.kt deleted file mode 100644 index e6803708c0f..00000000000 --- a/compiler/visualizer/testData/uncommonCases/resultFiles/dataClass.kt +++ /dev/null @@ -1,55 +0,0 @@ -// FIR_IGNORE -data class Vector(val x: Int, val y: Int) { -// Vector -// │ constructor Vector(Int, Int) -// │ │ val (Vector).x: Int -// │ │ │ fun (Int).plus(Int): Int -// │ │ │ │ Vector.plus.other: Vector -// │ │ │ │ │ val (Vector).x: Int -// │ │ │ │ │ │ val (Vector).y: Int -// │ │ │ │ │ │ │ fun (Int).plus(Int): Int -// │ │ │ │ │ │ │ │ Vector.plus.other: Vector -// │ │ │ │ │ │ │ │ │ val (Vector).y: Int -// │ │ │ │ │ │ │ │ │ │ - fun plus(other: Vector): Vector = Vector(x + other.x, y + other.y) -} - -fun main() { -// Vector -// │ constructor Vector(Int, Int) -// │ │ Int -// │ │ │ Int -// │ │ │ │ - val a = Vector(1, 2) -// Vector -// │ constructor Vector(Int, Int) -// │ │ Int -// │ │ │ Int -// │ │ │ │ - val b = Vector(-1, 10) - -// fun io/println(Any?): Unit -// │ val main.a: Vector -// │ │ val main.b: Vector -// │ │ │ fun (Vector).toString(): String -// │ │ │ │ - println("a = $a, b = ${b.toString()}") -// fun io/println(Any?): Unit -// │ fun (String).plus(Any?): String -// │ │ val main.a: Vector -// │ │ │ fun (Vector).plus(Vector): Vector -// │ │ │ │ val main.b: Vector -// │ │ │ │ │ - println("a + b = " + (a + b)) -// fun io/println(Any?): Unit -// │ val main.a: Vector -// │ │ fun (Vector).hashCode(): Int -// │ │ │ - println("a hash - ${a.hashCode()}") - -// val main.a: Vector -// │ fun (Vector).equals(Any?): Boolean -// fun io/println(Any?): Unit │ │ val main.b: Vector -// │ │ │ │ - println("a is equal to b ${a.equals(b)}") -} diff --git a/compiler/visualizer/testData/uncommonCases/resultFiles/delegation.kt b/compiler/visualizer/testData/uncommonCases/resultFiles/delegation.kt deleted file mode 100644 index 30ebb4349f9..00000000000 --- a/compiler/visualizer/testData/uncommonCases/resultFiles/delegation.kt +++ /dev/null @@ -1,41 +0,0 @@ -interface Base { - fun printMessage() - fun printMessageLine() -} - -class BaseImpl(val x: Int) : Base { -// fun io/print(Int): Unit -// │ val (BaseImpl).x: Int -// │ │ - override fun printMessage() { print(x) } -// fun io/println(Int): Unit -// │ val (BaseImpl).x: Int -// │ │ - override fun printMessageLine() { println(x) } -} - -// Derived..b: Base -// │ -class Derived(b: Base) : Base by b { -// fun io/print(Any?): Unit -// │ - override fun printMessage() { print("abc") } -} - -fun main() { -// BaseImpl -// │ constructor BaseImpl(Int) -// │ │ Int -// │ │ │ - val b = BaseImpl(10) -// constructor Derived(Base) -// │ val main.b: BaseImpl -// │ │ fun (Derived).printMessage(): Unit -// │ │ │ - Derived(b).printMessage() -// constructor Derived(Base) -// │ val main.b: BaseImpl -// │ │ fun (Base).printMessageLine(): Unit -// │ │ │ - Derived(b).printMessageLine() -} diff --git a/compiler/visualizer/testData/uncommonCases/resultFiles/innerWith.kt b/compiler/visualizer/testData/uncommonCases/resultFiles/innerWith.kt deleted file mode 100644 index 88c46445da2..00000000000 --- a/compiler/visualizer/testData/uncommonCases/resultFiles/innerWith.kt +++ /dev/null @@ -1,94 +0,0 @@ -package p - -class A { -// Int Int -// │ │ - val aProp = 10 - fun call() {} -} - -class B { -// Int Int -// │ │ - val bProp = 1 -} - -fun foo(a: Int, b: Int): Int { -// fun with(T, T.() -> R): R -// │ constructor A() -// │ │ with@0 -// │ │ │ - with(A()) { -// val (A).aProp: Int -// this@0 -// │ - aProp -// fun (A).call(): Unit -// this@0 -// │ - call() - -// fun with(T, T.() -> R): R -// │ constructor B() -// │ │ with@1 -// │ │ │ - with(B()) { -// val (A).aProp: Int -// this@0 -// │ - aProp -// val (B).bProp: Int -// this@1 -// │ - bProp -// val (A).aProp: Int -// this@0 -// │ - aProp - } - } - -// fun with(T, T.() -> R): R -// │ constructor A() -// │ │ with@0 -// │ │ │ - with(A()) { -// val (A).aProp: Int -// this@0 -// │ - aProp - -// fun with(T, T.() -> R): R -// │ constructor B() -// │ │ with@1 -// │ │ │ - with(B()) { -// val (A).aProp: Int -// this@0 -// │ - aProp -// val (B).bProp: Int -// this@1 -// │ - bProp - } - -// fun with(T, T.() -> R): R -// │ constructor B() -// │ │ with@1 -// │ │ │ - with(B()) { -// val (A).aProp: Int -// this@0 -// │ - aProp -// val (B).bProp: Int -// this@1 -// │ - bProp - } - } -// foo.a: Int -// │ - return a -} diff --git a/compiler/visualizer/testData/uncommonCases/resultFiles/lists.kt b/compiler/visualizer/testData/uncommonCases/resultFiles/lists.kt deleted file mode 100644 index 915a6730a62..00000000000 --- a/compiler/visualizer/testData/uncommonCases/resultFiles/lists.kt +++ /dev/null @@ -1,32 +0,0 @@ -// FIR_IGNORE -package org.jetbrains.kotlin.test - -// collections/List -// │ fun collections/listOf(vararg T): collections/List -// │ │ Int -// │ │ │ Int -// │ │ │ │ Int -// │ │ │ │ │ -val listOfInt = listOf(1, 2, 3) -// java/util/ArrayList -// │ constructor java/util/ArrayList() -// │ │ -val javaList = java.util.ArrayList() - -// java/util/ArrayList -// │ -fun move(): java.util.ArrayList { -// Int val listOfInt: collections/List -// │ │ - for (elem in listOfInt) { -// val javaList: java/util/ArrayList -// │ fun (java/util/ArrayList).add(E): Boolean -// │ │ val move.elem: Int -// │ │ │ - javaList.add(elem) - } - -// val javaList: java/util/ArrayList -// │ - return javaList -} diff --git a/compiler/visualizer/testData/uncommonCases/resultFiles/overrideEquals.kt b/compiler/visualizer/testData/uncommonCases/resultFiles/overrideEquals.kt deleted file mode 100644 index 4ccf1d8b2e0..00000000000 --- a/compiler/visualizer/testData/uncommonCases/resultFiles/overrideEquals.kt +++ /dev/null @@ -1,55 +0,0 @@ -class A(val a: Int) { - override fun equals(other: Any?): Boolean { -// Unit -// │ A.equals.other: Any? -// │ │ Boolean -// │ │ │ - if (other !is A) return false -// val (A).a: Int -// │ EQ operator call -// │ │ A.equals.other: Any? -// │ │ │ val (A).a: Int -// │ │ │ │ - return this.a == other.a - } -} - -open class B(val b: Int) { - override fun equals(other: Any?): Boolean { -// Unit -// │ B.equals.other: Any? -// │ │ Boolean -// │ │ │ - if (other !is B) return false -// val (B).b: Int -// │ EQ operator call -// │ │ B.equals.other: Any? -// │ │ │ val (B).b: Int -// │ │ │ │ - return this.b == other.b - } -} - -// constructor B(Int) -// │ C..c: Int -// │ │ -class C(c: Int): B(c) {} - -// constructor A(Int) -// │ EQ operator call -// │ │ constructor A(Int) -// Boolean │ Int │ │ Int -// │ │ │ │ │ │ -val areEqual = A(10) == A(11) -// constructor C(Int) -// │ EQ operator call -// │ │ constructor C(Int) -// Boolean │ Int │ │ Int -// │ │ │ │ │ │ -val areEqual2 = C(10) == C(11) -// constructor A(Int) -// │ EQ operator call -// │ │ constructor C(Int) -// Boolean │ Int │ │ Int -// │ │ │ │ │ │ -val areEqual3 = A(10) == C(11) diff --git a/compiler/visualizer/testData/uncommonCases/resultFiles/properties.kt b/compiler/visualizer/testData/uncommonCases/resultFiles/properties.kt deleted file mode 100644 index f7ef9a8f922..00000000000 --- a/compiler/visualizer/testData/uncommonCases/resultFiles/properties.kt +++ /dev/null @@ -1,83 +0,0 @@ -package org.jetbrains.kotlin.test - -// Int Int -// │ │ -val p1 = 10 -// Double Double -// │ │ -val p2: Double = 1.0 -// Float Float -// │ │ -val p3: Float = 2.5f -// String -// │ -val p4 = "some string" - -// Double -// │ val p1: Int -// │ │ fun (Int).plus(Double): Double -// │ │ │ val p2: Double -// │ │ │ │ -val p5 = p1 + p2 -// Double -// │ val p1: Int -// │ │ fun (Int).times(Double): Double -// │ │ │ val p2: Double -// │ │ │ │ fun (Double).plus(Double): Double -// │ │ │ │ │ val p5: Double -// │ │ │ │ │ │ fun (Double).minus(Float): Double -// │ │ │ │ │ │ │ val p3: Float -// │ │ │ │ │ │ │ │ -val p6 = p1 * p2 + (p5 - p3) - -// Float -// │ -val withGetter -// val p1: Int -// │ fun (Int).times(Float): Float -// │ │ val p3: Float -// │ │ │ - get() = p1 * p3 - -// String -// │ -var withSetter -// val p4: String -// │ - get() = p4 -// String .value: String -// │ │ - set(value) = value - -// Boolean -// │ -val withGetter2: Boolean - get() { -// Boolean -// │ - return true - } - -// String -// │ -var withSetter2: String - get() = "1" -// String -// │ - set(value) { -// var .field: String -// │ .value: String -// │ │ fun (String).plus(Any?): String -// │ │ │ - field = value + "!" - } - -// String -// │ -private val privateGetter: String = "cba" - get - -// String -// │ -var privateSetter: String = "abc" - private set diff --git a/compiler/visualizer/testData/uncommonCases/resultFiles/receiver.kt b/compiler/visualizer/testData/uncommonCases/resultFiles/receiver.kt deleted file mode 100644 index 814d2e58704..00000000000 --- a/compiler/visualizer/testData/uncommonCases/resultFiles/receiver.kt +++ /dev/null @@ -1,27 +0,0 @@ -fun Int.addOne(): Int { -// fun (Int).plus(Int): Int -// │ Int -// │ │ - return this + 1 -} - -// Int -// │ -val Int.repeat: Int - get() = this - -fun main() { -// Int Int -// │ │ - val i = 2 -// val main.i: Int -// │ fun Int.addOne(): Int -// │ │ - i.addOne() -// val main.i: Int -// │ val Int.repeat: Int -// │ │ fun (Int).times(Int): Int -// Int │ │ │ Int -// │ │ │ │ │ - val p = i.repeat * 2 -} \ No newline at end of file diff --git a/compiler/visualizer/testData/uncommonCases/resultFiles/superTypes.kt b/compiler/visualizer/testData/uncommonCases/resultFiles/superTypes.kt deleted file mode 100644 index f8d9e73a73d..00000000000 --- a/compiler/visualizer/testData/uncommonCases/resultFiles/superTypes.kt +++ /dev/null @@ -1,25 +0,0 @@ -package org.jetbrains.kotlin.test - -abstract class Base(var x: T) { - abstract fun replace(newValue: T) -} - -// constructor Base(T) -// │ Derived..x: Int -// │ │ -class Derived(x: Int): Base(x) { - override fun replace(newValue: Int) { -// var (Base).x: T -// │ Derived.replace.newValue: Int -// │ │ - x = newValue - } -} - -fun test() { -// constructor Derived(Int) -// │ fun (Derived).replace(Int): Unit -// │ Int │ Int -// │ │ │ │ - Derived(10).replace(20) -} diff --git a/compiler/visualizer/testData/uncommonCases/resultFiles/variance.kt b/compiler/visualizer/testData/uncommonCases/resultFiles/variance.kt deleted file mode 100644 index 146abe7ed2c..00000000000 --- a/compiler/visualizer/testData/uncommonCases/resultFiles/variance.kt +++ /dev/null @@ -1,24 +0,0 @@ -interface Source { - fun nextT(): T -} - -fun demo(strs: Source) { -// Source demo.strs: Source -// │ │ - val objects: Source = strs -} - -interface Comparable { - operator fun compareTo(other: T): Int -} - -fun demo(x: Comparable) { -// demo.x: Comparable -// │ fun (Comparable).compareTo(T): Int -// │ │ Double -// │ │ │ - x.compareTo(1.0) -// Comparable demo.x: Comparable -// │ │ - val y: Comparable = x -} diff --git a/compiler/visualizer/testData/uncommonCases/resultFiles/where.kt b/compiler/visualizer/testData/uncommonCases/resultFiles/where.kt deleted file mode 100644 index 2426a53e8b7..00000000000 --- a/compiler/visualizer/testData/uncommonCases/resultFiles/where.kt +++ /dev/null @@ -1,29 +0,0 @@ -// FIR_IGNORE -// collections/List collections/List -// │ │ -fun copyWhenGreater(list: List, threshold: T): List - where T : CharSequence, - T : Comparable { -// copyWhenGreater.list: collections/List -// │ fun collections/Iterable.filter((T) -> Boolean): collections/List -// │ │ copyWhenGreater..it: T -// │ │ │ fun (Comparable).compareTo(T): Int -// │ │ │ │ copyWhenGreater.threshold: T -// │ │ │ │ │ fun collections/Iterable.map((T) -> R): collections/List -// │ │ │ │ │ │ copyWhenGreater..it: T -// │ │ │ │ │ │ │ fun (Any).toString(): String -// │ │ │ │ │ │ │ │ - return list.filter { it > threshold }.map { it.toString() } -} - -fun main() { -// collections/List -// │ fun collections/listOf(vararg T): collections/List -// │ │ - val list = listOf("1", "2", "3") -// collections/List -// │ fun copyWhenGreater(collections/List, T): collections/List where T : Comparable -// │ │ val main.list: collections/List -// │ │ │ - val copy = copyWhenGreater(list, "2") -} diff --git a/compiler/visualizer/testData/uncommonCases/testFiles/dataClass.kt b/compiler/visualizer/testData/uncommonCases/testFiles/dataClass.kt deleted file mode 100644 index 21ef0517b0c..00000000000 --- a/compiler/visualizer/testData/uncommonCases/testFiles/dataClass.kt +++ /dev/null @@ -1,14 +0,0 @@ -data class Vector(val x: Int, val y: Int) { - fun plus(other: Vector): Vector = Vector(x + other.x, y + other.y) -} - -fun main() { - val a = Vector(1, 2) - val b = Vector(-1, 10) - - println("a = $a, b = ${b.toString()}") - println("a + b = " + (a + b)) - println("a hash - ${a.hashCode()}") - - println("a is equal to b ${a.equals(b)}") -} \ No newline at end of file diff --git a/compiler/visualizer/testData/uncommonCases/testFiles/delegation.kt b/compiler/visualizer/testData/uncommonCases/testFiles/delegation.kt deleted file mode 100644 index dbd26e638c9..00000000000 --- a/compiler/visualizer/testData/uncommonCases/testFiles/delegation.kt +++ /dev/null @@ -1,19 +0,0 @@ -interface Base { - fun printMessage() - fun printMessageLine() -} - -class BaseImpl(val x: Int) : Base { - override fun printMessage() { print(x) } - override fun printMessageLine() { println(x) } -} - -class Derived(b: Base) : Base by b { - override fun printMessage() { print("abc") } -} - -fun main() { - val b = BaseImpl(10) - Derived(b).printMessage() - Derived(b).printMessageLine() -} \ No newline at end of file diff --git a/compiler/visualizer/testData/uncommonCases/testFiles/innerWith.kt b/compiler/visualizer/testData/uncommonCases/testFiles/innerWith.kt deleted file mode 100644 index 0d15de612da..00000000000 --- a/compiler/visualizer/testData/uncommonCases/testFiles/innerWith.kt +++ /dev/null @@ -1,38 +0,0 @@ -package p - -class A { - val aProp = 10 - fun call() {} -} - -class B { - val bProp = 1 -} - -fun foo(a: Int, b: Int): Int { - with(A()) { - aProp - call() - - with(B()) { - aProp - bProp - aProp - } - } - - with(A()) { - aProp - - with(B()) { - aProp - bProp - } - - with(B()) { - aProp - bProp - } - } - return a -} \ No newline at end of file diff --git a/compiler/visualizer/testData/uncommonCases/testFiles/lists.kt b/compiler/visualizer/testData/uncommonCases/testFiles/lists.kt deleted file mode 100644 index 75c3a8b374f..00000000000 --- a/compiler/visualizer/testData/uncommonCases/testFiles/lists.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.jetbrains.kotlin.test - -val listOfInt = listOf(1, 2, 3) -val javaList = java.util.ArrayList() - -fun move(): java.util.ArrayList { - for (elem in listOfInt) { - javaList.add(elem) - } - - return javaList -} diff --git a/compiler/visualizer/testData/uncommonCases/testFiles/overrideEquals.kt b/compiler/visualizer/testData/uncommonCases/testFiles/overrideEquals.kt deleted file mode 100644 index 08ffaa87d3f..00000000000 --- a/compiler/visualizer/testData/uncommonCases/testFiles/overrideEquals.kt +++ /dev/null @@ -1,19 +0,0 @@ -class A(val a: Int) { - override fun equals(other: Any?): Boolean { - if (other !is A) return false - return this.a == other.a - } -} - -open class B(val b: Int) { - override fun equals(other: Any?): Boolean { - if (other !is B) return false - return this.b == other.b - } -} - -class C(c: Int): B(c) {} - -val areEqual = A(10) == A(11) -val areEqual2 = C(10) == C(11) -val areEqual3 = A(10) == C(11) \ No newline at end of file diff --git a/compiler/visualizer/testData/uncommonCases/testFiles/properties.kt b/compiler/visualizer/testData/uncommonCases/testFiles/properties.kt deleted file mode 100644 index f75c19ba623..00000000000 --- a/compiler/visualizer/testData/uncommonCases/testFiles/properties.kt +++ /dev/null @@ -1,34 +0,0 @@ -package org.jetbrains.kotlin.test - -val p1 = 10 -val p2: Double = 1.0 -val p3: Float = 2.5f -val p4 = "some string" - -val p5 = p1 + p2 -val p6 = p1 * p2 + (p5 - p3) - -val withGetter - get() = p1 * p3 - -var withSetter - get() = p4 - set(value) = value - -val withGetter2: Boolean - get() { - return true - } - -var withSetter2: String - get() = "1" - set(value) { - field = value + "!" - } - -private val privateGetter: String = "cba" - get - -var privateSetter: String = "abc" - private set - diff --git a/compiler/visualizer/testData/uncommonCases/testFiles/receiver.kt b/compiler/visualizer/testData/uncommonCases/testFiles/receiver.kt deleted file mode 100644 index 1e90618325c..00000000000 --- a/compiler/visualizer/testData/uncommonCases/testFiles/receiver.kt +++ /dev/null @@ -1,12 +0,0 @@ -fun Int.addOne(): Int { - return this + 1 -} - -val Int.repeat: Int - get() = this - -fun main() { - val i = 2 - i.addOne() - val p = i.repeat * 2 -} \ No newline at end of file diff --git a/compiler/visualizer/testData/uncommonCases/testFiles/superTypes.kt b/compiler/visualizer/testData/uncommonCases/testFiles/superTypes.kt deleted file mode 100644 index 1af1202a02f..00000000000 --- a/compiler/visualizer/testData/uncommonCases/testFiles/superTypes.kt +++ /dev/null @@ -1,15 +0,0 @@ -package org.jetbrains.kotlin.test - -abstract class Base(var x: T) { - abstract fun replace(newValue: T) -} - -class Derived(x: Int): Base(x) { - override fun replace(newValue: Int) { - x = newValue - } -} - -fun test() { - Derived(10).replace(20) -} \ No newline at end of file diff --git a/compiler/visualizer/testData/uncommonCases/testFiles/variance.kt b/compiler/visualizer/testData/uncommonCases/testFiles/variance.kt deleted file mode 100644 index d390a1286de..00000000000 --- a/compiler/visualizer/testData/uncommonCases/testFiles/variance.kt +++ /dev/null @@ -1,16 +0,0 @@ -interface Source { - fun nextT(): T -} - -fun demo(strs: Source) { - val objects: Source = strs -} - -interface Comparable { - operator fun compareTo(other: T): Int -} - -fun demo(x: Comparable) { - x.compareTo(1.0) - val y: Comparable = x -} \ No newline at end of file diff --git a/compiler/visualizer/testData/uncommonCases/testFiles/where.kt b/compiler/visualizer/testData/uncommonCases/testFiles/where.kt deleted file mode 100644 index f5111a9b23b..00000000000 --- a/compiler/visualizer/testData/uncommonCases/testFiles/where.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun copyWhenGreater(list: List, threshold: T): List - where T : CharSequence, - T : Comparable { - return list.filter { it > threshold }.map { it.toString() } -} - -fun main() { - val list = listOf("1", "2", "3") - val copy = copyWhenGreater(list, "2") -} \ No newline at end of file diff --git a/compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/VisualizerBlackBoxTestGenerated.java b/compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/VisualizerBlackBoxTestGenerated.java deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/fir/FirVisualizerForRawFirDataGenerated.java b/compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/fir/FirVisualizerForRawFirDataGenerated.java deleted file mode 100644 index 514b924a756..00000000000 --- a/compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/fir/FirVisualizerForRawFirDataGenerated.java +++ /dev/null @@ -1,668 +0,0 @@ -/* - * Copyright 2010-2023 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.visualizer.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.test.generators.GenerateCompilerTestsKt}. DO NOT MODIFY MANUALLY */ -@SuppressWarnings("all") -@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder") -@TestDataPath("$PROJECT_ROOT") -public class FirVisualizerForRawFirDataGenerated extends AbstractFirVisualizerTest { - @Test - public void testAllFilesPresentInRawBuilder() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @Nested - @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations") - @TestDataPath("$PROJECT_ROOT") - public class Declarations { - @Test - public void testAllFilesPresentInDeclarations() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @Test - @TestMetadata("annotation.kt") - public void testAnnotation() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.kt"); - } - - @Test - @TestMetadata("annotationOnField.kt") - public void testAnnotationOnField() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnField.kt"); - } - - @Test - @TestMetadata("annotationOnProperty.kt") - public void testAnnotationOnProperty() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnProperty.kt"); - } - - @Test - @TestMetadata("annotationsOnNullableParenthesizedTypes.kt") - public void testAnnotationsOnNullableParenthesizedTypes() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationsOnNullableParenthesizedTypes.kt"); - } - - @Test - @TestMetadata("annotationsOnParenthesizedTypes.kt") - public void testAnnotationsOnParenthesizedTypes() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationsOnParenthesizedTypes.kt"); - } - - @Test - @TestMetadata("classWithWrongSuperCall.kt") - public void testClassWithWrongSuperCall() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/classWithWrongSuperCall.kt"); - } - - @Test - @TestMetadata("complexTypes.kt") - public void testComplexTypes() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/complexTypes.kt"); - } - - @Test - @TestMetadata("constructorInObject.kt") - public void testConstructorInObject() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorInObject.kt"); - } - - @Test - @TestMetadata("constructorOfAnonymousObject.kt") - public void testConstructorOfAnonymousObject() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorOfAnonymousObject.kt"); - } - - @Test - @TestMetadata("contextReceivers.kt") - public void testContextReceivers() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contextReceivers.kt"); - } - - @Test - @TestMetadata("danglingAnnotationsClassLevel.kt") - public void testDanglingAnnotationsClassLevel() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/danglingAnnotationsClassLevel.kt"); - } - - @Test - @TestMetadata("danglingAnnotationsFileLevel.kt") - public void testDanglingAnnotationsFileLevel() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/danglingAnnotationsFileLevel.kt"); - } - - @Test - @TestMetadata("delegates.kt") - public void testDelegates() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/delegates.kt"); - } - - @Test - @TestMetadata("derivedClass.kt") - public void testDerivedClass() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/derivedClass.kt"); - } - - @Test - @TestMetadata("emptyAnonymousObject.kt") - public void testEmptyAnonymousObject() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/emptyAnonymousObject.kt"); - } - - @Test - @TestMetadata("enums.kt") - public void testEnums() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enums.kt"); - } - - @Test - @TestMetadata("enums2.kt") - public void testEnums2() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enums2.kt"); - } - - @Test - @TestMetadata("enums3.kt") - public void testEnums3() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enums3.kt"); - } - - @Test - @TestMetadata("expectActual.kt") - public void testExpectActual() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectActual.kt"); - } - - @Test - @TestMetadata("expectClassesAndFunctions.kt") - public void testExpectClassesAndFunctions() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectClassesAndFunctions.kt"); - } - - @Test - @TestMetadata("expectNestedAnnotationClassWithConstructorParameter.kt") - public void testExpectNestedAnnotationClassWithConstructorParameter() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectNestedAnnotationClassWithConstructorParameter.kt"); - } - - @Test - @TestMetadata("expectNestedClassMembers.kt") - public void testExpectNestedClassMembers() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectNestedClassMembers.kt"); - } - - @Test - @TestMetadata("expectNestedEnumClassGeneratedMembers.kt") - public void testExpectNestedEnumClassGeneratedMembers() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectNestedEnumClassGeneratedMembers.kt"); - } - - @Test - @TestMetadata("external.kt") - public void testExternal() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/external.kt"); - } - - @Test - @TestMetadata("F.kt") - public void testF() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/F.kt"); - } - - @Test - @TestMetadata("functionTypes.kt") - public void testFunctionTypes() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/functionTypes.kt"); - } - - @Test - @TestMetadata("genericFunctions.kt") - public void testGenericFunctions() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/genericFunctions.kt"); - } - - @Test - @TestMetadata("genericProperty.kt") - public void testGenericProperty() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/genericProperty.kt"); - } - - @Test - @TestMetadata("initBlockWithDeclarations.kt") - public void testInitBlockWithDeclarations() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/initBlockWithDeclarations.kt"); - } - - @Test - @TestMetadata("invalidDestructing.kt") - public void testInvalidDestructing() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/invalidDestructing.kt"); - } - - @Test - @TestMetadata("nestedClass.kt") - public void testNestedClass() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/nestedClass.kt"); - } - - @Test - @TestMetadata("NestedOfAliasedType.kt") - public void testNestedOfAliasedType() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/NestedOfAliasedType.kt"); - } - - @Test - @TestMetadata("NestedSuperType.kt") - public void testNestedSuperType() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/NestedSuperType.kt"); - } - - @Test - @TestMetadata("noPrimaryConstructor.kt") - public void testNoPrimaryConstructor() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noPrimaryConstructor.kt"); - } - - @Test - @TestMetadata("propertyWithBackingField.kt") - public void testPropertyWithBackingField() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/propertyWithBackingField.kt"); - } - - @Test - @TestMetadata("propertyWithBackingFieldDifferentTypes.kt") - public void testPropertyWithBackingFieldDifferentTypes() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/propertyWithBackingFieldDifferentTypes.kt"); - } - - @Test - @TestMetadata("simpleClass.kt") - public void testSimpleClass() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleClass.kt"); - } - - @Test - @TestMetadata("simpleFun.kt") - public void testSimpleFun() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleFun.kt"); - } - - @Test - @TestMetadata("simpleTypeAlias.kt") - public void testSimpleTypeAlias() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleTypeAlias.kt"); - } - - @Test - @TestMetadata("splitModifierList.kt") - public void testSplitModifierList() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/splitModifierList.kt"); - } - - @Test - @TestMetadata("suspendFunctionTypes.kt") - public void testSuspendFunctionTypes() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/suspendFunctionTypes.kt"); - } - - @Test - @TestMetadata("typeAliasWithGeneric.kt") - public void testTypeAliasWithGeneric() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeAliasWithGeneric.kt"); - } - - @Test - @TestMetadata("typeParameterVsNested.kt") - public void testTypeParameterVsNested() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameterVsNested.kt"); - } - - @Test - @TestMetadata("typeParameters.kt") - public void testTypeParameters() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameters.kt"); - } - - @Test - @TestMetadata("where.kt") - public void testWhere() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/where.kt"); - } - - @Nested - @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts") - @TestDataPath("$PROJECT_ROOT") - public class Contracts { - @Test - public void testAllFilesPresentInContracts() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @Nested - @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax") - @TestDataPath("$PROJECT_ROOT") - public class NewSyntax { - @Test - public void testAllFilesPresentInNewSyntax() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @Test - @TestMetadata("functionWithBothOldAndNewSyntaxContractDescription.kt") - public void testFunctionWithBothOldAndNewSyntaxContractDescription() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/functionWithBothOldAndNewSyntaxContractDescription.kt"); - } - - @Test - @TestMetadata("propertyAccessorsContractDescription.kt") - public void testPropertyAccessorsContractDescription() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/propertyAccessorsContractDescription.kt"); - } - - @Test - @TestMetadata("simpleFunctionsContractDescription.kt") - public void testSimpleFunctionsContractDescription() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/simpleFunctionsContractDescription.kt"); - } - } - - @Nested - @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax") - @TestDataPath("$PROJECT_ROOT") - public class OldSyntax { - @Test - public void testAllFilesPresentInOldSyntax() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @Test - @TestMetadata("contractDescription.kt") - public void testContractDescription() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax/contractDescription.kt"); - } - } - } - - @Nested - @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType") - @TestDataPath("$PROJECT_ROOT") - public class NoParameterType { - @Test - public void testAllFilesPresentInNoParameterType() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @Test - @TestMetadata("noParameterTypRefInCatch.kt") - public void testNoParameterTypRefInCatch() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInCatch.kt"); - } - - @Test - @TestMetadata("noParameterTypRefInFuncionalType.kt") - public void testNoParameterTypRefInFuncionalType() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInFuncionalType.kt"); - } - - @Test - @TestMetadata("noParameterTypRefInFunction.kt") - public void testNoParameterTypRefInFunction() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInFunction.kt"); - } - - @Test - @TestMetadata("noParameterTypRefInLambda.kt") - public void testNoParameterTypRefInLambda() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInLambda.kt"); - } - - @Test - @TestMetadata("noParameterTypRefInPrimaryConstructor.kt") - public void testNoParameterTypRefInPrimaryConstructor() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConstructor.kt"); - } - - @Test - @TestMetadata("noParameterTypRefInPrimaryConstructorWithVararg.kt") - public void testNoParameterTypRefInPrimaryConstructorWithVararg() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConstructorWithVararg.kt"); - } - - @Test - @TestMetadata("noParameterTypRefInPrimaryConsturctorVal.kt") - public void testNoParameterTypRefInPrimaryConsturctorVal() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConsturctorVal.kt"); - } - - @Test - @TestMetadata("noParameterTypRefInPrimaryConsturctorValWithVararg.kt") - public void testNoParameterTypRefInPrimaryConsturctorValWithVararg() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConsturctorValWithVararg.kt"); - } - - @Test - @TestMetadata("noParameterTypRefInSecondaryConstructor.kt") - public void testNoParameterTypRefInSecondaryConstructor() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInSecondaryConstructor.kt"); - } - - @Test - @TestMetadata("noParameterTypRefInSetter.kt") - public void testNoParameterTypRefInSetter() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInSetter.kt"); - } - - @Test - @TestMetadata("uncompletedTypRefInPrimaryConstructorWithVararg.kt") - public void testUncompletedTypRefInPrimaryConstructorWithVararg() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/uncompletedTypRefInPrimaryConstructorWithVararg.kt"); - } - - @Test - @TestMetadata("uncompletedTypRefInPrimaryConsturctorValWithVararg.kt") - public void testUncompletedTypRefInPrimaryConsturctorValWithVararg() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/uncompletedTypRefInPrimaryConsturctorValWithVararg.kt"); - } - } - } - - @Nested - @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions") - @TestDataPath("$PROJECT_ROOT") - public class Expressions { - @Test - public void testAllFilesPresentInExpressions() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @Test - @TestMetadata("annotated.kt") - public void testAnnotated() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.kt"); - } - - @Test - @TestMetadata("arrayAccess.kt") - public void testArrayAccess() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/arrayAccess.kt"); - } - - @Test - @TestMetadata("arrayAssignment.kt") - public void testArrayAssignment() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/arrayAssignment.kt"); - } - - @Test - @TestMetadata("branches.kt") - public void testBranches() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/branches.kt"); - } - - @Test - @TestMetadata("callableReferences.kt") - public void testCallableReferences() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/callableReferences.kt"); - } - - @Test - @TestMetadata("calls.kt") - public void testCalls() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/calls.kt"); - } - - @Test - @TestMetadata("cascadeIf.kt") - public void testCascadeIf() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/cascadeIf.kt"); - } - - @Test - @TestMetadata("classReference.kt") - public void testClassReference() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/classReference.kt"); - } - - @Test - @TestMetadata("collectionLiterals.kt") - public void testCollectionLiterals() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/collectionLiterals.kt"); - } - - @Test - @TestMetadata("destructuring.kt") - public void testDestructuring() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/destructuring.kt"); - } - - @Test - @TestMetadata("for.kt") - public void testFor() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/for.kt"); - } - - @Test - @TestMetadata("genericCalls.kt") - public void testGenericCalls() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/genericCalls.kt"); - } - - @Test - @TestMetadata("in.kt") - public void testIn() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/in.kt"); - } - - @Test - @TestMetadata("inBrackets.kt") - public void testInBrackets() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/inBrackets.kt"); - } - - @Test - @TestMetadata("init.kt") - public void testInit() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/init.kt"); - } - - @Test - @TestMetadata("invalidWhen.kt") - public void testInvalidWhen() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/invalidWhen.kt"); - } - - @Test - @TestMetadata("labelForInfix.kt") - public void testLabelForInfix() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/labelForInfix.kt"); - } - - @Test - @TestMetadata("lambda.kt") - public void testLambda() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/lambda.kt"); - } - - @Test - @TestMetadata("lambdaAndAnonymousFunction.kt") - public void testLambdaAndAnonymousFunction() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/lambdaAndAnonymousFunction.kt"); - } - - @Test - @TestMetadata("localDeclarationWithExpression.kt") - public void testLocalDeclarationWithExpression() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/localDeclarationWithExpression.kt"); - } - - @Test - @TestMetadata("locals.kt") - public void testLocals() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/locals.kt"); - } - - @Test - @TestMetadata("modifications.kt") - public void testModifications() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/modifications.kt"); - } - - @Test - @TestMetadata("namedArgument.kt") - public void testNamedArgument() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/namedArgument.kt"); - } - - @Test - @TestMetadata("nullability.kt") - public void testNullability() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/nullability.kt"); - } - - @Test - @TestMetadata("qualifierWithTypeArguments.kt") - public void testQualifierWithTypeArguments() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/qualifierWithTypeArguments.kt"); - } - - @Test - @TestMetadata("safeCallsWithAssignment.kt") - public void testSafeCallsWithAssignment() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithAssignment.kt"); - } - - @Test - @TestMetadata("safeCallsWithAugmentedAssignment.kt") - public void testSafeCallsWithAugmentedAssignment() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithAugmentedAssignment.kt"); - } - - @Test - @TestMetadata("safeCallsWithUnaryOperators.kt") - public void testSafeCallsWithUnaryOperators() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithUnaryOperators.kt"); - } - - @Test - @TestMetadata("simpleReturns.kt") - public void testSimpleReturns() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/simpleReturns.kt"); - } - - @Test - @TestMetadata("super.kt") - public void testSuper() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/super.kt"); - } - - @Test - @TestMetadata("these.kt") - public void testThese() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/these.kt"); - } - - @Test - @TestMetadata("try.kt") - public void testTry() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/try.kt"); - } - - @Test - @TestMetadata("typeOperators.kt") - public void testTypeOperators() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/typeOperators.kt"); - } - - @Test - @TestMetadata("unary.kt") - public void testUnary() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/unary.kt"); - } - - @Test - @TestMetadata("variables.kt") - public void testVariables() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/variables.kt"); - } - - @Test - @TestMetadata("while.kt") - public void testWhile() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/while.kt"); - } - } -} diff --git a/compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/fir/FirVisualizerForUncommonCasesGenerated.java b/compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/fir/FirVisualizerForUncommonCasesGenerated.java deleted file mode 100644 index 18812c62a6e..00000000000 --- a/compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/fir/FirVisualizerForUncommonCasesGenerated.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2010-2023 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.visualizer.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.test.generators.GenerateCompilerTestsKt}. DO NOT MODIFY MANUALLY */ -@SuppressWarnings("all") -@TestMetadata("compiler/visualizer/testData/uncommonCases/testFiles") -@TestDataPath("$PROJECT_ROOT") -public class FirVisualizerForUncommonCasesGenerated extends AbstractFirVisualizerTest { - @Test - public void testAllFilesPresentInTestFiles() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/visualizer/testData/uncommonCases/testFiles"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @Test - @TestMetadata("dataClass.kt") - public void testDataClass() throws Exception { - runTest("compiler/visualizer/testData/uncommonCases/testFiles/dataClass.kt"); - } - - @Test - @TestMetadata("delegation.kt") - public void testDelegation() throws Exception { - runTest("compiler/visualizer/testData/uncommonCases/testFiles/delegation.kt"); - } - - @Test - @TestMetadata("innerWith.kt") - public void testInnerWith() throws Exception { - runTest("compiler/visualizer/testData/uncommonCases/testFiles/innerWith.kt"); - } - - @Test - @TestMetadata("lists.kt") - public void testLists() throws Exception { - runTest("compiler/visualizer/testData/uncommonCases/testFiles/lists.kt"); - } - - @Test - @TestMetadata("overrideEquals.kt") - public void testOverrideEquals() throws Exception { - runTest("compiler/visualizer/testData/uncommonCases/testFiles/overrideEquals.kt"); - } - - @Test - @TestMetadata("properties.kt") - public void testProperties() throws Exception { - runTest("compiler/visualizer/testData/uncommonCases/testFiles/properties.kt"); - } - - @Test - @TestMetadata("receiver.kt") - public void testReceiver() throws Exception { - runTest("compiler/visualizer/testData/uncommonCases/testFiles/receiver.kt"); - } - - @Test - @TestMetadata("superTypes.kt") - public void testSuperTypes() throws Exception { - runTest("compiler/visualizer/testData/uncommonCases/testFiles/superTypes.kt"); - } - - @Test - @TestMetadata("variance.kt") - public void testVariance() throws Exception { - runTest("compiler/visualizer/testData/uncommonCases/testFiles/variance.kt"); - } - - @Test - @TestMetadata("where.kt") - public void testWhere() throws Exception { - runTest("compiler/visualizer/testData/uncommonCases/testFiles/where.kt"); - } -} diff --git a/compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/psi/PsiVisualizerForRawFirDataGenerated.java b/compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/psi/PsiVisualizerForRawFirDataGenerated.java deleted file mode 100644 index 59d23fc4bda..00000000000 --- a/compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/psi/PsiVisualizerForRawFirDataGenerated.java +++ /dev/null @@ -1,668 +0,0 @@ -/* - * Copyright 2010-2023 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.visualizer.psi; - -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.test.generators.GenerateCompilerTestsKt}. DO NOT MODIFY MANUALLY */ -@SuppressWarnings("all") -@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder") -@TestDataPath("$PROJECT_ROOT") -public class PsiVisualizerForRawFirDataGenerated extends AbstractPsiVisualizerTest { - @Test - public void testAllFilesPresentInRawBuilder() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @Nested - @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations") - @TestDataPath("$PROJECT_ROOT") - public class Declarations { - @Test - public void testAllFilesPresentInDeclarations() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @Test - @TestMetadata("annotation.kt") - public void testAnnotation() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.kt"); - } - - @Test - @TestMetadata("annotationOnField.kt") - public void testAnnotationOnField() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnField.kt"); - } - - @Test - @TestMetadata("annotationOnProperty.kt") - public void testAnnotationOnProperty() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationOnProperty.kt"); - } - - @Test - @TestMetadata("annotationsOnNullableParenthesizedTypes.kt") - public void testAnnotationsOnNullableParenthesizedTypes() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationsOnNullableParenthesizedTypes.kt"); - } - - @Test - @TestMetadata("annotationsOnParenthesizedTypes.kt") - public void testAnnotationsOnParenthesizedTypes() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationsOnParenthesizedTypes.kt"); - } - - @Test - @TestMetadata("classWithWrongSuperCall.kt") - public void testClassWithWrongSuperCall() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/classWithWrongSuperCall.kt"); - } - - @Test - @TestMetadata("complexTypes.kt") - public void testComplexTypes() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/complexTypes.kt"); - } - - @Test - @TestMetadata("constructorInObject.kt") - public void testConstructorInObject() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorInObject.kt"); - } - - @Test - @TestMetadata("constructorOfAnonymousObject.kt") - public void testConstructorOfAnonymousObject() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorOfAnonymousObject.kt"); - } - - @Test - @TestMetadata("contextReceivers.kt") - public void testContextReceivers() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contextReceivers.kt"); - } - - @Test - @TestMetadata("danglingAnnotationsClassLevel.kt") - public void testDanglingAnnotationsClassLevel() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/danglingAnnotationsClassLevel.kt"); - } - - @Test - @TestMetadata("danglingAnnotationsFileLevel.kt") - public void testDanglingAnnotationsFileLevel() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/danglingAnnotationsFileLevel.kt"); - } - - @Test - @TestMetadata("delegates.kt") - public void testDelegates() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/delegates.kt"); - } - - @Test - @TestMetadata("derivedClass.kt") - public void testDerivedClass() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/derivedClass.kt"); - } - - @Test - @TestMetadata("emptyAnonymousObject.kt") - public void testEmptyAnonymousObject() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/emptyAnonymousObject.kt"); - } - - @Test - @TestMetadata("enums.kt") - public void testEnums() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enums.kt"); - } - - @Test - @TestMetadata("enums2.kt") - public void testEnums2() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enums2.kt"); - } - - @Test - @TestMetadata("enums3.kt") - public void testEnums3() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enums3.kt"); - } - - @Test - @TestMetadata("expectActual.kt") - public void testExpectActual() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectActual.kt"); - } - - @Test - @TestMetadata("expectClassesAndFunctions.kt") - public void testExpectClassesAndFunctions() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectClassesAndFunctions.kt"); - } - - @Test - @TestMetadata("expectNestedAnnotationClassWithConstructorParameter.kt") - public void testExpectNestedAnnotationClassWithConstructorParameter() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectNestedAnnotationClassWithConstructorParameter.kt"); - } - - @Test - @TestMetadata("expectNestedClassMembers.kt") - public void testExpectNestedClassMembers() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectNestedClassMembers.kt"); - } - - @Test - @TestMetadata("expectNestedEnumClassGeneratedMembers.kt") - public void testExpectNestedEnumClassGeneratedMembers() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectNestedEnumClassGeneratedMembers.kt"); - } - - @Test - @TestMetadata("external.kt") - public void testExternal() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/external.kt"); - } - - @Test - @TestMetadata("F.kt") - public void testF() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/F.kt"); - } - - @Test - @TestMetadata("functionTypes.kt") - public void testFunctionTypes() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/functionTypes.kt"); - } - - @Test - @TestMetadata("genericFunctions.kt") - public void testGenericFunctions() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/genericFunctions.kt"); - } - - @Test - @TestMetadata("genericProperty.kt") - public void testGenericProperty() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/genericProperty.kt"); - } - - @Test - @TestMetadata("initBlockWithDeclarations.kt") - public void testInitBlockWithDeclarations() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/initBlockWithDeclarations.kt"); - } - - @Test - @TestMetadata("invalidDestructing.kt") - public void testInvalidDestructing() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/invalidDestructing.kt"); - } - - @Test - @TestMetadata("nestedClass.kt") - public void testNestedClass() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/nestedClass.kt"); - } - - @Test - @TestMetadata("NestedOfAliasedType.kt") - public void testNestedOfAliasedType() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/NestedOfAliasedType.kt"); - } - - @Test - @TestMetadata("NestedSuperType.kt") - public void testNestedSuperType() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/NestedSuperType.kt"); - } - - @Test - @TestMetadata("noPrimaryConstructor.kt") - public void testNoPrimaryConstructor() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noPrimaryConstructor.kt"); - } - - @Test - @TestMetadata("propertyWithBackingField.kt") - public void testPropertyWithBackingField() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/propertyWithBackingField.kt"); - } - - @Test - @TestMetadata("propertyWithBackingFieldDifferentTypes.kt") - public void testPropertyWithBackingFieldDifferentTypes() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/propertyWithBackingFieldDifferentTypes.kt"); - } - - @Test - @TestMetadata("simpleClass.kt") - public void testSimpleClass() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleClass.kt"); - } - - @Test - @TestMetadata("simpleFun.kt") - public void testSimpleFun() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleFun.kt"); - } - - @Test - @TestMetadata("simpleTypeAlias.kt") - public void testSimpleTypeAlias() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleTypeAlias.kt"); - } - - @Test - @TestMetadata("splitModifierList.kt") - public void testSplitModifierList() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/splitModifierList.kt"); - } - - @Test - @TestMetadata("suspendFunctionTypes.kt") - public void testSuspendFunctionTypes() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/suspendFunctionTypes.kt"); - } - - @Test - @TestMetadata("typeAliasWithGeneric.kt") - public void testTypeAliasWithGeneric() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeAliasWithGeneric.kt"); - } - - @Test - @TestMetadata("typeParameterVsNested.kt") - public void testTypeParameterVsNested() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameterVsNested.kt"); - } - - @Test - @TestMetadata("typeParameters.kt") - public void testTypeParameters() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameters.kt"); - } - - @Test - @TestMetadata("where.kt") - public void testWhere() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/where.kt"); - } - - @Nested - @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts") - @TestDataPath("$PROJECT_ROOT") - public class Contracts { - @Test - public void testAllFilesPresentInContracts() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @Nested - @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax") - @TestDataPath("$PROJECT_ROOT") - public class NewSyntax { - @Test - public void testAllFilesPresentInNewSyntax() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @Test - @TestMetadata("functionWithBothOldAndNewSyntaxContractDescription.kt") - public void testFunctionWithBothOldAndNewSyntaxContractDescription() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/functionWithBothOldAndNewSyntaxContractDescription.kt"); - } - - @Test - @TestMetadata("propertyAccessorsContractDescription.kt") - public void testPropertyAccessorsContractDescription() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/propertyAccessorsContractDescription.kt"); - } - - @Test - @TestMetadata("simpleFunctionsContractDescription.kt") - public void testSimpleFunctionsContractDescription() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/simpleFunctionsContractDescription.kt"); - } - } - - @Nested - @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax") - @TestDataPath("$PROJECT_ROOT") - public class OldSyntax { - @Test - public void testAllFilesPresentInOldSyntax() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @Test - @TestMetadata("contractDescription.kt") - public void testContractDescription() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax/contractDescription.kt"); - } - } - } - - @Nested - @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType") - @TestDataPath("$PROJECT_ROOT") - public class NoParameterType { - @Test - public void testAllFilesPresentInNoParameterType() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @Test - @TestMetadata("noParameterTypRefInCatch.kt") - public void testNoParameterTypRefInCatch() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInCatch.kt"); - } - - @Test - @TestMetadata("noParameterTypRefInFuncionalType.kt") - public void testNoParameterTypRefInFuncionalType() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInFuncionalType.kt"); - } - - @Test - @TestMetadata("noParameterTypRefInFunction.kt") - public void testNoParameterTypRefInFunction() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInFunction.kt"); - } - - @Test - @TestMetadata("noParameterTypRefInLambda.kt") - public void testNoParameterTypRefInLambda() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInLambda.kt"); - } - - @Test - @TestMetadata("noParameterTypRefInPrimaryConstructor.kt") - public void testNoParameterTypRefInPrimaryConstructor() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConstructor.kt"); - } - - @Test - @TestMetadata("noParameterTypRefInPrimaryConstructorWithVararg.kt") - public void testNoParameterTypRefInPrimaryConstructorWithVararg() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConstructorWithVararg.kt"); - } - - @Test - @TestMetadata("noParameterTypRefInPrimaryConsturctorVal.kt") - public void testNoParameterTypRefInPrimaryConsturctorVal() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConsturctorVal.kt"); - } - - @Test - @TestMetadata("noParameterTypRefInPrimaryConsturctorValWithVararg.kt") - public void testNoParameterTypRefInPrimaryConsturctorValWithVararg() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConsturctorValWithVararg.kt"); - } - - @Test - @TestMetadata("noParameterTypRefInSecondaryConstructor.kt") - public void testNoParameterTypRefInSecondaryConstructor() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInSecondaryConstructor.kt"); - } - - @Test - @TestMetadata("noParameterTypRefInSetter.kt") - public void testNoParameterTypRefInSetter() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInSetter.kt"); - } - - @Test - @TestMetadata("uncompletedTypRefInPrimaryConstructorWithVararg.kt") - public void testUncompletedTypRefInPrimaryConstructorWithVararg() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/uncompletedTypRefInPrimaryConstructorWithVararg.kt"); - } - - @Test - @TestMetadata("uncompletedTypRefInPrimaryConsturctorValWithVararg.kt") - public void testUncompletedTypRefInPrimaryConsturctorValWithVararg() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/uncompletedTypRefInPrimaryConsturctorValWithVararg.kt"); - } - } - } - - @Nested - @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions") - @TestDataPath("$PROJECT_ROOT") - public class Expressions { - @Test - public void testAllFilesPresentInExpressions() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @Test - @TestMetadata("annotated.kt") - public void testAnnotated() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.kt"); - } - - @Test - @TestMetadata("arrayAccess.kt") - public void testArrayAccess() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/arrayAccess.kt"); - } - - @Test - @TestMetadata("arrayAssignment.kt") - public void testArrayAssignment() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/arrayAssignment.kt"); - } - - @Test - @TestMetadata("branches.kt") - public void testBranches() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/branches.kt"); - } - - @Test - @TestMetadata("callableReferences.kt") - public void testCallableReferences() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/callableReferences.kt"); - } - - @Test - @TestMetadata("calls.kt") - public void testCalls() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/calls.kt"); - } - - @Test - @TestMetadata("cascadeIf.kt") - public void testCascadeIf() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/cascadeIf.kt"); - } - - @Test - @TestMetadata("classReference.kt") - public void testClassReference() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/classReference.kt"); - } - - @Test - @TestMetadata("collectionLiterals.kt") - public void testCollectionLiterals() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/collectionLiterals.kt"); - } - - @Test - @TestMetadata("destructuring.kt") - public void testDestructuring() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/destructuring.kt"); - } - - @Test - @TestMetadata("for.kt") - public void testFor() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/for.kt"); - } - - @Test - @TestMetadata("genericCalls.kt") - public void testGenericCalls() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/genericCalls.kt"); - } - - @Test - @TestMetadata("in.kt") - public void testIn() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/in.kt"); - } - - @Test - @TestMetadata("inBrackets.kt") - public void testInBrackets() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/inBrackets.kt"); - } - - @Test - @TestMetadata("init.kt") - public void testInit() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/init.kt"); - } - - @Test - @TestMetadata("invalidWhen.kt") - public void testInvalidWhen() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/invalidWhen.kt"); - } - - @Test - @TestMetadata("labelForInfix.kt") - public void testLabelForInfix() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/labelForInfix.kt"); - } - - @Test - @TestMetadata("lambda.kt") - public void testLambda() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/lambda.kt"); - } - - @Test - @TestMetadata("lambdaAndAnonymousFunction.kt") - public void testLambdaAndAnonymousFunction() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/lambdaAndAnonymousFunction.kt"); - } - - @Test - @TestMetadata("localDeclarationWithExpression.kt") - public void testLocalDeclarationWithExpression() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/localDeclarationWithExpression.kt"); - } - - @Test - @TestMetadata("locals.kt") - public void testLocals() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/locals.kt"); - } - - @Test - @TestMetadata("modifications.kt") - public void testModifications() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/modifications.kt"); - } - - @Test - @TestMetadata("namedArgument.kt") - public void testNamedArgument() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/namedArgument.kt"); - } - - @Test - @TestMetadata("nullability.kt") - public void testNullability() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/nullability.kt"); - } - - @Test - @TestMetadata("qualifierWithTypeArguments.kt") - public void testQualifierWithTypeArguments() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/qualifierWithTypeArguments.kt"); - } - - @Test - @TestMetadata("safeCallsWithAssignment.kt") - public void testSafeCallsWithAssignment() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithAssignment.kt"); - } - - @Test - @TestMetadata("safeCallsWithAugmentedAssignment.kt") - public void testSafeCallsWithAugmentedAssignment() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithAugmentedAssignment.kt"); - } - - @Test - @TestMetadata("safeCallsWithUnaryOperators.kt") - public void testSafeCallsWithUnaryOperators() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithUnaryOperators.kt"); - } - - @Test - @TestMetadata("simpleReturns.kt") - public void testSimpleReturns() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/simpleReturns.kt"); - } - - @Test - @TestMetadata("super.kt") - public void testSuper() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/super.kt"); - } - - @Test - @TestMetadata("these.kt") - public void testThese() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/these.kt"); - } - - @Test - @TestMetadata("try.kt") - public void testTry() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/try.kt"); - } - - @Test - @TestMetadata("typeOperators.kt") - public void testTypeOperators() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/typeOperators.kt"); - } - - @Test - @TestMetadata("unary.kt") - public void testUnary() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/unary.kt"); - } - - @Test - @TestMetadata("variables.kt") - public void testVariables() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/variables.kt"); - } - - @Test - @TestMetadata("while.kt") - public void testWhile() throws Exception { - runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/while.kt"); - } - } -} diff --git a/compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/psi/PsiVisualizerForUncommonCasesGenerated.java b/compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/psi/PsiVisualizerForUncommonCasesGenerated.java deleted file mode 100644 index 0cffe0f563d..00000000000 --- a/compiler/visualizer/tests-gen/org/jetbrains/kotlin/visualizer/psi/PsiVisualizerForUncommonCasesGenerated.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2010-2023 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.visualizer.psi; - -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.test.generators.GenerateCompilerTestsKt}. DO NOT MODIFY MANUALLY */ -@SuppressWarnings("all") -@TestMetadata("compiler/visualizer/testData/uncommonCases/testFiles") -@TestDataPath("$PROJECT_ROOT") -public class PsiVisualizerForUncommonCasesGenerated extends AbstractPsiVisualizerTest { - @Test - public void testAllFilesPresentInTestFiles() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/visualizer/testData/uncommonCases/testFiles"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @Test - @TestMetadata("dataClass.kt") - public void testDataClass() throws Exception { - runTest("compiler/visualizer/testData/uncommonCases/testFiles/dataClass.kt"); - } - - @Test - @TestMetadata("delegation.kt") - public void testDelegation() throws Exception { - runTest("compiler/visualizer/testData/uncommonCases/testFiles/delegation.kt"); - } - - @Test - @TestMetadata("innerWith.kt") - public void testInnerWith() throws Exception { - runTest("compiler/visualizer/testData/uncommonCases/testFiles/innerWith.kt"); - } - - @Test - @TestMetadata("lists.kt") - public void testLists() throws Exception { - runTest("compiler/visualizer/testData/uncommonCases/testFiles/lists.kt"); - } - - @Test - @TestMetadata("overrideEquals.kt") - public void testOverrideEquals() throws Exception { - runTest("compiler/visualizer/testData/uncommonCases/testFiles/overrideEquals.kt"); - } - - @Test - @TestMetadata("properties.kt") - public void testProperties() throws Exception { - runTest("compiler/visualizer/testData/uncommonCases/testFiles/properties.kt"); - } - - @Test - @TestMetadata("receiver.kt") - public void testReceiver() throws Exception { - runTest("compiler/visualizer/testData/uncommonCases/testFiles/receiver.kt"); - } - - @Test - @TestMetadata("superTypes.kt") - public void testSuperTypes() throws Exception { - runTest("compiler/visualizer/testData/uncommonCases/testFiles/superTypes.kt"); - } - - @Test - @TestMetadata("variance.kt") - public void testVariance() throws Exception { - runTest("compiler/visualizer/testData/uncommonCases/testFiles/variance.kt"); - } - - @Test - @TestMetadata("where.kt") - public void testWhere() throws Exception { - runTest("compiler/visualizer/testData/uncommonCases/testFiles/where.kt"); - } -} diff --git a/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/AbstractVisualizerBlackBoxTest.kt b/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/AbstractVisualizerBlackBoxTest.kt deleted file mode 100644 index 7970d776b0d..00000000000 --- a/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/AbstractVisualizerBlackBoxTest.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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.visualizer - -import org.jetbrains.kotlin.compiler.visualizer.FirVisualizer -import org.jetbrains.kotlin.compiler.visualizer.PsiVisualizer -import org.jetbrains.kotlin.platform.jvm.JvmPlatforms -import org.jetbrains.kotlin.test.Constructor -import org.jetbrains.kotlin.test.TestConfiguration -import org.jetbrains.kotlin.test.TestRunner -import org.jetbrains.kotlin.test.builders.testConfiguration -import org.jetbrains.kotlin.test.directives.ConfigurationDirectives -import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendFacade -import org.jetbrains.kotlin.test.frontend.fir.FirFrontendFacade -import org.jetbrains.kotlin.test.model.* -import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerTest -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.jetbrains.kotlin.test.services.sourceProviders.AdditionalDiagnosticsSourceFilesProvider -import org.jetbrains.kotlin.test.services.sourceProviders.CodegenHelpersSourceFilesProvider -import org.jetbrains.kotlin.test.services.sourceProviders.CoroutineHelpersSourceFilesProvider - -abstract class AbstractVisualizerBlackBoxTest { - private fun > createConfiguration( - filePath: String, - frontendKind: FrontendKind, - frontendFacade: Constructor> - ): TestConfiguration = testConfiguration(filePath) { - assertions = JUnit5Assertions - testInfo = KotlinTestInfo("_undefined_", "_testUndefined_", setOf()) - startingArtifactFactory = { ResultingArtifact.Source() } - - useAdditionalService(::TemporaryDirectoryManagerImpl) - useSourcePreprocessor(*AbstractKotlinCompilerTest.defaultPreprocessors.toTypedArray()) - useDirectives(*AbstractKotlinCompilerTest.defaultDirectiveContainers.toTypedArray()) - - globalDefaults { - targetPlatform = JvmPlatforms.defaultJvmPlatform - dependencyKind = DependencyKind.Source - frontend = frontendKind - } - - defaultDirectives { - +ConfigurationDirectives.WITH_STDLIB - } - - useConfigurators( - ::CommonEnvironmentConfigurator, - ::JvmEnvironmentConfigurator, - ) - - useAdditionalSourceProviders( - ::AdditionalDiagnosticsSourceFilesProvider, - ::CoroutineHelpersSourceFilesProvider, - ::CodegenHelpersSourceFilesProvider - ) - - facadeStep(frontendFacade) - } - - fun runTest(filePath: String) { - lateinit var psiRenderResult: String - lateinit var firRenderResult: String - - val psiConfiguration = createConfiguration(filePath, FrontendKinds.ClassicFrontend, ::ClassicFrontendFacade) - TestRunner(psiConfiguration).runTest(filePath) { testConfiguration -> - testConfiguration.testServices.moduleStructure.modules.forEach { psiModule -> - val psiArtifact = testConfiguration.testServices.dependencyProvider.getArtifact(psiModule, FrontendKinds.ClassicFrontend) - val psiRenderer = psiArtifact.ktFiles.values.firstOrNull()?.let { PsiVisualizer(it, psiArtifact.analysisResult) } - psiRenderResult = psiRenderer?.render()?.trim() ?: "" - } - } - - val firConfiguration = createConfiguration(filePath, FrontendKinds.FIR, ::FirFrontendFacade) - TestRunner(firConfiguration).runTest(filePath) { testConfiguration -> - testConfiguration.testServices.moduleStructure.modules.forEach { firModule -> - val firArtifact = testConfiguration.testServices.dependencyProvider.getArtifact(firModule, FrontendKinds.FIR) - val firRenderer = firArtifact.mainFirFiles.values.firstOrNull()?.let { FirVisualizer(it) } - firRenderResult = firRenderer?.render()?.trim() ?: "" - } - } - - psiConfiguration.testServices.assertions.assertEquals(psiRenderResult, firRenderResult) - } -} - diff --git a/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/AbstractVisualizerTest.kt b/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/AbstractVisualizerTest.kt deleted file mode 100644 index b583b01ba4d..00000000000 --- a/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/AbstractVisualizerTest.kt +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2010-2019 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.visualizer - -import org.jetbrains.kotlin.platform.jvm.JvmPlatforms -import org.jetbrains.kotlin.test.Constructor -import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder -import org.jetbrains.kotlin.test.directives.ConfigurationDirectives -import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendFacade -import org.jetbrains.kotlin.test.frontend.fir.FirFrontendFacade -import org.jetbrains.kotlin.test.model.DependencyKind -import org.jetbrains.kotlin.test.model.FrontendKind -import org.jetbrains.kotlin.test.model.FrontendOutputHandler -import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerTest -import org.jetbrains.kotlin.test.services.configuration.CommonEnvironmentConfigurator -import org.jetbrains.kotlin.test.services.configuration.JvmEnvironmentConfigurator - -abstract class AbstractVisualizerTest : AbstractKotlinCompilerTest() { - abstract val handler: Constructor> - abstract val frontendKind: FrontendKind<*> - - override fun TestConfigurationBuilder.configuration() { - globalDefaults { - frontend = frontendKind - targetPlatform = JvmPlatforms.defaultJvmPlatform - dependencyKind = DependencyKind.Source - } - - useConfigurators( - ::CommonEnvironmentConfigurator, - ::JvmEnvironmentConfigurator, - ) - // TODO -// useFrontendFacades( -// ::FirFrontendFacade, -// ::ClassicFrontendFacade -// ) -// useFrontendHandlers(handler) - - defaultDirectives { - +ConfigurationDirectives.WITH_STDLIB - } - - forTestsMatching("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/*") { - defaultDirectives { - VisualizerDirectives.TEST_FILE_PATH with "fir/raw-fir/psi2fir" - VisualizerDirectives.EXPECTED_FILE_PATH with "visualizer" - } - } - - forTestsMatching("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/*") { - defaultDirectives { - VisualizerDirectives.TEST_FILE_PATH with "fir/raw-fir/psi2fir" - VisualizerDirectives.EXPECTED_FILE_PATH with "visualizer" - } - } - - forTestsMatching("compiler/visualizer/testData/uncommonCases/*") { - defaultDirectives { - VisualizerDirectives.TEST_FILE_PATH with "uncommonCases/testFiles" - VisualizerDirectives.EXPECTED_FILE_PATH with "uncommonCases/resultFiles" - } - } - } -} - diff --git a/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/GenerateVisualizerTests.kt b/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/GenerateVisualizerTests.kt deleted file mode 100644 index 8d961adbb91..00000000000 --- a/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/GenerateVisualizerTests.kt +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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.visualizer - -import org.jetbrains.kotlin.generators.generateTestGroupSuiteWithJUnit5 - -fun main(args: Array) { - System.setProperty("java.awt.headless", "true") - - generateTestGroupSuiteWithJUnit5(args) { - testGroup("compiler/visualizer/tests-gen", "compiler/testData") { - testClass() { - model("codegen/box") - } - } - } -} diff --git a/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/VisualizerDirectives.kt b/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/VisualizerDirectives.kt deleted file mode 100644 index 4eb4cc60c96..00000000000 --- a/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/VisualizerDirectives.kt +++ /dev/null @@ -1,17 +0,0 @@ -/* - * 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.visualizer - -import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer - -internal object VisualizerDirectives : SimpleDirectivesContainer() { - val TEST_FILE_PATH by stringDirective( - description = "Specify that part of test file path must be replaced with EXPECTED_FILE_PATH" - ) - val EXPECTED_FILE_PATH by stringDirective( - description = "Specify the path to expected result file that will be inserted instead of TEST_FILE_PATH" - ) -} \ No newline at end of file diff --git a/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/fir/AbstractFirVisualizerTest.kt b/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/fir/AbstractFirVisualizerTest.kt deleted file mode 100644 index d67615dbcc8..00000000000 --- a/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/fir/AbstractFirVisualizerTest.kt +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2010-2019 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.visualizer.fir - -import org.jetbrains.kotlin.test.Constructor -import org.jetbrains.kotlin.test.frontend.fir.FirFrontendFacade -import org.jetbrains.kotlin.test.model.* -import org.jetbrains.kotlin.visualizer.AbstractVisualizerTest - -abstract class AbstractFirVisualizerTest : AbstractVisualizerTest() { - override val frontendKind: FrontendKind<*> = FrontendKinds.FIR - override val handler: Constructor> = ::FirOutputHandler -} diff --git a/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/fir/FirOutputHandler.kt b/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/fir/FirOutputHandler.kt deleted file mode 100644 index fdd262419a8..00000000000 --- a/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/fir/FirOutputHandler.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.visualizer.fir - -import org.jetbrains.kotlin.compiler.visualizer.FirVisualizer -import org.jetbrains.kotlin.test.frontend.fir.FirOutputArtifact -import org.jetbrains.kotlin.test.frontend.fir.handlers.FirAnalysisHandler -import org.jetbrains.kotlin.test.model.TestModule -import org.jetbrains.kotlin.test.services.TestServices -import org.jetbrains.kotlin.visualizer.VisualizerDirectives -import java.io.File - -internal class FirOutputHandler(testServices: TestServices) : FirAnalysisHandler(testServices) { - override fun processModule(module: TestModule, info: FirOutputArtifact) { - val renderer = info.mainFirFiles.values.firstOrNull()?.let { FirVisualizer(it) } ?: return - val firRenderResult = renderer.render().trim() - - val replaceFrom = module.directives[VisualizerDirectives.TEST_FILE_PATH].first() - val replaceTo = module.directives[VisualizerDirectives.EXPECTED_FILE_PATH].first() - val path = module.files.first().originalFile.absolutePath.replace(replaceFrom, replaceTo) - val expectedText = File(path).readLines() - if (expectedText[0].startsWith("// FIR_IGNORE")) { - assertions.assertFalse(expectedText.drop(1).joinToString("\n") == firRenderResult.trim()) { - "Files are identical, please delete ignore directive" - } - return - } - assertions.assertEqualsToFile(File(path), firRenderResult) { text -> - text.replace("// FIR_IGNORE\n", "") - } - } - - override fun processAfterAllModules(someAssertionWasFailed: Boolean) {} -} \ No newline at end of file diff --git a/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/psi/AbstractPsiVisualizerTest.kt b/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/psi/AbstractPsiVisualizerTest.kt deleted file mode 100644 index dad63fce431..00000000000 --- a/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/psi/AbstractPsiVisualizerTest.kt +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2010-2019 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.visualizer.psi - -import org.jetbrains.kotlin.test.Constructor -import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendFacade -import org.jetbrains.kotlin.test.model.* -import org.jetbrains.kotlin.visualizer.AbstractVisualizerTest - -abstract class AbstractPsiVisualizerTest : AbstractVisualizerTest() { - override val frontendKind: FrontendKind<*> = FrontendKinds.ClassicFrontend - override val handler: Constructor> = ::PsiOutputHandler -} diff --git a/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/psi/PsiOutputHandler.kt b/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/psi/PsiOutputHandler.kt deleted file mode 100644 index d3784d831a9..00000000000 --- a/compiler/visualizer/tests/org/jetbrains/kotlin/visualizer/psi/PsiOutputHandler.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.visualizer.psi - -import org.jetbrains.kotlin.compiler.visualizer.PsiVisualizer -import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendOutputArtifact -import org.jetbrains.kotlin.test.frontend.classic.handlers.ClassicFrontendAnalysisHandler -import org.jetbrains.kotlin.test.model.TestModule -import org.jetbrains.kotlin.test.services.TestServices -import org.jetbrains.kotlin.visualizer.VisualizerDirectives -import java.io.File - -internal class PsiOutputHandler(testServices: TestServices) : ClassicFrontendAnalysisHandler(testServices) { - override fun processModule(module: TestModule, info: ClassicFrontendOutputArtifact) { - val renderer = info.ktFiles.values.firstOrNull()?.let { PsiVisualizer(it, info.analysisResult) } ?: return - val psiRenderResult = renderer.render() - - val replaceFrom = module.directives[VisualizerDirectives.TEST_FILE_PATH].first() - val replaceTo = module.directives[VisualizerDirectives.EXPECTED_FILE_PATH].first() - val path = module.files.first().originalFile.absolutePath.replace(replaceFrom, replaceTo) - assertions.assertEqualsToFile(File(path), psiRenderResult) { text -> - text.replace("// FIR_IGNORE\n", "") - } - } - - override fun processAfterAllModules(someAssertionWasFailed: Boolean) {} -} \ No newline at end of file diff --git a/plugins/pill/generate-all-tests/build.gradle.kts b/plugins/pill/generate-all-tests/build.gradle.kts index e824ed5ba7d..b68e4da12f2 100644 --- a/plugins/pill/generate-all-tests/build.gradle.kts +++ b/plugins/pill/generate-all-tests/build.gradle.kts @@ -10,7 +10,6 @@ val depenencyProjects = arrayOf( ":compiler:test-infrastructure", ":compiler:tests-common-new", ":compiler:tests-for-compiler-generator", - ":compiler:visualizer", ":js:js.tests", ":compiler:tests-java8", ":core:descriptors.runtime",