diff --git a/.idea/runConfigurations/Generate_FIR_Checker_Components_and_FIR_IDE_Diagnostics.xml b/.idea/runConfigurations/Generate_FIR_Checker_Components_and_FIR_IDE_Diagnostics.xml
new file mode 100644
index 00000000000..a5d3f936568
--- /dev/null
+++ b/.idea/runConfigurations/Generate_FIR_Checker_Components_and_FIR_IDE_Diagnostics.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+ true
+ true
+ false
+
+
+
\ No newline at end of file
diff --git a/build-common/src/org/jetbrains/kotlin/incremental/IncrementalJvmCache.kt b/build-common/src/org/jetbrains/kotlin/incremental/IncrementalJvmCache.kt
index 84d75a417d6..73fd16ca986 100644
--- a/build-common/src/org/jetbrains/kotlin/incremental/IncrementalJvmCache.kt
+++ b/build-common/src/org/jetbrains/kotlin/incremental/IncrementalJvmCache.kt
@@ -94,6 +94,10 @@ open class IncrementalJvmCache(
fun sourcesByInternalName(internalName: String): Collection =
internalNameToSource[internalName]
+ fun getAllPartsOfMultifileFacade(facade: JvmClassName): Collection? {
+ return multifileFacadeToParts[facade]
+ }
+
fun isMultifileFacade(className: JvmClassName): Boolean =
className in multifileFacadeToParts
@@ -425,6 +429,8 @@ open class IncrementalJvmCache(
private inner class MultifileClassFacadeMap(storageFile: File) :
BasicStringMap>(storageFile, StringCollectionExternalizer) {
+
+ @Synchronized
operator fun set(className: JvmClassName, partNames: Collection) {
storage[className.internalName] = partNames
}
@@ -435,6 +441,7 @@ open class IncrementalJvmCache(
operator fun contains(className: JvmClassName): Boolean =
className.internalName in storage
+ @Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
@@ -444,6 +451,8 @@ open class IncrementalJvmCache(
private inner class MultifileClassPartMap(storageFile: File) :
BasicStringMap(storageFile, EnumeratorStringDescriptor.INSTANCE) {
+
+ @Synchronized
fun set(partName: String, facadeName: String) {
storage[partName] = facadeName
}
@@ -451,6 +460,7 @@ open class IncrementalJvmCache(
fun get(partName: JvmClassName): String? =
storage[partName.internalName]
+ @Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
diff --git a/build.gradle.kts b/build.gradle.kts
index d0c3fccb66e..88ef1820899 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -325,16 +325,8 @@ extra["tasksWithWarnings"] = listOf(
":kotlin-stdlib:compileTestKotlin",
":kotlin-stdlib-jdk7:compileTestKotlin",
":kotlin-stdlib-jdk8:compileTestKotlin",
- ":compiler:cli:compileKotlin",
- ":compiler:frontend:compileKotlin",
- ":compiler:fir:tree:compileKotlin",
- ":compiler:fir:resolve:compileKotlin",
- ":compiler:fir:checkers:compileKotlin",
- ":compiler:fir:java:compileKotlin",
- ":kotlin-scripting-compiler:compileKotlin",
":plugins:uast-kotlin:compileKotlin",
- ":plugins:uast-kotlin:compileTestKotlin",
- ":plugins:uast-kotlin-idea:compileKotlin"
+ ":plugins:uast-kotlin:compileTestKotlin"
)
val tasksWithWarnings: List by extra
@@ -773,6 +765,7 @@ tasks {
register("toolsTest") {
dependsOn(":tools:kotlinp:test")
dependsOn(":native:kotlin-klib-commonizer:test")
+ dependsOn(":native:kotlin-klib-commonizer-api:test")
}
register("examplesTest") {
@@ -952,6 +945,12 @@ tasks {
}
}
+ register("publishGradlePluginArtifacts") {
+ idePluginDependency {
+ dependsOnKotlinGradlePluginPublish()
+ }
+ }
+
register("publishIdeArtifacts") {
idePluginDependency {
dependsOn(
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts
index 3ec018187ed..0322a6a739d 100644
--- a/buildSrc/build.gradle.kts
+++ b/buildSrc/build.gradle.kts
@@ -128,8 +128,9 @@ java {
}
tasks.withType().configureEach {
- kotlinOptions.freeCompilerArgs +=
- listOf("-Xopt-in=kotlin.RequiresOptIn", "-Xskip-runtime-version-check")
+ kotlinOptions.freeCompilerArgs += listOf(
+ "-Xopt-in=kotlin.RequiresOptIn", "-Xskip-runtime-version-check", "-Xsuppress-version-warnings"
+ )
}
tasks["build"].dependsOn(":prepare-deps:build")
diff --git a/buildSrc/src/main/kotlin/tasks.kt b/buildSrc/src/main/kotlin/tasks.kt
index 58b37c62099..083970e0f04 100644
--- a/buildSrc/src/main/kotlin/tasks.kt
+++ b/buildSrc/src/main/kotlin/tasks.kt
@@ -20,41 +20,54 @@ import java.lang.Character.isUpperCase
import java.nio.file.Files
import java.nio.file.Path
-fun Task.dependsOnKotlinPluginInstall() {
- dependsOn(
- ":kotlin-allopen:install",
- ":kotlin-noarg:install",
- ":kotlin-sam-with-receiver:install",
- ":kotlin-android-extensions:install",
- ":kotlin-parcelize-compiler:install",
- ":kotlin-build-common:install",
- ":kotlin-compiler-embeddable:install",
- ":native:kotlin-native-utils:install",
- ":kotlin-util-klib:install",
- ":kotlin-util-io:install",
- ":kotlin-compiler-runner:install",
- ":kotlin-daemon-embeddable:install",
- ":kotlin-daemon-client:install",
- ":kotlin-gradle-plugin-api:install",
- ":kotlin-gradle-plugin:install",
- ":kotlin-gradle-plugin-model:install",
- ":kotlin-reflect:install",
- ":kotlin-annotation-processing-gradle:install",
- ":kotlin-test:install",
- ":kotlin-gradle-subplugin-example:install",
- ":kotlin-stdlib-common:install",
- ":kotlin-stdlib:install",
- ":kotlin-stdlib-jdk8:install",
- ":kotlin-stdlib-js:install",
- ":examples:annotation-processor-example:install",
- ":kotlin-script-runtime:install",
- ":kotlin-scripting-common:install",
- ":kotlin-scripting-jvm:install",
- ":kotlin-scripting-compiler-embeddable:install",
- ":kotlin-scripting-compiler-impl-embeddable:install",
- ":kotlin-test-js-runner:install",
- ":native:kotlin-klib-commonizer-embeddable:install"
- )
+val kotlinGradlePluginAndItsRequired = arrayOf(
+ ":kotlin-allopen",
+ ":kotlin-noarg",
+ ":kotlin-sam-with-receiver",
+ ":kotlin-android-extensions",
+ ":kotlin-parcelize-compiler",
+ ":kotlin-build-common",
+ ":kotlin-compiler-embeddable",
+ ":native:kotlin-native-utils",
+ ":kotlin-util-klib",
+ ":kotlin-util-io",
+ ":kotlin-compiler-runner",
+ ":kotlin-daemon-embeddable",
+ ":kotlin-daemon-client",
+ ":kotlin-gradle-plugin-api",
+ ":kotlin-gradle-plugin",
+ ":kotlin-gradle-plugin-model",
+ ":kotlin-reflect",
+ ":kotlin-annotation-processing-gradle",
+ ":kotlin-test",
+ ":kotlin-gradle-subplugin-example",
+ ":kotlin-stdlib-common",
+ ":kotlin-stdlib",
+ ":kotlin-stdlib-jdk8",
+ ":kotlin-stdlib-js",
+ ":examples:annotation-processor-example",
+ ":kotlin-script-runtime",
+ ":kotlin-scripting-common",
+ ":kotlin-scripting-jvm",
+ ":kotlin-scripting-compiler-embeddable",
+ ":kotlin-scripting-compiler-impl-embeddable",
+ ":kotlin-test-js-runner",
+ ":native:kotlin-klib-commonizer-embeddable",
+ ":native:kotlin-klib-commonizer-api"
+)
+
+fun Task.dependsOnKotlinGradlePluginInstall() {
+ kotlinGradlePluginAndItsRequired.forEach {
+ dependsOn("${it}:install")
+ }
+}
+
+fun Task.dependsOnKotlinGradlePluginPublish() {
+ kotlinGradlePluginAndItsRequired.forEach {
+ project.rootProject.tasks.findByPath("${it}:publish")?.let { task ->
+ dependsOn(task)
+ }
+ }
}
fun Project.projectTest(
diff --git a/compiler/android-tests/android-module/build.gradle b/compiler/android-tests/android-module/build.gradle
index 8536a0ca0b6..b5268a4822f 100644
--- a/compiler/android-tests/android-module/build.gradle
+++ b/compiler/android-tests/android-module/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:4.1.1'
+ classpath 'com.android.tools.build:gradle:4.1.2'
}
}
apply plugin: 'com.android.application'
@@ -37,14 +37,6 @@ android {
packagingOptions { exclude 'META-INF/build.txt' }
- //TODO run under java 6, cause there is error on implicit 'stream' import in 'asWithMutable' test
- lintOptions {
- abortOnError false
- }
-
- compileOptions {
- incremental = false
- }
dexOptions {
dexInProcess false
@@ -80,6 +72,22 @@ android {
reflect0 {
dimension "box"
}
+
+ common_ir0 {
+ dimension "box"
+ }
+
+ common_ir1 {
+ dimension "box"
+ }
+
+ common_ir2 {
+ dimension "box"
+ }
+
+ reflect_ir0 {
+ dimension "box"
+ }
}
}
diff --git a/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidJpsBuildTestCase.java b/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidJpsBuildTestCase.java
deleted file mode 100644
index 60d860a9909..00000000000
--- a/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidJpsBuildTestCase.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2010-2015 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jetbrains.kotlin.android.tests;
-
-import org.jetbrains.kotlin.jps.build.BaseKotlinJpsBuildTestCase;
-import org.junit.Ignore;
-
-import java.io.File;
-import java.io.IOException;
-
-@Ignore
-public class AndroidJpsBuildTestCase extends BaseKotlinJpsBuildTestCase {
- private static final String PROJECT_NAME = "android-module";
- private static final String SDK_NAME = "Android_SDK";
-
- private final File workDir = new File(AndroidRunner.getPathManager().getTmpFolder());
-
- public void doTest() {
- initProject();
- rebuildAllModules();
- buildAllModules().assertSuccessful();
- }
-
- @Override
- protected String getProjectName() {
- return "android-module";
- }
-
- @Override
- protected void runTest() {
- doTest();
- }
-
- @Override
- public String getName() {
- return "AndroidJpsTest";
- }
-
- @Override
- protected File doGetProjectDir() throws IOException {
- return workDir;
- }
-
- private void initProject() {
- addJdk(SDK_NAME, AndroidRunner.getPathManager().getPlatformFolderInAndroidSdk() + "/android.jar");
- loadProject(workDir.getAbsolutePath() + File.separator + PROJECT_NAME + ".ipr");
- }
-}
diff --git a/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidRunner.java b/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidRunner.java
index a95405af339..7e7772988fb 100644
--- a/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidRunner.java
+++ b/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidRunner.java
@@ -46,12 +46,8 @@ public class AndroidRunner {
CodegenTestsOnAndroidGenerator.generate(pathManager);
- System.out.println("Run tests on android...");
- TestSuite suite = CodegenTestsOnAndroidRunner.runTestsInEmulator(pathManager);
- //AndroidJpsBuildTestCase indirectly depends on UsefulTestCase which compiled against java 8
- //TODO: Need add separate run configuration for AndroidJpsBuildTestCase
- //suite.addTest(new AndroidJpsBuildTestCase());
- return suite;
+ System.out.println("Run tests on Android...");
+ return CodegenTestsOnAndroidRunner.runTestsInEmulator(pathManager);
}
public void tearDown() throws Exception {
diff --git a/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/CodegenTestsOnAndroidGenerator.kt b/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/CodegenTestsOnAndroidGenerator.kt
index 48b9c7d1d21..28053f61c0f 100644
--- a/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/CodegenTestsOnAndroidGenerator.kt
+++ b/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/CodegenTestsOnAndroidGenerator.kt
@@ -12,7 +12,6 @@ import com.intellij.openapi.util.io.FileUtilRt
import org.jetbrains.kotlin.cli.common.output.writeAllTo
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
-import org.jetbrains.kotlin.codegen.CodegenTestCase
import org.jetbrains.kotlin.codegen.CodegenTestFiles
import org.jetbrains.kotlin.codegen.GenerationUtils
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
@@ -22,8 +21,6 @@ import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.*
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
-import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives
-import org.jetbrains.kotlin.test.directives.model.singleOrZeroValue
import org.jetbrains.kotlin.test.model.DependencyKind
import org.jetbrains.kotlin.test.model.FrontendKinds
import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerTest
@@ -57,15 +54,18 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
//keep it globally to avoid test grouping on TC
private val generatedTestNames = hashSetOf()
- private val COMMON = FlavorConfig("common", 3)
- private val REFLECT = FlavorConfig("reflect", 1)
+ private val COMMON = FlavorConfig(TargetBackend.ANDROID,"common", 3)
+ private val REFLECT = FlavorConfig(TargetBackend.ANDROID, "reflect", 1)
- class FlavorConfig(private val prefix: String, val limit: Int) {
+ private val COMMON_IR = FlavorConfig(TargetBackend.ANDROID_IR, "common_ir", 3)
+ private val REFLECT_IR = FlavorConfig(TargetBackend.ANDROID_IR,"reflect_ir", 1)
+
+ class FlavorConfig(private val backend: TargetBackend, private val prefix: String, val limit: Int) {
private var writtenFilesCount = 0
fun printStatistics() {
- println("FlavorTestCompiler: $prefix, generated file count: $writtenFilesCount")
+ println("FlavorTestCompiler for $backend: $prefix, generated file count: $writtenFilesCount")
}
fun getFlavorForNewFiles(newFilesCount: Int): String {
@@ -148,25 +148,47 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
private fun generateTestsAndFlavourSuites() {
println("Generating test files...")
- generateTestMethodsForDirectories(File("compiler/testData/codegen/box"), File("compiler/testData/codegen/boxInline"))
+ val folders = arrayOf(
+ File("compiler/testData/codegen/box"),
+ File("compiler/testData/codegen/boxInline")
+ )
+
+ generateTestMethodsForDirectories(
+ TargetBackend.ANDROID,
+ COMMON,
+ REFLECT,
+ *folders
+ )
+
+ generateTestMethodsForDirectories(
+ TargetBackend.ANDROID_IR,
+ COMMON_IR,
+ REFLECT_IR,
+ *folders
+ )
pendingUnitTestGenerators.values.forEach { it.generate() }
}
- private fun generateTestMethodsForDirectories(vararg dirs: File) {
+ private fun generateTestMethodsForDirectories(
+ backend: TargetBackend,
+ commonFlavor: FlavorConfig,
+ reflectionFlavor: FlavorConfig,
+ vararg dirs: File
+ ) {
val holders = mutableMapOf()
for (dir in dirs) {
val files = dir.listFiles() ?: error("Folder with testData is empty: ${dir.absolutePath}")
- processFiles(files, holders)
+ processFiles(files, holders, backend, commonFlavor, reflectionFlavor)
}
holders.values.forEach {
it.writeFilesOnDisk()
}
- COMMON.printStatistics()
- REFLECT.printStatistics()
+ commonFlavor.printStatistics()
+ reflectionFlavor.printStatistics()
}
internal inner class FilesWriter(
@@ -254,7 +276,10 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
@Throws(IOException::class)
private fun processFiles(
files: Array,
- holders: MutableMap
+ holders: MutableMap,
+ backend: TargetBackend,
+ commmonFlavor: FlavorConfig,
+ reflectionFlavor: FlavorConfig
) {
holders.values.forEach {
it.writeFilesOnDiskIfNeeded()
@@ -264,7 +289,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
if (file.isDirectory) {
val listFiles = file.listFiles()
if (listFiles != null) {
- processFiles(listFiles, holders)
+ processFiles(listFiles, holders, backend, commmonFlavor, reflectionFlavor)
}
} else if (FileUtilRt.getExtension(file.name) != KotlinFileType.EXTENSION) {
// skip non kotlin files
@@ -273,7 +298,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
continue
}
- if (!InTextDirectivesUtils.isPassingTarget(TargetBackend.JVM, file) ||
+ if (!InTextDirectivesUtils.isPassingTarget(backend.compatibleWith, file) ||
InTextDirectivesUtils.isIgnoredTarget(TargetBackend.ANDROID, file)
) {
continue
@@ -304,7 +329,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
if (fullFileText.contains("// SKIP_JDK6")) continue
if (hasBoxMethod(fullFileText)) {
- val testConfiguration = createTestConfiguration(file)
+ val testConfiguration = createTestConfiguration(file, backend)
val services = testConfiguration.testServices
val moduleStructure = try {
@@ -335,7 +360,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
keyConfiguration.languageVersionSettings = module.languageVersionSettings
val key = ConfigurationKey(kind, jdkKind, keyConfiguration.toString())
- val compiler = if (kind.withReflection) REFLECT else COMMON
+ val compiler = if (kind.withReflection) reflectionFlavor else commmonFlavor
val compilerConfigurationProvider = services.compilerConfigurationProvider as CompilerConfigurationProviderImpl
val filesHolder = holders.getOrPut(key) {
FilesWriter(compiler, compilerConfigurationProvider.createCompilerConfiguration(module)).also {
@@ -349,9 +374,9 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
}
}
- private fun createTestConfiguration(testDataFile: File): TestConfiguration {
+ private fun createTestConfiguration(testDataFile: File, backend: TargetBackend): TestConfiguration {
return TestConfigurationBuilder().apply {
- testConfiguration()
+ configure(backend)
testInfo = KotlinTestInfo(
"org.jetbrains.kotlin.android.tests.AndroidRunner",
"test${testDataFile.nameWithoutExtension.capitalize()}",
@@ -360,10 +385,10 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
}.build(testDataFile.path)
}
- private val testConfiguration: TestConfigurationBuilder.() -> Unit = {
+ private fun TestConfigurationBuilder.configure(backend: TargetBackend) {
globalDefaults {
frontend = FrontendKinds.ClassicFrontend
- targetBackend = TargetBackend.ANDROID
+ targetBackend = backend
targetPlatform = JvmPlatforms.defaultJvmPlatform
dependencyKind = DependencyKind.Binary
}
@@ -386,9 +411,6 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
useDirectives(*AbstractKotlinCompilerTest.defaultDirectiveContainers.toTypedArray())
}
- private fun createTestFiles(file: File, expectedText: String): List =
- CodegenTestCase.createTestFilesFromFile(file, expectedText, false, TargetBackend.JVM)
-
companion object {
const val GRADLE_VERSION = "6.8.1" // update GRADLE_SHA_256 on change
const val GRADLE_SHA_256 = "fd591a34af7385730970399f473afabdb8b28d57fd97d6625c388d090039d6fd"
diff --git a/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/CodegenTestsOnAndroidRunner.kt b/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/CodegenTestsOnAndroidRunner.kt
index b435d38066d..14562eb8d51 100644
--- a/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/CodegenTestsOnAndroidRunner.kt
+++ b/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/CodegenTestsOnAndroidRunner.kt
@@ -71,15 +71,20 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
return rootSuite
}
- private fun processReport(suite: TestSuite, resultOutput: String) {
+ private fun processReport(rootSuite: TestSuite, resultOutput: String) {
val reportFolder = File(flavorFolder())
try {
val folders = reportFolder.listFiles()
assertTrue(folders != null && folders.isNotEmpty(), "No folders in ${reportFolder.path}")
+
folders.forEach {
assertTrue("${it.path} is not directory") { it.isDirectory }
+ val isIr = it.name.contains("_ir")
val testCases = parseSingleReportInFolder(it)
- testCases.forEach { aCase -> suite.addTest(aCase) }
+ testCases.forEach { aCase ->
+ if (isIr) aCase.name += "_ir"
+ rootSuite.addTest(aCase)
+ }
Assert.assertNotEquals("There is no test results in report", 0, testCases.size.toLong())
}
} catch (e: Throwable) {
@@ -87,10 +92,6 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
}
}
- private fun renameFlavorFolder() {
- val reportFolder = File(flavorFolder())
- reportFolder.renameTo(File(reportFolder.parentFile, reportFolder.name + "_d8"))
- }
private fun flavorFolder() = pathManager.tmpFolder + "/build/test/results/connected/flavors"
@@ -119,7 +120,7 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
private fun cleanAndBuildProject(gradleRunner: GradleRunner) {
gradleRunner.clean()
- gradleRunner.build()
+ gradleRunner.assembleAndroidTest()
}
@Throws(IOException::class, SAXException::class, ParserConfigurationException::class)
@@ -138,21 +139,14 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
return (0 until testCases.length).map { i ->
val item = testCases.item(i) as Element
- val failure = item.getElementsByTagName("failure")
+ val failure = item.getElementsByTagName("failure").takeIf { it.length != 0 }?.item(0)
val name = item.getAttribute("name")
- if (failure.length == 0) {
- object : TestCase(name) {
- @Throws(Throwable::class)
- override fun runTest() {
-
- }
- }
- } else {
- object : TestCase(name) {
- @Throws(Throwable::class)
- override fun runTest() {
- Assert.fail(failure.item(0).textContent)
+ object : TestCase(name) {
+ @Throws(Throwable::class)
+ override fun runTest() {
+ if (failure != null) {
+ Assert.fail(failure.textContent)
}
}
}
diff --git a/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/gradle/GradleRunner.java b/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/gradle/GradleRunner.java
index 268f923c5fa..e7739257418 100644
--- a/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/gradle/GradleRunner.java
+++ b/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/gradle/GradleRunner.java
@@ -45,9 +45,9 @@ public class GradleRunner {
OutputUtils.checkResult(result);
}
- public void build() {
+ public void assembleAndroidTest() {
System.out.println("Building gradle project...");
- GeneralCommandLine build = generateCommandLine("build");
+ GeneralCommandLine build = generateCommandLine("assembleAndroidTest");
build.addParameter("--stacktrace");
build.addParameter("--warn");
RunResult result = RunUtils.execute(build);
diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ArgumentGenerator.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/ArgumentGenerator.kt
index 63fd2f20488..57f8ae0e693 100644
--- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ArgumentGenerator.kt
+++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ArgumentGenerator.kt
@@ -20,11 +20,9 @@ import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
-import org.jetbrains.kotlin.load.java.descriptors.JavaCallableMemberDescriptor
import org.jetbrains.kotlin.resolve.calls.components.hasDefaultValue
import org.jetbrains.kotlin.resolve.calls.model.*
import org.jetbrains.kotlin.resolve.descriptorUtil.overriddenTreeUniqueAsSequence
-import org.jetbrains.kotlin.utils.DFS
import org.jetbrains.kotlin.utils.mapToIndex
class ArgumentAndDeclIndex(val arg: ResolvedValueArgument, val declIndex: Int)
@@ -70,12 +68,8 @@ abstract class ArgumentGenerator {
generateExpression(declIndex, argument)
}
is DefaultValueArgument -> {
- if (calleeDescriptor?.defaultValueFromJava(declIndex) == true) {
- generateDefaultJava(declIndex, argument)
- } else {
- defaultArgs.mark(declIndex)
- generateDefault(declIndex, argument)
- }
+ defaultArgs.mark(declIndex)
+ generateDefault(declIndex, argument)
}
is VarargValueArgument -> {
generateVararg(declIndex, argument)
@@ -103,10 +97,6 @@ abstract class ArgumentGenerator {
throw UnsupportedOperationException("Unsupported vararg value argument #$i: $argument")
}
- protected open fun generateDefaultJava(i: Int, argument: DefaultValueArgument) {
- throw UnsupportedOperationException("Unsupported default java argument #$i: $argument")
- }
-
protected open fun generateOther(i: Int, argument: ResolvedValueArgument) {
throw UnsupportedOperationException("Unsupported value argument #$i: $argument")
}
@@ -116,28 +106,6 @@ abstract class ArgumentGenerator {
}
}
-private fun CallableDescriptor.defaultValueFromJava(index: Int): Boolean = DFS.ifAny(
- listOf(this),
- { current -> current.original.overriddenDescriptors.map { it.original } },
- { descriptor ->
- descriptor.original.overriddenDescriptors.isEmpty() &&
- descriptor is JavaCallableMemberDescriptor &&
- descriptor.valueParameters[index].declaresDefaultValue()
- }
-)
-
-fun shouldInvokeDefaultArgumentsStub(resolvedCall: ResolvedCall<*>): Boolean {
- val descriptor = resolvedCall.resultingDescriptor
- val valueArgumentsByIndex = resolvedCall.valueArgumentsByIndex ?: return false
- for (index in valueArgumentsByIndex.indices) {
- val resolvedValueArgument = valueArgumentsByIndex[index]
- if (resolvedValueArgument is DefaultValueArgument && !descriptor.defaultValueFromJava(index)) {
- return true
- }
- }
- return false
-}
-
fun getFunctionWithDefaultArguments(functionDescriptor: FunctionDescriptor): FunctionDescriptor {
if (functionDescriptor.containingDeclaration !is ClassDescriptor) return functionDescriptor
if (functionDescriptor.overriddenDescriptors.isEmpty()) return functionDescriptor
@@ -155,4 +123,4 @@ fun getFunctionWithDefaultArguments(functionDescriptor: FunctionDescriptor): Fun
function.valueParameters.any { valueParameter -> valueParameter.hasDefaultValue() }
}
?: functionDescriptor
-}
\ No newline at end of file
+}
diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/CallBasedArgumentGenerator.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/CallBasedArgumentGenerator.kt
index c9918229723..2af03c53ab4 100644
--- a/compiler/backend/src/org/jetbrains/kotlin/codegen/CallBasedArgumentGenerator.kt
+++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/CallBasedArgumentGenerator.kt
@@ -72,12 +72,6 @@ class CallBasedArgumentGenerator(
callGenerator.putValueIfNeeded(getJvmKotlinType(i), lazyVararg, ValueKind.GENERAL_VARARG, i)
}
- override fun generateDefaultJava(i: Int, argument: DefaultValueArgument) {
- val argumentValue = valueParameters[i].findJavaDefaultArgumentValue(valueParameterTypes[i], codegen.typeMapper)
-
- callGenerator.putValueIfNeeded(getJvmKotlinType(i), argumentValue)
- }
-
override fun reorderArgumentsIfNeeded(args: List) {
callGenerator.reorderArgumentsIfNeeded(args, valueParameterTypes)
}
diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java
index 974f617c47d..cb23cd5c181 100644
--- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java
+++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java
@@ -74,7 +74,10 @@ import org.jetbrains.kotlin.resolve.constants.*;
import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluatorKt;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
import org.jetbrains.kotlin.resolve.inline.InlineUtil;
-import org.jetbrains.kotlin.resolve.jvm.*;
+import org.jetbrains.kotlin.resolve.jvm.AsmTypes;
+import org.jetbrains.kotlin.resolve.jvm.JvmBindingContextSlices;
+import org.jetbrains.kotlin.resolve.jvm.JvmConstantsKt;
+import org.jetbrains.kotlin.resolve.jvm.RuntimeAssertionInfo;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature;
@@ -2690,7 +2693,7 @@ public class ExpressionCodegen extends KtVisitor impleme
}
@NotNull
- Callable resolveToCallable(@NotNull FunctionDescriptor fd, boolean superCall, @NotNull ResolvedCall resolvedCall) {
+ Callable resolveToCallable(@NotNull FunctionDescriptor fd, boolean superCall, @NotNull ResolvedCall> resolvedCall) {
IntrinsicMethod intrinsic = state.getIntrinsics().getIntrinsic(fd);
if (intrinsic != null) {
return intrinsic.toCallable(fd, superCall, resolvedCall, this);
@@ -2698,7 +2701,8 @@ public class ExpressionCodegen extends KtVisitor impleme
fd = SamCodegenUtil.resolveSamAdapter(fd);
- if (ArgumentGeneratorKt.shouldInvokeDefaultArgumentsStub(resolvedCall)) {
+ List valueArguments = resolvedCall.getValueArgumentsByIndex();
+ if (valueArguments != null && valueArguments.stream().anyMatch(it -> it instanceof DefaultValueArgument)) {
// When we invoke a function with some arguments mapped as defaults,
// we later reroute this call to an overridden function in a base class that processes the default arguments.
// If the base class is generic, this overridden function can have a different Kotlin signature
diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java
index 5466c5c4d96..cb81bcabf03 100644
--- a/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java
+++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/FunctionCodegen.java
@@ -34,7 +34,7 @@ import org.jetbrains.kotlin.load.java.SpecialBuiltinMembers;
import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.*;
-import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
+import org.jetbrains.kotlin.resolve.annotations.ThrowUtilKt;
import org.jetbrains.kotlin.resolve.calls.util.UnderscoreUtilKt;
import org.jetbrains.kotlin.resolve.constants.ArrayValue;
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
@@ -1105,7 +1105,7 @@ public class FunctionCodegen {
return Collections.emptyList();
}
- AnnotationDescriptor annotation = function.getAnnotations().findAnnotation(AnnotationUtilKt.JVM_THROWS_ANNOTATION_FQ_NAME);
+ AnnotationDescriptor annotation = function.getAnnotations().findAnnotation(ThrowUtilKt.JVM_THROWS_ANNOTATION_FQ_NAME);
if (annotation == null) return Collections.emptyList();
Collection> values = annotation.getAllValueArguments().values();
diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ObjectSuperCallArgumentGenerator.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/ObjectSuperCallArgumentGenerator.kt
index 0b0f274db8a..165564ad61f 100644
--- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ObjectSuperCallArgumentGenerator.kt
+++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ObjectSuperCallArgumentGenerator.kt
@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.descriptors.ConstructorDescriptor
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
import org.jetbrains.kotlin.resolve.calls.model.*
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature
-import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
internal class ObjectSuperCallArgumentGenerator(
@@ -65,12 +64,6 @@ internal class ObjectSuperCallArgumentGenerator(
pushDefaultValueOnStack(type, iv)
}
- public override fun generateDefaultJava(i: Int, argument: DefaultValueArgument) {
- val type = parameters[i].asmType
- val value = superValueParameters[i].findJavaDefaultArgumentValue(type, typeMapper)
- value.put(type, iv)
- }
-
public override fun generateVararg(i: Int, argument: VarargValueArgument) {
generateSuperCallArgument(i)
}
diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/SamWrapperCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/SamWrapperCodegen.java
index 9c204d64ffb..afea19b7fe3 100644
--- a/compiler/backend/src/org/jetbrains/kotlin/codegen/SamWrapperCodegen.java
+++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/SamWrapperCodegen.java
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.codegen.context.CodegenContext;
import org.jetbrains.kotlin.codegen.context.FieldOwnerContext;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper;
+import org.jetbrains.kotlin.config.LanguageFeature;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.descriptors.impl.ClassDescriptorImpl;
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil;
@@ -79,7 +80,8 @@ public class SamWrapperCodegen {
this.samType = samType;
this.parentCodegen = parentCodegen;
visibility = isInsideInline ? ACC_PUBLIC : NO_FLAG_PACKAGE_PRIVATE;
- classFlags = visibility | ACC_FINAL | ACC_SUPER;
+ int synth = state.getLanguageVersionSettings().supportsFeature(LanguageFeature.SamWrapperClassesAreSynthetic) ? ACC_SYNTHETIC : 0;
+ classFlags = visibility | ACC_FINAL | ACC_SUPER | synth;
}
@NotNull
diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.kt
index 72a1f5ac118..5053ed02192 100644
--- a/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.kt
+++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.kt
@@ -5,18 +5,7 @@
package org.jetbrains.kotlin.codegen
-import org.jetbrains.kotlin.codegen.AsmUtil.unboxPrimitiveTypeOrNull
-import org.jetbrains.kotlin.codegen.StackValue.*
-import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
-import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
-import org.jetbrains.kotlin.load.java.Constant
-import org.jetbrains.kotlin.load.java.EnumEntry
-import org.jetbrains.kotlin.load.java.descriptors.NullDefaultValue
-import org.jetbrains.kotlin.load.java.descriptors.StringDefaultValue
-import org.jetbrains.kotlin.load.java.descriptors.getDefaultValueFromAnnotation
-import org.jetbrains.kotlin.load.java.lexicalCastFrom
import org.jetbrains.kotlin.types.KotlinType
-import org.jetbrains.kotlin.utils.DFS
import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
@@ -86,40 +75,3 @@ class FunctionCallStackValue(
resultKotlinType: KotlinType?,
lambda: (v: InstructionAdapter) -> Unit
) : OperationStackValue(resultType, resultKotlinType, lambda)
-
-fun ValueParameterDescriptor.findJavaDefaultArgumentValue(targetType: Type, typeMapper: KotlinTypeMapper): StackValue {
- val descriptorWithDefaultValue = DFS.dfs(
- listOf(this.original),
- { it.original.overriddenDescriptors.map(ValueParameterDescriptor::getOriginal) },
- object : DFS.AbstractNodeHandler() {
- var result: ValueParameterDescriptor? = null
-
- override fun beforeChildren(current: ValueParameterDescriptor?): Boolean {
- if (current?.declaresDefaultValue() == true && current.getDefaultValueFromAnnotation() != null) {
- result = current
- return false
- }
-
- return true
- }
-
- override fun result(): ValueParameterDescriptor? = result
- }
- ) ?: error("Should be at least one descriptor with default value: $this")
-
- val defaultValue = descriptorWithDefaultValue.getDefaultValueFromAnnotation()
- if (defaultValue is NullDefaultValue) {
- return constant(null, targetType)
- }
-
- val value = (defaultValue as StringDefaultValue).value
- val castResult = type.lexicalCastFrom(value) ?: error("Should be checked in frontend")
-
- return when (castResult) {
- is EnumEntry -> enumEntry(castResult.descriptor, typeMapper)
- is Constant -> {
- val unboxedType = unboxPrimitiveTypeOrNull(targetType) ?: targetType
- return coercion(constant(castResult.value, unboxedType), targetType, null)
- }
- }
-}
diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/AnonymousObjectTransformer.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/AnonymousObjectTransformer.kt
index c4a846e2db7..e1f3d2d917d 100644
--- a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/AnonymousObjectTransformer.kt
+++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/AnonymousObjectTransformer.kt
@@ -462,6 +462,29 @@ class AnonymousObjectTransformer(
val indexToFunctionalArgument = transformationInfo.functionalArguments
val capturedParams = HashSet()
+ // Possible cases where we need to add each lambda's captures separately:
+ //
+ // 1. Top-level object in an inline lambda that is *not* being inlined into another object. In this case, we
+ // have no choice but to add a separate field for each captured variable. `capturedLambdas` is either empty
+ // (already have the fields) or contains the parent lambda object (captures used to be read from it, but
+ // the object will be removed and its contents inlined).
+ //
+ // 2. Top-level object in a named inline function. Again, there's no option but to add separate fields.
+ // `capturedLambdas` contains all lambdas used by this object and nested objects.
+ //
+ // 3. Nested object, either in an inline lambda or an inline function. This case has two subcases:
+ // * The object's captures are passed as separate arguments (e.g. KT-28064 style object that used to be in a lambda);
+ // we *could* group them into `this$0` now, but choose not to. Lambdas are replaced by their captures to match.
+ // * The object's captures are already grouped into `this$0`; this includes captured lambda parameters (for objects in
+ // inline functions) and a reference to the outer object or lambda (for objects in lambdas), so `capturedLambdas` is
+ // empty anyway.
+ //
+ // The only remaining case is a top-level object inside a (crossinline) lambda that is inlined into another object.
+ // Then, the reference to the soon-to-be-removed lambda class containing the captures (and it exists, or else the object
+ // would not have needed regeneration in the first place) is simply replaced with a reference to the outer object, and
+ // that object will contain loose fields for everything we need to capture.
+ val topLevelInCrossinlineLambda = parentFieldRemapper is InlinedLambdaRemapper && !parentFieldRemapper.parent!!.isRoot
+
//load captured parameters and patch instruction list
// NB: there is also could be object fields
val toDelete = arrayListOf()
@@ -470,10 +493,12 @@ class AnonymousObjectTransformer(
val parameterAload = fieldNode.previous as VarInsnNode
val varIndex = parameterAload.`var`
val functionalArgument = indexToFunctionalArgument[varIndex]
- val newFieldName = if (isThis0(fieldName) && shouldRenameThis0(parentFieldRemapper, indexToFunctionalArgument.values))
- getNewFieldName(fieldName, true)
- else
- fieldName
+ // If an outer `this` is already captured by this object, rename it if any inline lambda will capture
+ // one of the same type, causing the code below to create a clash. Note that the values can be different.
+ // TODO: this is only really necessary if there will be a name *and* type clash.
+ val shouldRename = !topLevelInCrossinlineLambda && isThis0(fieldName) &&
+ indexToFunctionalArgument.values.any { it is LambdaInfo && it.capturedVars.any { it.fieldName == fieldName } }
+ val newFieldName = if (shouldRename) addUniqueField(fieldName + INLINE_FUN_THIS_0_SUFFIX) else fieldName
val info = capturedParamBuilder.addCapturedParam(
Type.getObjectType(transformationInfo.oldClassName), fieldName, newFieldName,
Type.getType(fieldNode.desc), functionalArgument is LambdaInfo, null
@@ -508,35 +533,17 @@ class AnonymousObjectTransformer(
//For all inlined lambdas add their captured parameters
//TODO: some of such parameters could be skipped - we should perform additional analysis
val allRecapturedParameters = ArrayList()
- if (parentFieldRemapper !is InlinedLambdaRemapper || parentFieldRemapper.parent!!.isRoot) {
- // Possible cases:
- //
- // 1. Top-level object in an inline lambda that is *not* being inlined into another object. In this case, we
- // have no choice but to add a separate field for each captured variable. `capturedLambdas` is either empty
- // (already have the fields) or contains the parent lambda object (captures used to be read from it, but
- // the object will be removed and its contents inlined).
- //
- // 2. Top-level object in a named inline function. Again, there's no option but to add separate fields.
- // `capturedLambdas` contains all lambdas used by this object and nested objects.
- //
- // 3. Nested object, either in an inline lambda or an inline function. This case has two subcases:
- // * The object's captures are passed as separate arguments (e.g. KT-28064 style object that used to be in a lambda);
- // we could group them into `this$0` now, but choose not to. Lambdas are replaced by their captures.
- // * The object's captures are already grouped into `this$0`; this includes captured lambda parameters (for objects in
- // inline functions) and a reference to the outer object or lambda (for objects in lambdas), so `capturedLambdas` is
- // empty and the choice doesn't matter.
- //
- val alreadyAdded = HashMap()
+ if (!topLevelInCrossinlineLambda) {
+ val capturedOuterThisTypes = mutableSetOf()
for (info in capturedLambdas) {
for (desc in info.capturedVars) {
- val key = desc.fieldName + "$$$" + desc.type.className
- val alreadyAddedParam = alreadyAdded[key]
-
- val recapturedParamInfo = capturedParamBuilder.addCapturedParam(
- desc,
- alreadyAddedParam?.newFieldName ?: getNewFieldName(desc.fieldName, false),
- alreadyAddedParam != null
- )
+ // Merge all outer `this` of the same type captured by inlined lambdas, since they have to be the same
+ // object. Outer `this` captured by the original object itself should have been renamed above,
+ // and can have a different value even if the same type is captured by a lambda.
+ val recapturedParamInfo = if (isThis0(desc.fieldName))
+ capturedParamBuilder.addCapturedParam(desc, desc.fieldName, !capturedOuterThisTypes.add(desc.type.className))
+ else
+ capturedParamBuilder.addCapturedParam(desc, addUniqueField(desc.fieldName + INLINE_TRANSFORMATION_SUFFIX), false)
if (info is ExpressionLambda && info.isCapturedSuspend(desc)) {
recapturedParamInfo.functionalArgument = NonInlineableArgumentForInlineableParameterCalledInSuspend
}
@@ -551,10 +558,6 @@ class AnonymousObjectTransformer(
allRecapturedParameters.add(desc)
constructorParamBuilder.addCapturedParam(recapturedParamInfo, recapturedParamInfo.newFieldName).remapValue = composed
-
- if (isThis0(desc.fieldName)) {
- alreadyAdded.put(key, recapturedParamInfo)
- }
}
}
} else if (capturedLambdas.isNotEmpty()) {
@@ -579,24 +582,6 @@ class AnonymousObjectTransformer(
return constructorAdditionalFakeParams
}
- private fun shouldRenameThis0(parentFieldRemapper: FieldRemapper, values: Collection): Boolean {
- return if (isFirstDeclSiteLambdaFieldRemapper(parentFieldRemapper)) {
- values.any { it is LambdaInfo && it.capturedVars.any { isThis0(it.fieldName) } }
- } else false
- }
-
- private fun getNewFieldName(oldName: String, originalField: Boolean): String {
- if (AsmUtil.CAPTURED_THIS_FIELD == oldName) {
- return if (!originalField) {
- oldName
- } else {
- //rename original 'this$0' in declaration site lambda (inside inline function) to use this$0 only for outer lambda/object access on call site
- addUniqueField(oldName + INLINE_FUN_THIS_0_SUFFIX)
- }
- }
- return addUniqueField(oldName + INLINE_TRANSFORMATION_SUFFIX)
- }
-
private fun addUniqueField(name: String): String {
val existNames = fieldNames.getOrPut(name) { LinkedList() }
val suffix = if (existNames.isEmpty()) "" else "$" + existNames.size
@@ -604,7 +589,4 @@ class AnonymousObjectTransformer(
existNames.add(newName)
return newName
}
-
- private fun isFirstDeclSiteLambdaFieldRemapper(parentRemapper: FieldRemapper): Boolean =
- parentRemapper !is RegeneratedLambdaFieldRemapper && parentRemapper !is InlinedLambdaRemapper
}
diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt
index 92239187b51..f24b29deb7a 100644
--- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt
+++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/GenerationState.kt
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicMethods
import org.jetbrains.kotlin.codegen.optimization.OptimizationClassBuilderFactory
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings
import org.jetbrains.kotlin.config.*
+import org.jetbrains.kotlin.config.LanguageVersion.*
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.descriptors.ScriptDescriptor
@@ -49,6 +50,7 @@ import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeApproximator
import org.jetbrains.org.objectweb.asm.Type
import java.io.File
+import java.util.*
class GenerationState private constructor(
val project: Project,
@@ -204,16 +206,20 @@ class GenerationState private constructor(
val target = configuration.get(JVMConfigurationKeys.JVM_TARGET) ?: JvmTarget.DEFAULT
val runtimeStringConcat =
if (target.majorVersion >= JvmTarget.JVM_9.majorVersion)
- configuration.get(JVMConfigurationKeys.STRING_CONCAT) ?: JvmStringConcat.INLINE
+ configuration.get(JVMConfigurationKeys.STRING_CONCAT) ?: JvmStringConcat.INDY_WITH_CONSTANTS
else JvmStringConcat.INLINE
val samConversionsScheme = run {
val fromConfig = configuration.get(JVMConfigurationKeys.SAM_CONVERSIONS)
- ?: JvmClosureGenerationScheme.DEFAULT
- if (target >= fromConfig.minJvmTarget)
+ if (fromConfig != null && target >= fromConfig.minJvmTarget)
fromConfig
- else
- JvmClosureGenerationScheme.DEFAULT
+ else {
+ // TODO wait for KT-44844 (properly support 'invokedynamic' in JPS incremental compilation)
+ // Use JvmClosureGenerationScheme.INDY if
+ // JVM target is at least JVM_1_8 &&
+ // SamWrapperClassesAreSynthetic language feature is supported
+ JvmClosureGenerationScheme.CLASS
+ }
}
val lambdasScheme = run {
@@ -316,8 +322,7 @@ class GenerationState private constructor(
val metadataVersion =
configuration.get(CommonConfigurationKeys.METADATA_VERSION)
- ?: if (languageVersionSettings.languageVersion >= LanguageVersion.LATEST_STABLE) JvmMetadataVersion.INSTANCE
- else JvmMetadataVersion(1, 1, 18)
+ ?: LANGUAGE_TO_METADATA_VERSION.getValue(languageVersionSettings.languageVersion)
val abiStability = configuration.get(JVMConfigurationKeys.ABI_STABILITY)
@@ -388,6 +393,24 @@ class GenerationState private constructor(
private fun shouldOnlyCollectSignatures(origin: JvmDeclarationOrigin) =
classBuilderMode == ClassBuilderMode.LIGHT_CLASSES && origin.originKind in doNotGenerateInLightClassMode
+
+ companion object {
+ private val LANGUAGE_TO_METADATA_VERSION = EnumMap(LanguageVersion::class.java).apply {
+ val oldMetadataVersion = JvmMetadataVersion(1, 1, 18)
+ this[KOTLIN_1_0] = oldMetadataVersion
+ this[KOTLIN_1_1] = oldMetadataVersion
+ this[KOTLIN_1_2] = oldMetadataVersion
+ this[KOTLIN_1_3] = oldMetadataVersion
+ this[KOTLIN_1_4] = JvmMetadataVersion(1, 4, 3)
+ this[KOTLIN_1_5] = JvmMetadataVersion.INSTANCE
+ this[KOTLIN_1_6] = JvmMetadataVersion(1, 6, 0)
+
+ check(size == LanguageVersion.values().size) {
+ "Please add mappings from the missing LanguageVersion instances to the corresponding JvmMetadataVersion " +
+ "in `GenerationState.LANGUAGE_TO_METADATA_VERSION`"
+ }
+ }
+ }
}
private val doNotGenerateInLightClassMode = setOf(CLASS_MEMBER_DELEGATION_TO_DEFAULT_IMPL, BRIDGE, COLLECTION_STUB, AUGMENTED_BUILTIN_API)
diff --git a/compiler/cli/build.gradle.kts b/compiler/cli/build.gradle.kts
index 536c89fc0f9..4b625d46d34 100644
--- a/compiler/cli/build.gradle.kts
+++ b/compiler/cli/build.gradle.kts
@@ -56,7 +56,9 @@ tasks.withType> {
kotlinOptions {
languageVersion = "1.3"
apiVersion = "1.3"
- freeCompilerArgs = freeCompilerArgs - "-progressive" + "-Xskip-prerelease-check"
+ freeCompilerArgs = freeCompilerArgs - "-progressive" + listOf(
+ "-Xskip-prerelease-check", "-Xsuppress-version-warnings"
+ )
}
}
diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/DeprecatedOption.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/DeprecatedOption.kt
new file mode 100644
index 00000000000..51a0b8ad15f
--- /dev/null
+++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/DeprecatedOption.kt
@@ -0,0 +1,13 @@
+/*
+ * 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.cli.common.arguments
+
+@Retention(AnnotationRetention.RUNTIME)
+annotation class DeprecatedOption(
+ val message: String = "This option has no effect and will be removed in a future release.",
+ val removeAfter: String,
+ val level: DeprecationLevel
+)
\ No newline at end of file
diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt
index 2841ed056df..e86f9447da9 100644
--- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt
+++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt
@@ -5,8 +5,7 @@
package org.jetbrains.kotlin.cli.common.arguments
-import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants.CALL
-import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants.NO_CALL
+import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants.*
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.config.ApiVersion
@@ -126,6 +125,13 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
@Argument(value = "-Xir-dce", description = "Perform experimental dead code elimination")
var irDce: Boolean by FreezableVar(false)
+ @Argument(
+ value = "-Xir-dce-runtime-diagnostic",
+ valueDescription = "{$DCE_RUNTIME_DIAGNOSTIC_LOG|$DCE_RUNTIME_DIAGNOSTIC_EXCEPTION}",
+ description = "Enable runtime diagnostics when performing DCE instead of removing declarations"
+ )
+ var irDceRuntimeDiagnostic: String? by NullableStringFreezableVar(null)
+
@Argument(value = "-Xir-dce-driven", description = "Perform a more experimental faster dead code elimination")
var irDceDriven: Boolean by FreezableVar(false)
diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt
index 9eb8a13aed3..b7c2ae9731e 100644
--- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt
+++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt
@@ -25,6 +25,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
description = "List of directories and JAR/ZIP archives to search for user class files")
var classpath: String? by NullableStringFreezableVar(null)
+ @DeprecatedOption(removeAfter = "1.5", level = DeprecationLevel.ERROR)
@GradleOption(DefaultValues.BooleanFalseDefault::class)
@Argument(value = "-include-runtime", description = "Include Kotlin runtime into the resulting JAR")
var includeRuntime: Boolean by FreezableVar(false)
@@ -41,10 +42,12 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
@Argument(value = "-no-jdk", description = "Don't automatically include the Java runtime into the classpath")
var noJdk: Boolean by FreezableVar(false)
+ @DeprecatedOption(removeAfter = "1.5", level = DeprecationLevel.ERROR)
@GradleOption(DefaultValues.BooleanTrueDefault::class)
@Argument(value = "-no-stdlib", description = "Don't automatically include the Kotlin/JVM stdlib and Kotlin reflection into the classpath")
var noStdlib: Boolean by FreezableVar(false)
+ @DeprecatedOption(removeAfter = "1.5", level = DeprecationLevel.ERROR)
@GradleOption(DefaultValues.BooleanTrueDefault::class)
@Argument(value = "-no-reflect", description = "Don't automatically include Kotlin reflection into the classpath")
var noReflect: Boolean by FreezableVar(false)
@@ -111,6 +114,14 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
)
var doNotClearBindingContext: Boolean by FreezableVar(false)
+ @Argument(
+ value = "-Xparallel-backend-threads",
+ description = "When using the IR backend, run lowerings by file in N parallel threads.\n" +
+ "0 means use a thread per processor core.\n" +
+ "Default value is 1"
+ )
+ var parallelBackendThreads: String by FreezableVar("1")
+
@Argument(value = "-Xmodule-path", valueDescription = "", description = "Paths where to find Java 9+ modules")
var javaModulePath: String? by NullableStringFreezableVar(null)
@@ -358,7 +369,9 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
description = """Select code generation scheme for string concatenation.
-Xstring-concat=indy-with-constants Concatenate strings using `invokedynamic` `makeConcatWithConstants`. Requires `-jvm-target 9` or greater.
-Xstring-concat=indy Concatenate strings using `invokedynamic` `makeConcat`. Requires `-jvm-target 9` or greater.
--Xstring-concat=inline Concatenate strings using `StringBuilder`"""
+-Xstring-concat=inline Concatenate strings using `StringBuilder`
+default: `indy-with-constants` for JVM target 9 or greater, `inline` otherwise"""
+
)
var stringConcat: String? by NullableStringFreezableVar(JvmStringConcat.INLINE.description)
diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JsArgumentConstants.java b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JsArgumentConstants.java
index ea9a7d45ddd..822423006d4 100644
--- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JsArgumentConstants.java
+++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JsArgumentConstants.java
@@ -28,4 +28,7 @@ public interface K2JsArgumentConstants {
String SOURCE_MAP_SOURCE_CONTENT_ALWAYS = "always";
String SOURCE_MAP_SOURCE_CONTENT_NEVER = "never";
String SOURCE_MAP_SOURCE_CONTENT_INLINING = "inlining";
+
+ String DCE_RUNTIME_DIAGNOSTIC_LOG = "log";
+ String DCE_RUNTIME_DIAGNOSTIC_EXCEPTION = "exception";
}
diff --git a/compiler/cli/cli-js-klib/src/GenerateJsIrKlib.kt b/compiler/cli/cli-js-klib/src/GenerateJsIrKlib.kt
index 44586cd43cc..6eedb3d3519 100644
--- a/compiler/cli/cli-js-klib/src/GenerateJsIrKlib.kt
+++ b/compiler/cli/cli-js-klib/src/GenerateJsIrKlib.kt
@@ -88,7 +88,7 @@ fun buildKLib(
configuration = configuration,
allDependencies = allDependencies,
friendDependencies = emptyList(),
- irFactory = PersistentIrFactory,
+ irFactory = PersistentIrFactory(), // TODO: IrFactoryImpl?
outputKlibPath = outputPath,
nopack = true
)
diff --git a/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt b/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt
index a359dc22cf1..47209787023 100644
--- a/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt
+++ b/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.cli.common.ExitCode.COMPILATION_ERROR
import org.jetbrains.kotlin.cli.common.ExitCode.OK
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants
+import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants.*
import org.jetbrains.kotlin.cli.common.config.addKotlinSourceRoot
import org.jetbrains.kotlin.cli.common.extensions.ScriptEvaluationExtension
import org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport
@@ -199,7 +200,7 @@ class K2JsIrCompiler : CLICompiler() {
configuration = config.configuration,
allDependencies = resolvedLibraries,
friendDependencies = friendDependencies,
- irFactory = PersistentIrFactory,
+ irFactory = PersistentIrFactory(), // TODO IrFactoryImpl?
outputKlibPath = outputFile.path,
nopack = arguments.irProduceKlibDir
)
@@ -259,12 +260,17 @@ class K2JsIrCompiler : CLICompiler() {
mainArguments = mainCallArguments,
generateFullJs = !arguments.irDce,
generateDceJs = arguments.irDce,
+ dceRuntimeDiagnostic = DceRuntimeDiagnostic.resolve(
+ arguments.irDceRuntimeDiagnostic,
+ messageCollector
+ ),
dceDriven = arguments.irDceDriven,
multiModule = arguments.irPerModule,
relativeRequirePath = true,
propertyLazyInitialization = arguments.irPropertyLazyInitialization,
)
+
val jsCode = if (arguments.irDce && !arguments.irDceDriven) compiledModule.dceJsCode!! else compiledModule.jsCode!!
outputFile.writeText(jsCode.mainModule)
jsCode.dependencies.forEach { (name, content) ->
@@ -422,6 +428,19 @@ class K2JsIrCompiler : CLICompiler() {
}
}
+fun DceRuntimeDiagnostic.Companion.resolve(
+ value: String?,
+ messageCollector: MessageCollector
+): DceRuntimeDiagnostic? = when (value?.toLowerCase()) {
+ DCE_RUNTIME_DIAGNOSTIC_LOG -> DceRuntimeDiagnostic.LOG
+ DCE_RUNTIME_DIAGNOSTIC_EXCEPTION -> DceRuntimeDiagnostic.EXCEPTION
+ null -> null
+ else -> {
+ messageCollector.report(STRONG_WARNING, "Unknown DCE runtime diagnostic '$value'")
+ null
+ }
+}
+
fun messageCollectorLogger(collector: MessageCollector) = object : Logger {
override fun warning(message: String) = collector.report(STRONG_WARNING, message)
override fun error(message: String) = collector.report(ERROR, message)
diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt
index 84ab300d7db..609b21a19bc 100644
--- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt
+++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt
@@ -291,6 +291,10 @@ fun CompilerConfiguration.configureAdvancedJvmOptions(arguments: K2JVMCompilerAr
}
arguments.declarationsOutputPath?.let { put(JVMConfigurationKeys.DECLARATIONS_JSON_PATH, it) }
+
+ val nThreadsRaw = arguments.parallelBackendThreads.toIntOrNull() ?: 1
+ val nThreads = if (nThreadsRaw == 0) Runtime.getRuntime().availableProcessors() else nThreadsRaw
+ put(CommonConfigurationKeys.PARALLEL_BACKEND_THREADS, nThreads)
}
fun CompilerConfiguration.configureKlibPaths(arguments: K2JVMCompilerArguments) {
diff --git a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmClosureGenerationScheme.kt b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmClosureGenerationScheme.kt
index 70d950979a5..2bc87eea62a 100644
--- a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmClosureGenerationScheme.kt
+++ b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JvmClosureGenerationScheme.kt
@@ -5,6 +5,8 @@
package org.jetbrains.kotlin.config
+import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
+
enum class JvmClosureGenerationScheme(
val description: String,
val minJvmTarget: JvmTarget
@@ -17,7 +19,9 @@ enum class JvmClosureGenerationScheme(
val DEFAULT = CLASS
@JvmStatic
- fun fromString(string: String?) =
- values().find { it.description == string }
+ fun fromString(string: String?): JvmClosureGenerationScheme? {
+ val lowerStr = string?.toLowerCaseAsciiOnly() ?: return null
+ return values().find { it.description == lowerStr }
+ }
}
}
\ No newline at end of file
diff --git a/compiler/config/src/org/jetbrains/kotlin/config/CommonConfigurationKeys.kt b/compiler/config/src/org/jetbrains/kotlin/config/CommonConfigurationKeys.kt
index a26f51a3eae..2f4518f87f5 100644
--- a/compiler/config/src/org/jetbrains/kotlin/config/CommonConfigurationKeys.kt
+++ b/compiler/config/src/org/jetbrains/kotlin/config/CommonConfigurationKeys.kt
@@ -50,6 +50,10 @@ object CommonConfigurationKeys {
@JvmField
val USE_FIR_EXTENDED_CHECKERS = CompilerConfigurationKey.create("fir extended checkers")
+
+ @JvmField
+ val PARALLEL_BACKEND_THREADS =
+ CompilerConfigurationKey.create("When using the IR backend, run lowerings by file in N parallel threads")
}
var CompilerConfiguration.languageVersionSettings: LanguageVersionSettings
diff --git a/compiler/container/src/org/jetbrains/kotlin/container/Dsl.kt b/compiler/container/src/org/jetbrains/kotlin/container/Dsl.kt
index 3f90482fdce..ab2015861d2 100644
--- a/compiler/container/src/org/jetbrains/kotlin/container/Dsl.kt
+++ b/compiler/container/src/org/jetbrains/kotlin/container/Dsl.kt
@@ -29,6 +29,10 @@ inline fun StorageComponentContainer.useImpl() {
registerSingleton(T::class.java)
}
+inline fun StorageComponentContainer.useImplIf(cond: Boolean) {
+ if (cond) useImpl()
+}
+
inline fun ComponentProvider.get(): T {
return getService(T::class.java)
}
diff --git a/compiler/daemon/daemon-client-new/build.gradle.kts b/compiler/daemon/daemon-client-new/build.gradle.kts
index c94462e9635..bf93f440a3d 100644
--- a/compiler/daemon/daemon-client-new/build.gradle.kts
+++ b/compiler/daemon/daemon-client-new/build.gradle.kts
@@ -50,6 +50,7 @@ dependencies {
tasks.withType> {
kotlinOptions {
apiVersion = "1.3"
+ freeCompilerArgs += "-Xsuppress-version-warnings"
}
}
diff --git a/compiler/daemon/daemon-client/build.gradle.kts b/compiler/daemon/daemon-client/build.gradle.kts
index 1be90e1a62d..20923bdfec7 100644
--- a/compiler/daemon/daemon-client/build.gradle.kts
+++ b/compiler/daemon/daemon-client/build.gradle.kts
@@ -42,6 +42,7 @@ tasks.withType> {
kotlinOptions {
// This module is being run from within Gradle, older versions of which only have kotlin-stdlib 1.3 in the runtime classpath.
apiVersion = "1.3"
+ freeCompilerArgs += "-Xsuppress-version-warnings"
}
}
diff --git a/compiler/daemon/daemon-client/src/org/jetbrains/kotlin/daemon/client/KotlinCompilerClient.kt b/compiler/daemon/daemon-client/src/org/jetbrains/kotlin/daemon/client/KotlinCompilerClient.kt
index e45d6fb20aa..4ba36cd27fd 100644
--- a/compiler/daemon/daemon-client/src/org/jetbrains/kotlin/daemon/client/KotlinCompilerClient.kt
+++ b/compiler/daemon/daemon-client/src/org/jetbrains/kotlin/daemon/client/KotlinCompilerClient.kt
@@ -376,7 +376,7 @@ object KotlinCompilerClient {
"-D$JAVA_RMI_SERVER_HOSTNAME=$serverHostname")
val javaVersion = System.getProperty("java.specification.version")?.toIntOrNull()
val javaIllegalAccessWorkaround =
- if (javaVersion != null && javaVersion >= 17)
+ if (javaVersion != null && javaVersion >= 16)
listOf("--illegal-access=permit")
else emptyList()
val args = listOf(
diff --git a/compiler/fir/analysis-tests/legacy-fir-tests/tests-gen/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java b/compiler/fir/analysis-tests/legacy-fir-tests/tests-gen/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java
index 084912af263..20c20e84b29 100644
--- a/compiler/fir/analysis-tests/legacy-fir-tests/tests-gen/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java
+++ b/compiler/fir/analysis-tests/legacy-fir-tests/tests-gen/org/jetbrains/kotlin/fir/LazyBodyIsNotTouchedTilContractsPhaseTestGenerated.java
@@ -715,6 +715,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/invokeWithReceiverAndArgument.kt");
}
+ @TestMetadata("kt37056.kt")
+ public void testKt37056() throws Exception {
+ runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/kt37056.kt");
+ }
+
@TestMetadata("lambdaAsReceiver.kt")
public void testLambdaAsReceiver() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/lambdaAsReceiver.kt");
@@ -2885,6 +2890,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToNothing.kt");
}
+ @TestMetadata("smartcastToTypeParameter.kt")
+ public void testSmartcastToTypeParameter() throws Exception {
+ runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToTypeParameter.kt");
+ }
+
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -2944,6 +2954,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
public void testFunctionCallBound() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/functionCallBound.kt");
}
+
+ @TestMetadata("thisAssignment.kt")
+ public void testThisAssignment() throws Exception {
+ runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/thisAssignment.kt");
+ }
}
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures")
@@ -3251,6 +3266,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
public void testCapturedParametersOfInnerClasses() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/types/capturedParametersOfInnerClasses.kt");
}
+
+ @TestMetadata("castToBareType.kt")
+ public void testCastToBareType() throws Exception {
+ runTest("compiler/fir/analysis-tests/testData/resolve/types/castToBareType.kt");
+ }
}
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/visibility")
diff --git a/compiler/fir/analysis-tests/legacy-fir-tests/tests-gen/org/jetbrains/kotlin/fir/java/FirTypeEnhancementTestGenerated.java b/compiler/fir/analysis-tests/legacy-fir-tests/tests-gen/org/jetbrains/kotlin/fir/java/FirTypeEnhancementTestGenerated.java
index 8ac45866e5d..06314da3ae8 100644
--- a/compiler/fir/analysis-tests/legacy-fir-tests/tests-gen/org/jetbrains/kotlin/fir/java/FirTypeEnhancementTestGenerated.java
+++ b/compiler/fir/analysis-tests/legacy-fir-tests/tests-gen/org/jetbrains/kotlin/fir/java/FirTypeEnhancementTestGenerated.java
@@ -1484,24 +1484,6 @@ public class FirTypeEnhancementTestGenerated extends AbstractFirTypeEnhancementT
}
}
- @TestMetadata("compiler/testData/loadJava/compiledJava/signatureAnnotations")
- @TestDataPath("$PROJECT_ROOT")
- @RunWith(JUnit3RunnerWithInners.class)
- public static class SignatureAnnotations extends AbstractFirTypeEnhancementTest {
- private void runTest(String testDataFilePath) throws Exception {
- KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
- }
-
- public void testAllFilesPresentInSignatureAnnotations() throws Exception {
- KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/loadJava/compiledJava/signatureAnnotations"), Pattern.compile("^(.+)\\.java$"), null, true);
- }
-
- @TestMetadata("StableName.java")
- public void testStableName() throws Exception {
- runTest("compiler/testData/loadJava/compiledJava/signatureAnnotations/StableName.java");
- }
- }
-
@TestMetadata("compiler/testData/loadJava/compiledJava/signaturePropagation")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
diff --git a/compiler/fir/analysis-tests/legacy-fir-tests/tests-gen/org/jetbrains/kotlin/fir/java/OwnFirTypeEnhancementTestGenerated.java b/compiler/fir/analysis-tests/legacy-fir-tests/tests-gen/org/jetbrains/kotlin/fir/java/OwnFirTypeEnhancementTestGenerated.java
index 7c77d5c6f3c..c34e48d0992 100644
--- a/compiler/fir/analysis-tests/legacy-fir-tests/tests-gen/org/jetbrains/kotlin/fir/java/OwnFirTypeEnhancementTestGenerated.java
+++ b/compiler/fir/analysis-tests/legacy-fir-tests/tests-gen/org/jetbrains/kotlin/fir/java/OwnFirTypeEnhancementTestGenerated.java
@@ -132,67 +132,4 @@ public class OwnFirTypeEnhancementTestGenerated extends AbstractOwnFirTypeEnhanc
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/enhancement/mapping"), Pattern.compile("^(.+)\\.java$"), null, true);
}
}
-
- @TestMetadata("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations")
- @TestDataPath("$PROJECT_ROOT")
- @RunWith(JUnit3RunnerWithInners.class)
- public static class SignatureAnnotations extends AbstractOwnFirTypeEnhancementTest {
- private void runTest(String testDataFilePath) throws Exception {
- KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
- }
-
- public void testAllFilesPresentInSignatureAnnotations() throws Exception {
- KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations"), Pattern.compile("^(.+)\\.java$"), null, true);
- }
-
- @TestMetadata("DefaultEnum.java")
- public void testDefaultEnum() throws Exception {
- runTest("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultEnum.java");
- }
-
- @TestMetadata("DefaultLongLiteral.java")
- public void testDefaultLongLiteral() throws Exception {
- runTest("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultLongLiteral.java");
- }
-
- @TestMetadata("DefaultNull.java")
- public void testDefaultNull() throws Exception {
- runTest("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultNull.java");
- }
-
- @TestMetadata("DefaultNullAndParameter.java")
- public void testDefaultNullAndParameter() throws Exception {
- runTest("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultNullAndParameter.java");
- }
-
- @TestMetadata("DefaultParameter.java")
- public void testDefaultParameter() throws Exception {
- runTest("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultParameter.java");
- }
-
- @TestMetadata("EmptyParameterName.java")
- public void testEmptyParameterName() throws Exception {
- runTest("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/EmptyParameterName.java");
- }
-
- @TestMetadata("ReorderedParameterNames.java")
- public void testReorderedParameterNames() throws Exception {
- runTest("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/ReorderedParameterNames.java");
- }
-
- @TestMetadata("SameParameterName.java")
- public void testSameParameterName() throws Exception {
- runTest("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/SameParameterName.java");
- }
-
- @TestMetadata("SpecialCharsParameterName.java")
- public void testSpecialCharsParameterName() throws Exception {
- runTest("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/SpecialCharsParameterName.java");
- }
-
- @TestMetadata("StaticMethodWithDefaultValue.java")
- public void testStaticMethodWithDefaultValue() throws Exception {
- runTest("compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/StaticMethodWithDefaultValue.java");
- }
- }
}
diff --git a/compiler/fir/analysis-tests/legacy-fir-tests/tests/org/jetbrains/kotlin/fir/java/AbstractFirTypeEnhancementTest.kt b/compiler/fir/analysis-tests/legacy-fir-tests/tests/org/jetbrains/kotlin/fir/java/AbstractFirTypeEnhancementTest.kt
index cc082c6569b..de67356c912 100644
--- a/compiler/fir/analysis-tests/legacy-fir-tests/tests/org/jetbrains/kotlin/fir/java/AbstractFirTypeEnhancementTest.kt
+++ b/compiler/fir/analysis-tests/legacy-fir-tests/tests/org/jetbrains/kotlin/fir/java/AbstractFirTypeEnhancementTest.kt
@@ -65,9 +65,6 @@ abstract class AbstractFirTypeEnhancementTest : KtUsefulTestCase() {
private fun createEnvironment(content: String): KotlinCoreEnvironment {
val classpath = mutableListOf(getAnnotationsJar(), ForTestCompileRuntime.runtimeJarForTests())
- if (InTextDirectivesUtils.isDirectiveDefined(content, "ANDROID_ANNOTATIONS")) {
- classpath.add(ForTestCompileRuntime.androidAnnotationsForTests())
- }
if (InTextDirectivesUtils.isDirectiveDefined(content, "JVM_ANNOTATIONS")) {
classpath.add(ForTestCompileRuntime.jvmAnnotationsForTests())
}
diff --git a/compiler/fir/analysis-tests/testData/enhancement/note.txt b/compiler/fir/analysis-tests/testData/enhancement/note.txt
index 13a9f30bf4d..9df530d4da2 100644
--- a/compiler/fir/analysis-tests/testData/enhancement/note.txt
+++ b/compiler/fir/analysis-tests/testData/enhancement/note.txt
@@ -1 +1 @@
-Most FIR enhancement tests use compiler/testData/loadJava/compilerJava
\ No newline at end of file
+Most FIR enhancement tests use compiler/testData/loadJava/compiledJava
diff --git a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultEnum.fir.txt b/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultEnum.fir.txt
deleted file mode 100644
index 330f35301ef..00000000000
--- a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultEnum.fir.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-public/*package*/ open class A : R|kotlin/Any| {
- public open fun a(@R|kotlin/annotations/jvm/internal/DefaultValue|(String(HELLO)) arg: R|ft<@FlexibleNullability Signs, Signs?>!| = R|/Signs.HELLO|): R|ft<@FlexibleNullability Signs, Signs?>!|
-
- public open fun bar(@R|kotlin/annotations/jvm/internal/DefaultValue|(String(X)) arg: R|ft<@FlexibleNullability Signs, Signs?>!| = R|/Signs.X|): R|ft<@FlexibleNullability Signs, Signs?>!|
-
- public open fun baz(@R|kotlin/annotations/jvm/internal/DefaultValue|(String(NOT_ENTRY_EITHER)) arg: R|ft<@FlexibleNullability Signs, Signs?>!|): R|ft<@FlexibleNullability Signs, Signs?>!|
-
- public open fun bam(@R|kotlin/annotations/jvm/internal/DefaultValue|(String(NOT_ENTRY_EITHER)) arg: R|ft<@FlexibleNullability Mixed, Mixed?>!| = R|/Mixed.NOT_ENTRY_EITHER|): R|ft<@FlexibleNullability Mixed, Mixed?>!|
-
- public/*package*/ constructor(): R|A|
-
-}
-public final enum class Mixed : R|kotlin/Enum!>| {
- public final static enum entry NOT_ENTRY_EITHER: R|@FlexibleNullability Mixed|
- public final static fun values(): R|kotlin/Array| {
- }
-
- public final static fun valueOf(value: R|kotlin/String|): R|Mixed| {
- }
-
-}
-public final enum class Signs : R|kotlin/Enum!>| {
- public final static enum entry HELLO: R|@FlexibleNullability Signs|
- public final static enum entry WORLD: R|@FlexibleNullability Signs|
- public final static field X: R|ft<@FlexibleNullability Signs, Signs?>!|
-
- public final static fun values(): R|kotlin/Array| {
- }
-
- public final static fun valueOf(value: R|kotlin/String|): R|Signs| {
- }
-
-}
diff --git a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultEnum.java b/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultEnum.java
deleted file mode 100644
index b8fbb6fb186..00000000000
--- a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultEnum.java
+++ /dev/null
@@ -1,39 +0,0 @@
-// FILE: Signs.java
-// ANDROID_ANNOTATIONS
-
-public enum Signs {
- HELLO,
- WORLD;
-
- public static final Signs X;
- public static final class NOT_ENTRY_EITHER {}
-}
-
-// FILE: Mixed.java
-public enum Mixed {
- NOT_ENTRY_EITHER;
-
- public static final class NOT_ENTRY_EITHER {}
-}
-
-// FILE: A.java
-import kotlin.annotations.jvm.internal.*;
-
-class A {
- public Signs a(@DefaultValue("HELLO") Signs arg) {
- return arg;
- }
-
- public Signs bar(@DefaultValue("X") Signs arg) {
- return arg;
- }
-
- public Signs baz(@DefaultValue("NOT_ENTRY_EITHER") Signs arg) {
- return arg;
- }
-
- public Mixed bam(@DefaultValue("NOT_ENTRY_EITHER") Mixed arg) {
- return arg;
- }
-
-}
diff --git a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultLongLiteral.fir.txt b/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultLongLiteral.fir.txt
deleted file mode 100644
index c1955e3f730..00000000000
--- a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultLongLiteral.fir.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-public open class A : R|kotlin/Any| {
- public open fun first(@R|kotlin/annotations/jvm/internal/DefaultValue|(String(0x1F)) value: R|ft<@FlexibleNullability kotlin/Long, kotlin/Long?>!| = Long(31)): R|kotlin/Unit|
-
- public open fun second(@R|kotlin/annotations/jvm/internal/DefaultValue|(String(0X1F)) value: R|ft<@FlexibleNullability kotlin/Long, kotlin/Long?>!| = Long(31)): R|kotlin/Unit|
-
- public open fun third(@R|kotlin/annotations/jvm/internal/DefaultValue|(String(0b1010)) value: R|ft<@FlexibleNullability kotlin/Long, kotlin/Long?>!| = Long(10)): R|kotlin/Unit|
-
- public open fun fourth(@R|kotlin/annotations/jvm/internal/DefaultValue|(String(0B1010)) value: R|ft<@FlexibleNullability kotlin/Long, kotlin/Long?>!| = Long(10)): R|kotlin/Unit|
-
- public constructor(): R|A|
-
-}
-public open class B : R|kotlin/Any| {
- public open fun first(@R|kotlin/annotations/jvm/internal/DefaultValue|(String(0x)) value: R|ft<@FlexibleNullability kotlin/Long, kotlin/Long?>!|): R|kotlin/Unit|
-
- public open fun second(@R|kotlin/annotations/jvm/internal/DefaultValue|(String(0xZZ)) value: R|ft<@FlexibleNullability kotlin/Long, kotlin/Long?>!|): R|kotlin/Unit|
-
- public open fun third(@R|kotlin/annotations/jvm/internal/DefaultValue|(String(0b)) value: R|ft<@FlexibleNullability kotlin/Long, kotlin/Long?>!|): R|kotlin/Unit|
-
- public open fun fourth(@R|kotlin/annotations/jvm/internal/DefaultValue|(String(0B1234)) value: R|ft<@FlexibleNullability kotlin/Long, kotlin/Long?>!|): R|kotlin/Unit|
-
- public constructor(): R|B|
-
-}
diff --git a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultLongLiteral.java b/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultLongLiteral.java
deleted file mode 100644
index 3e1c6e89950..00000000000
--- a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultLongLiteral.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// FILE: A.java
-// ANDROID_ANNOTATIONS
-
-import kotlin.annotations.jvm.internal.*;
-
-public class A {
- public void first(@DefaultValue("0x1F") Long value) {
- }
-
- public void second(@DefaultValue("0X1F") Long value) {
- }
-
- public void third(@DefaultValue("0b1010") Long value) {
- }
-
- public void fourth(@DefaultValue("0B1010") Long value) {
- }
-}
-
-// FILE: B.java
-import kotlin.annotations.jvm.internal.*;
-
-public class B {
- public void first(@DefaultValue("0x") Long value) {
- }
-
- public void second(@DefaultValue("0xZZ") Long value) {
- }
-
- public void third(@DefaultValue("0b") Long value) {
- }
-
- public void fourth(@DefaultValue("0B1234") Long value) {
- }
-}
-
diff --git a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultNull.fir.txt b/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultNull.fir.txt
deleted file mode 100644
index dabe74a9ee5..00000000000
--- a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultNull.fir.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-public open class A : R|kotlin/Any| {
- public open fun foo(@R|kotlin/annotations/jvm/internal/DefaultNull|() x: R|ft<@FlexibleNullability kotlin/Int, kotlin/Int?>!| = Null(null)): R|kotlin/Unit|
-
- public open fun bar(@R|kotlin/annotations/jvm/internal/DefaultNull|() x: R|kotlin/Int| = Null(null)): R|kotlin/Unit|
-
- public constructor(): R|A|
-
-}
-public open class B!|> : R|kotlin/Any| {
- public open fun foo(@R|kotlin/annotations/jvm/internal/DefaultNull|() t: R|ft<@FlexibleNullability T, T?>!| = Null(null)): R|kotlin/Unit|
-
- public constructor!|>(): R|B|
-
-}
diff --git a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultNull.java b/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultNull.java
deleted file mode 100644
index d3f0372f4cc..00000000000
--- a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultNull.java
+++ /dev/null
@@ -1,17 +0,0 @@
-// FILE: A.java
-// ANDROID_ANNOTATIONS
-
-import kotlin.annotations.jvm.internal.*;
-
-public class A {
- public void foo(@DefaultNull Integer x) {}
- public void bar(@DefaultNull int x) {}
-}
-
-// FILE: B.java
-import kotlin.annotations.jvm.internal.*;
-
-public class B {
- public void foo(@DefaultNull T t) { }
-}
-
diff --git a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultNullAndParameter.fir.txt b/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultNullAndParameter.fir.txt
deleted file mode 100644
index e9f356b4f8c..00000000000
--- a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultNullAndParameter.fir.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-public open class A : R|kotlin/Any| {
- public open fun foo(@R|kotlin/annotations/jvm/internal/DefaultNull|() i: R|ft<@FlexibleNullability kotlin/Int, kotlin/Int?>!| = Null(null)): R|kotlin/Unit|
-
- public open fun bar(@R|kotlin/annotations/jvm/internal/DefaultNull|() a: R|ft<@FlexibleNullability kotlin/Int, kotlin/Int?>!| = Null(null)): R|kotlin/Unit|
-
- public open fun bam(@R|kotlin/annotations/jvm/internal/DefaultNull|() a: R|ft<@FlexibleNullability kotlin/Int, kotlin/Int?>!| = Null(null)): R|kotlin/Unit|
-
- public open fun baz(@R|kotlin/annotations/jvm/internal/DefaultValue|(String(42)) a: R|ft<@FlexibleNullability kotlin/Int, kotlin/Int?>!| = Int(42)): R|kotlin/Unit|
-
- public constructor(): R|A|
-
-}
-public abstract interface AInt : R|kotlin/Any| {
- public abstract fun foo(@R|kotlin/annotations/jvm/internal/DefaultValue|(String(42)) i: R|ft<@FlexibleNullability kotlin/Int, kotlin/Int?>!| = Int(42)): R|kotlin/Unit|
-
- public abstract fun bar(@R|kotlin/annotations/jvm/internal/DefaultNull|() a: R|ft<@FlexibleNullability kotlin/Int, kotlin/Int?>!| = Null(null)): R|kotlin/Unit|
-
-}
-public open class B : R|A| {
- public open fun foo(i: R|ft<@FlexibleNullability kotlin/Int, kotlin/Int?>!|): R|kotlin/Unit|
-
- public open fun bar(@R|kotlin/annotations/jvm/internal/DefaultValue|(String(42)) a: R|ft<@FlexibleNullability kotlin/Int, kotlin/Int?>!| = Int(42)): R|kotlin/Unit|
-
- public open fun bam(@R|kotlin/annotations/jvm/internal/DefaultNull|() @R|kotlin/annotations/jvm/internal/DefaultValue|(String(42)) a: R|ft<@FlexibleNullability kotlin/Int, kotlin/Int?>!| = Int(42)): R|kotlin/Unit|
-
- public constructor(): R|B|
-
-}
-public open class C : R|A|, R|AInt| {
- public constructor(): R|C|
-
-}
diff --git a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultNullAndParameter.java b/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultNullAndParameter.java
deleted file mode 100644
index c80e59df91b..00000000000
--- a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultNullAndParameter.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// FILE: A.java
-// ANDROID_ANNOTATIONS
-
-import kotlin.annotations.jvm.internal.*;
-
-public class A {
- public void foo(@DefaultNull Integer i) {}
-
- public void bar(@DefaultNull Integer a) {}
-
- public void bam(@DefaultNull Integer a) {}
-
- public void baz(@DefaultValue("42") Integer a) {}
-}
-
-// FILE: AInt.java
-import kotlin.annotations.jvm.internal.*;
-
-public interface AInt {
- public void foo(@DefaultValue("42") Integer i) {}
- public void bar(@DefaultNull Integer a) {}
-}
-
-// FILE: B.java
-import kotlin.annotations.jvm.internal.*;
-
-public class B extends A {
- public void foo(Integer i) {}
-
- public void bar(@DefaultValue("42") Integer a) {}
-
- public void bam(@DefaultNull @DefaultValue("42") Integer a) {}
-}
-
-// FILE: C.java
-public class C extends A implements AInt {
-}
-
diff --git a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultParameter.fir.txt b/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultParameter.fir.txt
deleted file mode 100644
index f7075d724e5..00000000000
--- a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultParameter.fir.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-public/*package*/ open class A : R|kotlin/Any| {
- public open fun first(@R|kotlin/annotations/jvm/internal/DefaultValue|(String(hello)) value: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!| = String(hello)): R|kotlin/Unit|
-
- public open fun second(@R|kotlin/annotations/jvm/internal/DefaultValue|(String(first)) a: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!| = String(first), @R|kotlin/annotations/jvm/internal/DefaultValue|(String(second)) b: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!| = String(second)): R|kotlin/Unit|
-
- public open fun third(@R|kotlin/annotations/jvm/internal/DefaultValue|(String(first)) a: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!| = String(first), b: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|): R|kotlin/Unit|
-
- public open fun fourth(first: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|, @R|kotlin/annotations/jvm/internal/DefaultValue|(String(second)) second: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!| = String(second)): R|kotlin/Unit|
-
- public open fun wrong(@R|kotlin/annotations/jvm/internal/DefaultValue|(String(hello)) i: R|ft<@FlexibleNullability kotlin/Int, kotlin/Int?>!|): R|kotlin/Unit|
-
- public/*package*/ constructor(): R|A|
-
-}
diff --git a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultParameter.java b/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultParameter.java
deleted file mode 100644
index 2e92dd18d6b..00000000000
--- a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/DefaultParameter.java
+++ /dev/null
@@ -1,23 +0,0 @@
-// FILE: A.java
-// ANDROID_ANNOTATIONS
-
-import kotlin.annotations.jvm.internal.*;
-
-class A {
- public void first(@DefaultValue("hello") String value) {
- }
-
- public void second(@DefaultValue("first") String a, @DefaultValue("second") String b) {
- }
-
- public void third(@DefaultValue("first") String a, String b) {
- }
-
- public void fourth(String first, @DefaultValue("second") String second) {
- }
-
- public void wrong(@DefaultValue("hello") Integer i) {
- }
-}
-
-
diff --git a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/EmptyParameterName.fir.txt b/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/EmptyParameterName.fir.txt
deleted file mode 100644
index 950fee2ec14..00000000000
--- a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/EmptyParameterName.fir.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-public/*package*/ open class A : R|kotlin/Any| {
- public open fun emptyName(@R|kotlin/annotations/jvm/internal/ParameterName|(String()) first: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|, @R|kotlin/annotations/jvm/internal/ParameterName|(String(ok)) second: R|kotlin/Int|): R|kotlin/Unit|
-
- public open fun missingName(@R|kotlin/annotations/jvm/internal/ParameterName|() first: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|): R|kotlin/Unit|
-
- public open fun numberName(@R|kotlin/annotations/jvm/internal/ParameterName|(Int(42)) first: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|): R|kotlin/Unit|
-
- public/*package*/ constructor(): R|A|
-
-}
diff --git a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/EmptyParameterName.java b/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/EmptyParameterName.java
deleted file mode 100644
index 7e3d6ba9e0e..00000000000
--- a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/EmptyParameterName.java
+++ /dev/null
@@ -1,16 +0,0 @@
-// FILE: A.java
-// ANDROID_ANNOTATIONS
-
-import kotlin.annotations.jvm.internal.*;
-
-class A {
- public void emptyName(@ParameterName("") String first, @ParameterName("ok") int second) {
- }
-
- public void missingName(@ParameterName() String first) {
- }
-
- public void numberName(@ParameterName(42) String first) {
- }
-}
-
diff --git a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/ReorderedParameterNames.fir.txt b/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/ReorderedParameterNames.fir.txt
deleted file mode 100644
index 5b1de90168c..00000000000
--- a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/ReorderedParameterNames.fir.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-public open class A : R|kotlin/Any| {
- public open fun connect(@R|kotlin/annotations/jvm/internal/ParameterName|(String(host)) host: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|, @R|kotlin/annotations/jvm/internal/ParameterName|(String(port)) port: R|kotlin/Int|): R|kotlin/Unit|
-
- public constructor(): R|A|
-
-}
diff --git a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/ReorderedParameterNames.java b/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/ReorderedParameterNames.java
deleted file mode 100644
index f971eb9150d..00000000000
--- a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/ReorderedParameterNames.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-// FILE: A.java
-// ANDROID_ANNOTATIONS
-import kotlin.annotations.jvm.internal.*;
-
-public class A {
- public void connect(@ParameterName("host") String host, @ParameterName("port") int port) {
- }
-}
-
diff --git a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/SameParameterName.fir.txt b/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/SameParameterName.fir.txt
deleted file mode 100644
index 8496ac8c6e7..00000000000
--- a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/SameParameterName.fir.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-public open class A : R|kotlin/Any| {
- public open fun same(@R|kotlin/annotations/jvm/internal/ParameterName|(String(ok)) first: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|, @R|kotlin/annotations/jvm/internal/ParameterName|(String(ok)) second: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|): R|kotlin/Unit|
-
- public constructor(): R|A|
-
-}
diff --git a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/SameParameterName.java b/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/SameParameterName.java
deleted file mode 100644
index d610459e082..00000000000
--- a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/SameParameterName.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-// FILE: A.java
-// ANDROID_ANNOTATIONS
-import kotlin.annotations.jvm.internal.*;
-
-public class A {
- public void same(@ParameterName("ok") String first, @ParameterName("ok") String second) {
- }
-}
-
diff --git a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/SpecialCharsParameterName.fir.txt b/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/SpecialCharsParameterName.fir.txt
deleted file mode 100644
index 7bbbe502442..00000000000
--- a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/SpecialCharsParameterName.fir.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-public open class A : R|kotlin/Any| {
- public open fun dollarName(@R|kotlin/annotations/jvm/internal/ParameterName|(String($)) host: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|): R|kotlin/Unit|
-
- public open fun numberName(@R|kotlin/annotations/jvm/internal/ParameterName|(String(42)) field: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|): R|kotlin/Unit|
-
- public constructor(): R|A|
-
-}
diff --git a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/SpecialCharsParameterName.java b/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/SpecialCharsParameterName.java
deleted file mode 100644
index 36bc004a9b3..00000000000
--- a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/SpecialCharsParameterName.java
+++ /dev/null
@@ -1,13 +0,0 @@
-// FILE: A.java
-// ANDROID_ANNOTATIONS
-import kotlin.annotations.jvm.internal.*;
-import kotlin.internal.*;
-
-public class A {
- public void dollarName(@ParameterName("$") String host) {
- }
-
- public void numberName(@ParameterName("42") String field) {
- }
-}
-
diff --git a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/StaticMethodWithDefaultValue.fir.txt b/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/StaticMethodWithDefaultValue.fir.txt
deleted file mode 100644
index 4b39e431056..00000000000
--- a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/StaticMethodWithDefaultValue.fir.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-public/*package*/ open class A : R|kotlin/Any| {
- public open static fun withDefault(@R|kotlin/annotations/jvm/internal/DefaultValue|(String(OK)) arg: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!| = String(OK)): R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|
-
- public/*package*/ constructor(): R|A|
-
-}
diff --git a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/StaticMethodWithDefaultValue.java b/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/StaticMethodWithDefaultValue.java
deleted file mode 100644
index 3301ae534b2..00000000000
--- a/compiler/fir/analysis-tests/testData/enhancement/signatureAnnotations/StaticMethodWithDefaultValue.java
+++ /dev/null
@@ -1,13 +0,0 @@
-// IGNORE_BACKEND: JS, NATIVE
-
-// FILE: A.java
-// ANDROID_ANNOTATIONS
-
-import kotlin.annotations.jvm.internal.*;
-
-class A {
- public static String withDefault(@DefaultValue("OK") String arg) {
- return arg;
- }
-}
-
diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.txt
index 08dd7c55828..dcfdffe0060 100644
--- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.txt
+++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.txt
@@ -12,7 +12,7 @@ public sealed class Sealed : R|kotlin/Any| {
public final val z: R|test/Z|
public get(): R|test/Z|
- @R|test/Ann|() internal constructor(@R|test/Ann|() z: R|test/Z|): R|test/Sealed|
+ @R|test/Ann|() protected constructor(@R|test/Ann|() z: R|test/Z|): R|test/Sealed|
}
diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/class/SealedClass.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/class/SealedClass.txt
index 7eb9f3de23d..5a4cc58b80e 100644
--- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/class/SealedClass.txt
+++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/class/SealedClass.txt
@@ -14,7 +14,7 @@ public sealed class SealedClass : R|kotlin/Any| {
}
- internal constructor(): R|test/SealedClass|
+ protected constructor(): R|test/SealedClass|
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/ambiguityOnJavaOverride.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/ambiguityOnJavaOverride.kt
index 616ba08d947..ac36f03e9f6 100644
--- a/compiler/fir/analysis-tests/testData/resolve/arguments/ambiguityOnJavaOverride.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/arguments/ambiguityOnJavaOverride.kt
@@ -15,5 +15,5 @@ class B : A() {
}
fun test(b: B) {
- b.foo("")
+ b.foo("")
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/default.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/default.kt
index d9ac68a53ae..bf5a1904af2 100644
--- a/compiler/fir/analysis-tests/testData/resolve/arguments/default.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/arguments/default.kt
@@ -8,19 +8,19 @@ fun test() {
foo(1, 2.0, true)
foo(1, third = true)
- foo()
- foo(0, 0.0, false, "")
+ foo()
+ foo(0, 0.0, false, "")
bar(1, third = true)
bar(1, 2.0, true)
bar(1, 2.0, true, "my")
- bar(1, true)
+ bar(1, true)
baz(1)
baz(1, "my", "yours")
baz(1, z = true)
- baz(0, "", false)
+ baz(0, "", false)
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/defaultFromOverrides.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/defaultFromOverrides.kt
index af4ff520d6b..6995c3c4d61 100644
--- a/compiler/fir/analysis-tests/testData/resolve/arguments/defaultFromOverrides.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/arguments/defaultFromOverrides.kt
@@ -15,8 +15,8 @@ fun foo(a: A) {
a.foo()
a.foo(1)
- a.bar()
- a.bar("")
+ a.bar()
+ a.bar("")
a.bar(y = 1)
a.bar("", 2)
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/integerLiteralTypes.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/integerLiteralTypes.kt
index 59b75b27414..0aa726d7740 100644
--- a/compiler/fir/analysis-tests/testData/resolve/arguments/integerLiteralTypes.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/arguments/integerLiteralTypes.kt
@@ -17,9 +17,9 @@ fun test_1() {
}
fun test_2() {
- takeInt(10000000000)
+ takeInt(10000000000)
takeLong(10000000000)
- takeByte(1000)
+ takeByte(1000)
}
fun test_3() {
@@ -35,8 +35,8 @@ fun test_4() {
}
fun test_5() {
- takeString(1)
- takeString(run { 1 })
+ takeString(1)
+ takeString(run { 1 })
}
annotation class Ann(val x: Byte)
diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/javaArrayVariance.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/javaArrayVariance.kt
index b6916223877..5972c59efdb 100644
--- a/compiler/fir/analysis-tests/testData/resolve/arguments/javaArrayVariance.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/arguments/javaArrayVariance.kt
@@ -13,6 +13,6 @@ fun takeOutA(array: Array) {}
fun test(array: Array) {
A.take(array)
- takeA(array)
+ takeA(array)
takeOutA(array)
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/lambda.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/lambda.kt
index 99f98ae6f6c..efbfd0fe827 100644
--- a/compiler/fir/analysis-tests/testData/resolve/arguments/lambda.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/arguments/lambda.kt
@@ -10,8 +10,8 @@ fun test() {
foo({})
// Bad
- foo(1) {}
- foo(f = {}) {}
+ foo(1) {}
+ foo(f = {}) {}
// OK
bar(1) {}
@@ -20,15 +20,15 @@ fun test() {
bar(x = 1, f = {})
// Bad
- bar {}
- bar({})
+ bar {}
+ bar({})
// OK
baz(other = false, f = {})
baz({}, false)
// Bad
- baz {}
- baz() {}
- baz(other = false) {}
+ baz {}
+ baz() {}
+ baz(other = false) {}
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/lambdaInUnresolvedCall.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/lambdaInUnresolvedCall.kt
index f867a56997e..99ee3e6cfa0 100644
--- a/compiler/fir/analysis-tests/testData/resolve/arguments/lambdaInUnresolvedCall.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/arguments/lambdaInUnresolvedCall.kt
@@ -1,14 +1,14 @@
fun materialize(): R = null!!
fun test_1() {
- myRun {
+ myRun {
val x = 1
x * 2
- }
+ }
}
fun test_2() {
- myRun {
+ myRun {
materialize()
- }
+ }
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/operatorsOverLiterals.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/operatorsOverLiterals.kt
index 445ecf3ff4d..242b333b0a0 100644
--- a/compiler/fir/analysis-tests/testData/resolve/arguments/operatorsOverLiterals.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/arguments/operatorsOverLiterals.kt
@@ -31,33 +31,33 @@ fun test_3() {
fun takeByte(b: Byte) {}
fun test_4() {
- takeByte(1 + 1)
- takeByte(1 + 127)
- takeByte(1 - 1)
- takeByte(-100 - 100)
- takeByte(10 * 10)
- takeByte(100 * 100)
- taleByte(10 / 10)
- takeByte(100 % 10)
- takeByte(1000 % 10)
- takeByte(1000 and 100)
- takeByte(128 and 511)
- takeByte(100 or 100)
- takeByte(1000 or 0)
- takeByte(511 xor 511)
- takeByte(512 xor 511)
+ takeByte(1 + 1)
+ takeByte(1 + 127)
+ takeByte(1 - 1)
+ takeByte(-100 - 100)
+ takeByte(10 * 10)
+ takeByte(100 * 100)
+ taleByte(10 / 10)
+ takeByte(100 % 10)
+ takeByte(1000 % 10)
+ takeByte(1000 and 100)
+ takeByte(128 and 511)
+ takeByte(100 or 100)
+ takeByte(1000 or 0)
+ takeByte(511 xor 511)
+ takeByte(512 xor 511)
}
fun test_5() {
takeByte(-1)
takeByte(+1)
- takeByte(1.inv())
+ takeByte(1.inv())
}
fun test_6() {
- takeByte(run { 127 + 1 })
- takeByte(1 + run { 1 })
- takeByte(run { 1 + 1 })
+ takeByte(run { 127 + 1 })
+ takeByte(1 + run { 1 })
+ takeByte(run { 1 + 1 })
1 + 1
run { 1 }
1 + run { 1 }
diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/simple.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/simple.kt
index d669fd5ef8a..737e67d3b8e 100644
--- a/compiler/fir/analysis-tests/testData/resolve/arguments/simple.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/arguments/simple.kt
@@ -7,11 +7,11 @@ fun test() {
foo(1, second = 3.14, third = false, fourth = "!?")
foo(third = false, second = 2.71, fourth = "?!", first = 0)
- foo()
- foo(0.0, false, 0, "")
+ foo()
+ foo(0.0, false, 0, "")
foo(1, 2.0, third = true, "")
- foo(second = 0.0, first = 0, fourth = "")
- foo(first = 0.0, second = 0, third = "", fourth = false)
- foo(first = 0, second = 0.0, third = false, fourth = "", first = 1)
- foo(0, 0.0, false, foth = "")
+ foo(second = 0.0, first = 0, fourth = "")
+ foo(first = 0.0, second = 0, third = "", fourth = false)
+ foo(first = 0, second = 0.0, third = false, fourth = "", first = 1)
+ foo(0, 0.0, false, foth = "")
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/vararg.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/vararg.kt
index ecafa19ebb0..f42aee5067d 100644
--- a/compiler/fir/analysis-tests/testData/resolve/arguments/vararg.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/arguments/vararg.kt
@@ -7,11 +7,11 @@ fun test() {
foo(1, "my", "yours")
foo(1, *arrayOf("my", "yours"))
- foo("")
- foo(1, 2)
+ foo("")
+ foo(1, 2)
bar(1, z = true, y = *arrayOf("my", "yours"))
- bar(0, z = false, y = "", y = "other")
- bar(0, "", true)
+ bar(0, z = false, y = "", y = "other")
+ bar(0, "", true)
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/asImports.kt b/compiler/fir/analysis-tests/testData/resolve/asImports.kt
index 33826641a61..8847a4c7fc4 100644
--- a/compiler/fir/analysis-tests/testData/resolve/asImports.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/asImports.kt
@@ -11,9 +11,9 @@ class A {
import foo.A as B
fun test_1() {
- val a = A()
+ val a = A()
val b = B() // should be OK
- val c: B = A()
+ val c: B = A()
}
fun test_2(b: B) {
diff --git a/compiler/fir/analysis-tests/testData/resolve/callResolution/errorCandidates.kt b/compiler/fir/analysis-tests/testData/resolve/callResolution/errorCandidates.kt
index 8ce85a18c6e..390901c0302 100644
--- a/compiler/fir/analysis-tests/testData/resolve/callResolution/errorCandidates.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/callResolution/errorCandidates.kt
@@ -9,11 +9,11 @@ fun bar(x: B) {}
fun test(c: C) {
// Argument mapping error
- foo("")
+ foo("")
// Ambiguity
- bar(c)
+ bar(c)
// Unresolved reference
- baz()
+ baz()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/callResolution/kt37056.fir.txt b/compiler/fir/analysis-tests/testData/resolve/callResolution/kt37056.fir.txt
new file mode 100644
index 00000000000..f28f9da1a94
--- /dev/null
+++ b/compiler/fir/analysis-tests/testData/resolve/callResolution/kt37056.fir.txt
@@ -0,0 +1,58 @@
+FILE: kt37056.kt
+ public final fun case1(a: R|A?|): R|kotlin/Unit| {
+ lval test: R|kotlin/String?| = R|/a|?.{ $subj$.R|kotlin/let|( = let@fun (it: R|A|): R|kotlin/String| {
+ Q|Case1|.R|/Case1.Companion.invoke|(R|/it|)
+ Q|Case1|.R|/Case1.Companion.invoke|(R|/it|)
+ ^ Q|Case1|.R|/Case1.Companion.invoke|(R|/A.A|())
+ }
+ ) }
+ Q|Case1|.R|/Case1.Companion.invoke|(R|/A.A|())
+ Q|Case1|.R|/Case1.Companion.invoke|(a = R|/A.A|())
+ }
+ public final class Case1 : R|kotlin/Any| {
+ private constructor(a: R|A|): R|Case1| {
+ super()
+ }
+
+ public final val a: R|A| = R|/a|
+ public get(): R|A|
+
+ public final companion object Companion : R|kotlin/Any| {
+ private constructor(): R|Case1.Companion| {
+ super()
+ }
+
+ public final operator fun invoke(a: R|A|): R|kotlin/String| {
+ ^invoke String()
+ }
+
+ }
+
+ }
+ public final fun case2(a: R|A|): R|kotlin/Unit| {
+ Q|Case2|.R|/Case2.Companion.invoke|(R|/a|)
+ Q|Case2|.R|/Case2.Companion.invoke|(a = R|/a|)
+ }
+ public final class Case2 : R|kotlin/Any| {
+ public constructor(): R|Case2| {
+ super()
+ }
+
+ public final companion object Companion : R|kotlin/Any| {
+ private constructor(): R|Case2.Companion| {
+ super()
+ }
+
+ public final operator fun invoke(a: R|A|): R|kotlin/String| {
+ ^invoke String()
+ }
+
+ }
+
+ }
+ public final class A : R|kotlin/Any| {
+ public constructor(): R|A| {
+ super()
+ }
+
+ }
diff --git a/compiler/fir/analysis-tests/testData/resolve/callResolution/kt37056.kt b/compiler/fir/analysis-tests/testData/resolve/callResolution/kt37056.kt
new file mode 100644
index 00000000000..8258acf4bb3
--- /dev/null
+++ b/compiler/fir/analysis-tests/testData/resolve/callResolution/kt37056.kt
@@ -0,0 +1,32 @@
+fun case1(a: A?) {
+ val test = a?.let {
+
+ Case1.invoke(it)
+
+ Case1(it)
+
+ Case1(A())
+ }
+
+ Case1(A())
+ Case1(a = A())
+}
+
+class Case1 private constructor(val a: A) {
+ companion object {
+ operator fun invoke(a: A) = ""
+ }
+}
+
+fun case2(a: A) {
+ Case2(a)
+ Case2(a =a)
+}
+
+class Case2 {
+ companion object {
+ operator fun invoke(a: A) = "" //(1)
+ }
+}
+
+class A()
\ No newline at end of file
diff --git a/compiler/fir/analysis-tests/testData/resolve/callResolution/lambdaAsReceiver.kt b/compiler/fir/analysis-tests/testData/resolve/callResolution/lambdaAsReceiver.kt
index c6cc6917af0..543f908a55b 100644
--- a/compiler/fir/analysis-tests/testData/resolve/callResolution/lambdaAsReceiver.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/callResolution/lambdaAsReceiver.kt
@@ -9,6 +9,6 @@ fun main1() {
}
fun main2() {
- { "" }.bar()
+ { "" }.bar()
"".bar()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda.kt b/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda.kt
index be90f5a38d6..f91d92380d2 100644
--- a/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda.kt
@@ -19,7 +19,7 @@ fun test_2(x: Any, y: Any) {
val a = select(
id(
run {
- y.inc() // Bad
+ y.inc() // Bad
x as Int
}
),
@@ -39,14 +39,14 @@ fun test_3(x: Any, y: Any) {
val a = select(
id(
run {
- y.inc() // Bad
+ y.inc() // Bad
x as Int
materialize()
}
),
run {
y as Int
- x.inc() // Bad
+ x.inc() // Bad
y.inc() // OK
1
}
@@ -60,19 +60,19 @@ fun test_4(x: Any, y: Any) {
val a = select(
id(
myRun {
- y.inc() // Bad
+ y.inc() // Bad
x as Int
}
),
y as Int,
myRun {
- x.inc() // Bad
+ x.inc() // Bad
y.inc() // OK
1
}
)
- takeInt(x) // Bad
+ takeInt(x) // Bad
takeInt(y) // OK
takeInt(a) // Bad
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/innerClassInAnonymousObject.fir.txt b/compiler/fir/analysis-tests/testData/resolve/cfg/innerClassInAnonymousObject.fir.txt
index 34e9c667163..f1c88d5bd1b 100644
--- a/compiler/fir/analysis-tests/testData/resolve/cfg/innerClassInAnonymousObject.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolve/cfg/innerClassInAnonymousObject.fir.txt
@@ -1,5 +1,5 @@
FILE: innerClassInAnonymousObject.kt
- public final val x: R|| = object : R|kotlin/Any| {
+ public final val x: R|kotlin/Any| = object : R|kotlin/Any| {
private constructor(): R|| {
super()
}
@@ -16,4 +16,4 @@ FILE: innerClassInAnonymousObject.kt
}
- public get(): R||
+ public get(): R|kotlin/Any|
diff --git a/compiler/fir/analysis-tests/testData/resolve/constantValues.fir.txt b/compiler/fir/analysis-tests/testData/resolve/constantValues.fir.txt
index 81bbe2a4f85..28d5dccf463 100644
--- a/compiler/fir/analysis-tests/testData/resolve/constantValues.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolve/constantValues.fir.txt
@@ -44,7 +44,7 @@ FILE: constantValues.kt
}
public sealed class Value : R|kotlin/Any| {
- private constructor(): R|KClassValue.Value| {
+ protected constructor(): R|KClassValue.Value| {
super()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/abstractSuperCall.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/abstractSuperCall.kt
index 18abcc097c6..4c7e16469db 100644
--- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/abstractSuperCall.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/abstractSuperCall.kt
@@ -22,7 +22,7 @@ class B : A() {
}
fun g() {
- super.f()
+ super.f()
super.t()
super.x
@@ -32,7 +32,7 @@ class B : A() {
abstract class J : A() {
fun r() {
- super.f()
+ super.f()
super.t()
super.x
diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/abstractSuperCallInPresenseOfNonAbstractMethodInParent.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/abstractSuperCallInPresenseOfNonAbstractMethodInParent.kt
index 9ad38609849..23e7fc1dfcb 100644
--- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/abstractSuperCallInPresenseOfNonAbstractMethodInParent.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/abstractSuperCallInPresenseOfNonAbstractMethodInParent.kt
@@ -13,5 +13,5 @@ open class B {
class A : IWithToString, B() {
override fun toString(): String = super.toString() // resolve to Any.toString
override fun foo(): String = super.foo() // resolve to B.foo()
- override fun bar(): String = super.bar() // should be an error
+ override fun bar(): String = super.bar() // should be an error
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/annotationArgumentKClassLiteralTypeError.fir.txt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/annotationArgumentKClassLiteralTypeError.fir.txt
index fa58d460db5..5d037b7f706 100644
--- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/annotationArgumentKClassLiteralTypeError.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/annotationArgumentKClassLiteralTypeError.fir.txt
@@ -8,7 +8,7 @@ FILE: annotationArgumentKClassLiteralTypeError.kt
public get(): R|kotlin/Array>|
}
- public final val R|T|.test: R||
+ public final val R|T|.test: R|kotlin/Any|
public get(): R|| {
^ @R|Ann|(((R|T|), (Q|kotlin/Array|))) object : R|kotlin/Any| {
private constructor(): R|| {
diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/conflictingOverloads.fir.txt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/conflictingOverloads.fir.txt
index b732440a451..67b922bdde5 100644
--- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/conflictingOverloads.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/conflictingOverloads.fir.txt
@@ -90,14 +90,14 @@ FILE: conflictingOverloads.kt
}
- public final val Companion: R|| = object : R|kotlin/Any| {
+ public final val Companion: R|kotlin/Any| = object : R|kotlin/Any| {
private constructor(): R|| {
super()
}
}
- public get(): R||
+ public get(): R|kotlin/Any|
}
public final fun R|B|.foo(): R|kotlin/Unit| {
diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/cyclicConstructorDelegationCall.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/cyclicConstructorDelegationCall.kt
index 3e0bcb593bf..0ff6c499e81 100644
--- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/cyclicConstructorDelegationCall.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/cyclicConstructorDelegationCall.kt
@@ -63,5 +63,5 @@ class M {
}
class U : M {
- constructor()
+ constructor()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/explicitDelegationCallRequired.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/explicitDelegationCallRequired.kt
index 89391c3f554..a78d7ed62a4 100644
--- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/explicitDelegationCallRequired.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/explicitDelegationCallRequired.kt
@@ -3,16 +3,16 @@ class A(x: Int) {
}
class B : A {
- constructor()
+ constructor()
constructor(z: String) : this()
}
class C : A(20) {
- constructor()
+ constructor()
constructor(z: String) : this()
}
class D() : A(20) {
- constructor(x: Int)
+ constructor(x: Int)
constructor(z: String) : this()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/inapplicableLateinitModifier.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/inapplicableLateinitModifier.kt
index e5cdcc75457..3894b1275bf 100644
--- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/inapplicableLateinitModifier.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/inapplicableLateinitModifier.kt
@@ -3,36 +3,36 @@ object Delegate {
operator fun setValue(instance: Any?, property: Any, value: String) {}
}
-lateinit var test: Int
-lateinit var kest by Delegate
+lateinit var test: Int
+lateinit var kest by Delegate
lateinit var good: String
class A {
- lateinit val fest = "10"
+ lateinit val fest = "10"
lateinit var mest: String
- lateinit var xest: String?
- lateinit var nest: Int
- lateinit var west: Char
- lateinit var qest: Boolean
- lateinit var aest: Short
- lateinit var hest: Byte
- lateinit var jest: Long
- lateinit val dest: String
- get() = "KEKER"
+ lateinit var xest: String?
+ lateinit var nest: Int
+ lateinit var west: Char
+ lateinit var qest: Boolean
+ lateinit var aest: Short
+ lateinit var hest: Byte
+ lateinit var jest: Long
+ lateinit val dest: String
+ get() = "KEKER"
}
class B {
- lateinit var best: T
+ lateinit var best: T
}
class C {
lateinit var pest: K
- lateinit var vest: K?
+ lateinit var vest: K?
}
fun rest() {
- lateinit var i: Int
+ lateinit var i: Int
lateinit var a: A
- lateinit var b: B = B()
+ lateinit var b: B = B()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/incompatibleModifiers.fir.txt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/incompatibleModifiers.fir.txt
index 823b6488df7..dde4466903e 100644
--- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/incompatibleModifiers.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/incompatibleModifiers.fir.txt
@@ -30,13 +30,13 @@ FILE: incompatibleModifiers.kt
}
public final class F : R|kotlin/Any| {
- private constructor(): R|F| {
+ protected constructor(): R|F| {
super()
}
}
public sealed class G : R|kotlin/Any| {
- private constructor(): R|G| {
+ protected constructor(): R|G| {
super()
}
@@ -57,7 +57,7 @@ FILE: incompatibleModifiers.kt
}
public sealed data class I : R|kotlin/Any| {
- private constructor(i: R|kotlin/Int|): R|I| {
+ protected constructor(i: R|kotlin/Int|): R|I| {
super()
}
@@ -126,7 +126,7 @@ FILE: incompatibleModifiers.kt
}
public sealed inner class Z : R|kotlin/Any| {
- private constructor(): R|X.Z| {
+ protected constructor(): R|X.Z| {
super()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/instanceAccessBeforeSuperCall.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/instanceAccessBeforeSuperCall.kt
index ecc452d60ca..bd69a862cac 100644
--- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/instanceAccessBeforeSuperCall.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/instanceAccessBeforeSuperCall.kt
@@ -1,5 +1,5 @@
class A {
- constructor(x: Int = getSomeInt(), other: A = this, header: String = keker) {}
+ constructor(x: Int = getSomeInt(), other: A = this, header: String = keker) {}
fun getSomeInt() = 10
var keker = "test"
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/localEntitytNotAllowed.fir.txt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/localEntitytNotAllowed.fir.txt
index ff83835dd72..f6a6c1b4556 100644
--- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/localEntitytNotAllowed.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/localEntitytNotAllowed.fir.txt
@@ -21,7 +21,7 @@ FILE: localEntitytNotAllowed.kt
public abstract interface X : R|kotlin/Any| {
}
- public final val a: R|| = object : R|kotlin/Any| {
+ public final val a: R|kotlin/Any| = object : R|kotlin/Any| {
private constructor(): R|| {
super()
}
@@ -48,7 +48,7 @@ FILE: localEntitytNotAllowed.kt
}
- public get(): R||
+ public get(): R|kotlin/Any|
public final fun b(): R|kotlin/Unit| {
local final object E : R|kotlin/Any| {
diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/nonConstValInAnnotationArgument.fir.txt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/nonConstValInAnnotationArgument.fir.txt
index fb134019b74..475470bd1dd 100644
--- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/nonConstValInAnnotationArgument.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/nonConstValInAnnotationArgument.fir.txt
@@ -17,3 +17,18 @@ FILE: nonConstValInAnnotationArgument.kt
public get(): R|kotlin/Int|
@R|Ann|((R|/foo|, R|/foo|.R|kotlin/String.plus|(R|/cnst|.R|kotlin/Any.toString|()))) public final fun test(): R|kotlin/Unit| {
}
+ public final const val A: R|kotlin/String| = String(foo)
+ public get(): R|kotlin/String|
+ public final const val B: R|kotlin/Int| = Int(100)
+ public get(): R|kotlin/Int|
+ public final annotation class S : R|kotlin/Annotation| {
+ public constructor(s: R|kotlin/String|): R|S| {
+ super()
+ }
+
+ public final val s: R|kotlin/String| = R|/s|
+ public get(): R|kotlin/String|
+
+ }
+ @R|S|(R|/A|.R|kotlin/String.plus|(R|/B|)) public final fun foo(): R|kotlin/Unit| {
+ }
diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/nonConstValInAnnotationArgument.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/nonConstValInAnnotationArgument.kt
index ae88b8599f9..8a9dfbb7c40 100644
--- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/nonConstValInAnnotationArgument.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/nonConstValInAnnotationArgument.kt
@@ -11,3 +11,11 @@ const val cnst = 2
)
)
fun test() {}
+
+const val A = "foo"
+const val B = 100
+
+annotation class S(val s: String)
+
+@S(A + B)
+fun foo() {}
\ No newline at end of file
diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/notASupertype.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/notASupertype.kt
index 4e8a13c2ee7..7d5354dc497 100644
--- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/notASupertype.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/notASupertype.kt
@@ -4,7 +4,7 @@ class A {
class B : A {
fun g() {
- super.f()
+ super.f()
super.f()
}
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/redundantModifier.fir.txt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/redundantModifier.fir.txt
index d2716c234c6..aea1166c7a2 100644
--- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/redundantModifier.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/redundantModifier.fir.txt
@@ -6,7 +6,7 @@ FILE: redundantModifier.kt
}
public sealed class B : R|kotlin/Any| {
- private constructor(): R|B| {
+ protected constructor(): R|B| {
super()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/sealedClassConstructorCall.fir.txt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/sealedClassConstructorCall.fir.txt
index 6f593d2a8fc..b6381cfa192 100644
--- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/sealedClassConstructorCall.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/sealedClassConstructorCall.fir.txt
@@ -1,9 +1,9 @@
FILE: sealedClassConstructorCall.kt
public sealed class A : R|kotlin/Any| {
- private constructor(): R|A| {
+ protected constructor(): R|A| {
super()
}
}
- public final val b: R|A| = R|/A.A|()
+ public final val b: R|A| = #()
public get(): R|A|
diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/sealedClassConstructorCall.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/sealedClassConstructorCall.kt
index ae002614d51..c4717ff1394 100644
--- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/sealedClassConstructorCall.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/sealedClassConstructorCall.kt
@@ -1,3 +1,3 @@
sealed class A
-val b = A()
+val b = A()
diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/sealedSupertype.fir.txt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/sealedSupertype.fir.txt
index 80e01f0bf6d..0ba1e44476e 100644
--- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/sealedSupertype.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/sealedSupertype.fir.txt
@@ -1,6 +1,6 @@
FILE: sealedSupertype.kt
public sealed class A : R|kotlin/Any| {
- private constructor(): R|A| {
+ protected constructor(): R|A| {
super()
}
@@ -22,7 +22,7 @@ FILE: sealedSupertype.kt
}
public sealed class P : R|kotlin/Any| {
- private constructor(): R|P| {
+ protected constructor(): R|P| {
super()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/superIsNotAnExpression.fir.txt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/superIsNotAnExpression.fir.txt
index bf84fa6d262..304448a68f5 100644
--- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/superIsNotAnExpression.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/superIsNotAnExpression.fir.txt
@@ -13,8 +13,8 @@ FILE: superIsNotAnExpression.kt
public final fun act(): R|kotlin/Unit| {
#()
#()
- #( = @fun .(): {
- println#(ERROR_EXPR(Incorrect character: 'weird'))
+ #( = @fun (): R|ERROR CLASS: Unresolved name: println| {
+ ^ #(ERROR_EXPR(Incorrect character: 'weird'))
}
)
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/superIsNotAnExpression.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/superIsNotAnExpression.kt
index ad4f40fa5f2..5537e7af33f 100644
--- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/superIsNotAnExpression.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/superIsNotAnExpression.kt
@@ -4,10 +4,10 @@ class B: A() {
fun act() {
super()
- invoke()
+ invoke()
super {
- println('weird')
+ println('weird')
}
}
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/superNotAvailable.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/superNotAvailable.kt
index 1ca40411257..62de59fefa9 100644
--- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/superNotAvailable.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/superNotAvailable.kt
@@ -1,20 +1,20 @@
fun String.f() {
- super@f.compareTo("")
- super.compareTo("")
+ super@f.compareTo("")
+ super.compareTo("")
}
fun foo() {
super
- super.foo()
- super.foo()
+ super.foo()
+ super.foo()
}
class A {
fun act() {
- println("Test")
+ println("Test")
}
fun String.fact() {
- println("Fest")
+ println("Fest")
}
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/typeArgumentsNotAllowed.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/typeArgumentsNotAllowed.kt
index c01d19b07bc..796fdcbfc0d 100644
--- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/typeArgumentsNotAllowed.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/typeArgumentsNotAllowed.kt
@@ -17,8 +17,8 @@ object Best {
}
-val a = rest.MyClass
-val b = Best.MyClass
+val a = rest.MyClass
+val b = Best.MyClass
class B
class C<Boolean>> : B<F<Boolean>>()
diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/upperBoundViolated.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/upperBoundViolated.kt
index 9e0ce9dcbfc..82d44bb7e8b 100644
--- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/upperBoundViolated.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/upperBoundViolated.kt
@@ -45,4 +45,4 @@ val test8 = NL()
class NumberPhile(x: T)
val np1 = NumberPhile(10)
-val np2 = NumberPhile("Test")
+val np2 = NumberPhile("Test")
diff --git a/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/negative/missingSealedInheritor.fir.txt b/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/negative/missingSealedInheritor.fir.txt
index 0d11593bd9b..6cb8362f9d3 100644
--- a/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/negative/missingSealedInheritor.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/negative/missingSealedInheritor.fir.txt
@@ -1,6 +1,6 @@
FILE: a.kt
public sealed class Base : R|kotlin/Any| {
- private constructor(): R|Base| {
+ protected constructor(): R|Base| {
super()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_enumJava.kt b/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_enumJava.kt
index 463216e5e5f..07ab6b5a49d 100644
--- a/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_enumJava.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_enumJava.kt
@@ -10,13 +10,13 @@ fun test_1(e: JavaEnum) {
val a = when (e) {
JavaEnum.A -> 1
JavaEnum.B -> 2
- }.plus(0)
+ }.plus(0)
val b = when (e) {
JavaEnum.A -> 1
JavaEnum.B -> 2
is String -> 3
- }.plus(0)
+ }.plus(0)
val c = when (e) {
JavaEnum.A -> 1
@@ -35,7 +35,7 @@ fun test_2(e: JavaEnum?) {
JavaEnum.A -> 1
JavaEnum.B -> 2
JavaEnum.C -> 3
- }.plus(0)
+ }.plus(0)
val a = when (e) {
JavaEnum.A -> 1
diff --git a/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_sealedClass.fir.txt b/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_sealedClass.fir.txt
index 723c1e4b13e..191f39b8b8b 100644
--- a/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_sealedClass.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_sealedClass.fir.txt
@@ -1,6 +1,6 @@
FILE: exhaustiveness_sealedClass.kt
public sealed class Base : R|kotlin/Any| {
- private constructor(): R|Base| {
+ protected constructor(): R|Base| {
super()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_sealedObject.fir.txt b/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_sealedObject.fir.txt
index ac004e4505b..e2c59d3190f 100644
--- a/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_sealedObject.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_sealedObject.fir.txt
@@ -1,6 +1,6 @@
FILE: exhaustiveness_sealedObject.kt
public sealed class A : R|kotlin/Any| {
- private constructor(): R|A| {
+ protected constructor(): R|A| {
super()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_sealedSubClass.fir.txt b/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_sealedSubClass.fir.txt
index db6cbd744a5..0eebe0a863e 100644
--- a/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_sealedSubClass.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_sealedSubClass.fir.txt
@@ -1,12 +1,12 @@
FILE: exhaustiveness_sealedSubClass.kt
public sealed class A : R|kotlin/Any| {
- private constructor(): R|A| {
+ protected constructor(): R|A| {
super()
}
}
public sealed class B : R|A| {
- private constructor(): R|B| {
+ protected constructor(): R|B| {
super()
}
@@ -18,13 +18,13 @@ FILE: exhaustiveness_sealedSubClass.kt
}
public sealed class D : R|B| {
- private constructor(): R|D| {
+ protected constructor(): R|D| {
super()
}
}
public sealed class E : R|B| {
- private constructor(): R|E| {
+ protected constructor(): R|E| {
super()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_sealedSubClass.kt b/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_sealedSubClass.kt
index 9beeb8a7276..e7c9a2027b2 100644
--- a/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_sealedSubClass.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveness_sealedSubClass.kt
@@ -35,18 +35,18 @@ fun test_2(e: A) {
val a = when (e) {
is D -> 1
is E -> 2
- }.plus(0)
+ }.plus(0)
val b = when (e) {
is B -> 1
is D -> 2
is E -> 3
- }.plus(0)
+ }.plus(0)
val c = when (e) {
is B -> 1
is D -> 2
- }.plus(0)
+ }.plus(0)
val d = when (e) {
is C -> 1
diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/CallBasedInExpressionGenerator.kt b/compiler/fir/analysis-tests/testData/resolve/expresssions/CallBasedInExpressionGenerator.kt
index 7fa0c9cc927..abb4cda0e57 100644
--- a/compiler/fir/analysis-tests/testData/resolve/expresssions/CallBasedInExpressionGenerator.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/CallBasedInExpressionGenerator.kt
@@ -14,27 +14,27 @@ class CallBasedInExpressionGenerator(
val codegen: ExpressionCodegen,
operatorReference: KtSimpleNameExpression
) : InExpressionGenerator {
- private val resolvedCall = operatorReference.getResolvedCallWithAssert(codegen.bindingContext)
- private val isInverted = operatorReference.getReferencedNameElementType() == KtTokens.NOT_IN
+ private val resolvedCall = operatorReference.getResolvedCallWithAssert(codegen.bindingContext)
+ private val isInverted = operatorReference.getReferencedNameElementType() == KtTokens.NOT_IN
override fun generate(argument: StackValue): BranchedValue =
- gen(argument).let { if (isInverted) Invert(it) else it }
+ gen(argument).let { if (isInverted) Invert(it) else it }
private fun gen(argument: StackValue): BranchedValue =
object : BranchedValue(argument, null, argument.type, Opcodes.IFEQ) {
override fun putSelector(type: Type, kotlinType: KotlinType?, v: InstructionAdapter) {
invokeFunction(v)
- coerceTo(type, kotlinType, v)
+ coerceTo(type, kotlinType, v)
}
override fun condJump(jumpLabel: Label, v: InstructionAdapter, jumpIfFalse: Boolean) {
invokeFunction(v)
- v.visitJumpInsn(if (jumpIfFalse) Opcodes.IFEQ else Opcodes.IFNE, jumpLabel)
+ v.visitJumpInsn(if (jumpIfFalse) Opcodes.IFEQ else Opcodes.IFNE, jumpLabel)
}
private fun invokeFunction(v: InstructionAdapter) {
- val result = codegen.invokeFunction(resolvedCall.call, resolvedCall, none())
- result.put(result.type, result.kotlinType, v)
+ val result = codegen.invokeFunction(resolvedCall.call, resolvedCall, none())
+ result.put(result.type, result.kotlinType, v)
}
}
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/access.kt b/compiler/fir/analysis-tests/testData/resolve/expresssions/access.kt
index 88236e7ebc8..ead6b21eda9 100644
--- a/compiler/fir/analysis-tests/testData/resolve/expresssions/access.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/access.kt
@@ -43,7 +43,7 @@ fun f() {
val d = ""
val c = c
- abc()
+ abc()
fun bcd() {}
@@ -57,7 +57,7 @@ fun f() {
dcb()
}
- dcb()
+ dcb()
abc()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/baseQualifier.kt b/compiler/fir/analysis-tests/testData/resolve/expresssions/baseQualifier.kt
index cbc2599b9f9..8df28862e89 100644
--- a/compiler/fir/analysis-tests/testData/resolve/expresssions/baseQualifier.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/baseQualifier.kt
@@ -20,6 +20,6 @@ fun test() {
JavaClass.bar()
val errC = BB.C
- val errBarViaBB = BB.bar()
- val errBarViaAA = AA.bar()
+ val errBarViaBB = BB.bar()
+ val errBarViaAA = AA.bar()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/classifierAccessFromCompanion.fir.txt b/compiler/fir/analysis-tests/testData/resolve/expresssions/classifierAccessFromCompanion.fir.txt
index 809328821d2..96ce52c79eb 100644
--- a/compiler/fir/analysis-tests/testData/resolve/expresssions/classifierAccessFromCompanion.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/classifierAccessFromCompanion.fir.txt
@@ -5,7 +5,7 @@ FILE: classifierAccessFromCompanion.kt
}
public sealed class Function : R|kotlin/Any| {
- private constructor(): R|Factory.Function| {
+ protected constructor(): R|Factory.Function| {
super()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/enumEntryUse.kt b/compiler/fir/analysis-tests/testData/resolve/expresssions/enumEntryUse.kt
index e20e2c8f8e4..a9d5bb7a440 100644
--- a/compiler/fir/analysis-tests/testData/resolve/expresssions/enumEntryUse.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/enumEntryUse.kt
@@ -18,5 +18,5 @@ fun test() {
useEnum(TestEnum.THIRD)
useVararg(TestEnum.FIRST, TestEnum.SECOND)
- useVararg(1, 2, 3, 4, 5)
+ useVararg(1, 2, 3, 4, 5)
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/inference/typeParameters.kt b/compiler/fir/analysis-tests/testData/resolve/expresssions/inference/typeParameters.kt
index ad6516e7254..651ca4c1e6f 100644
--- a/compiler/fir/analysis-tests/testData/resolve/expresssions/inference/typeParameters.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/inference/typeParameters.kt
@@ -7,5 +7,5 @@ fun foo(t: T) = t
fun main(fooImpl: FooImpl, bar: Bar) {
val a = foo(fooImpl)
- val b = foo(bar)
+ val b = foo(bar)
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/inference/typeParameters2.kt b/compiler/fir/analysis-tests/testData/resolve/expresssions/inference/typeParameters2.kt
index a44c5a04324..f4bf4ac52f5 100644
--- a/compiler/fir/analysis-tests/testData/resolve/expresssions/inference/typeParameters2.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/inference/typeParameters2.kt
@@ -6,6 +6,6 @@ fun foo(t: T) = t
fun main(fooImpl: FooImpl, fooBarImpl: FooBarImpl) {
- val a = foo(fooBarImpl)
+ val a = foo(fooBarImpl)
val b = foo(fooImpl)
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/invoke/threeReceivers.kt b/compiler/fir/analysis-tests/testData/resolve/expresssions/invoke/threeReceivers.kt
index 50171203e9a..e5081adbb98 100644
--- a/compiler/fir/analysis-tests/testData/resolve/expresssions/invoke/threeReceivers.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/invoke/threeReceivers.kt
@@ -17,6 +17,6 @@ class Foo {
// this@Foo is dispatch receiver of foobar
// Foo/foobar is dispatch receiver of invoke
// this@chk is extension receiver of invoke
- buz.foobar()
+ buz.foobar()
}
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/localObjects.kt b/compiler/fir/analysis-tests/testData/resolve/expresssions/localObjects.kt
index cf10589374f..a90af6e1282 100644
--- a/compiler/fir/analysis-tests/testData/resolve/expresssions/localObjects.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/localObjects.kt
@@ -18,4 +18,4 @@ fun test() {
B.foo()
}
-val bb = B.foo()
+val bb = B.foo()
diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/nestedVisibility.kt b/compiler/fir/analysis-tests/testData/resolve/expresssions/nestedVisibility.kt
index 960d7239e02..73ed9de9800 100644
--- a/compiler/fir/analysis-tests/testData/resolve/expresssions/nestedVisibility.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/nestedVisibility.kt
@@ -11,8 +11,8 @@ open class Outer {
class Derived : Outer() {
fun foo() {
- Outer.PrivateNested()
- super.PrivateInner()
+ Outer.PrivateNested()
+ super.PrivateInner()
Outer.ProtectedNested()
super.ProtectedInner()
@@ -23,11 +23,11 @@ class Derived : Outer() {
}
fun foo() {
- Outer.PrivateNested()
- Outer().PrivateInner()
+ Outer.PrivateNested()
+ Outer().PrivateInner()
- Outer.ProtectedNested()
- Outer().ProtectedInner()
+ Outer.ProtectedNested()
+ Outer().ProtectedInner()
Outer.PublicNested()
Outer().PublicInner()
diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/privateObjectLiteral.fir.txt b/compiler/fir/analysis-tests/testData/resolve/expresssions/privateObjectLiteral.fir.txt
index f7622cce04e..cefdbc55d45 100644
--- a/compiler/fir/analysis-tests/testData/resolve/expresssions/privateObjectLiteral.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/privateObjectLiteral.fir.txt
@@ -20,7 +20,7 @@ FILE: privateObjectLiteral.kt
public final val y: R|kotlin/Int| = this@R|/C|.R|/C.x|.R|/.foo|()
public get(): R|kotlin/Int|
- internal final val z: R|| = object : R|kotlin/Any| {
+ internal final val z: R|kotlin/Any| = object : R|kotlin/Any| {
private constructor(): R|| {
super()
}
@@ -31,9 +31,9 @@ FILE: privateObjectLiteral.kt
}
- internal get(): R||
+ internal get(): R|kotlin/Any|
- public final val w: R|kotlin/Int| = this@R|/C|.R|/C.z|.R|/.foo|()
- public get(): R|kotlin/Int|
+ public final val w: R|ERROR CLASS: Unresolved name: foo| = this@R|/C|.R|/C.z|.#()
+ public get(): R|ERROR CLASS: Unresolved name: foo|
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/privateObjectLiteral.kt b/compiler/fir/analysis-tests/testData/resolve/expresssions/privateObjectLiteral.kt
index 67188d0d0fe..d7e191dbdfe 100644
--- a/compiler/fir/analysis-tests/testData/resolve/expresssions/privateObjectLiteral.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/privateObjectLiteral.kt
@@ -9,5 +9,5 @@ class C {
fun foo() = 13
}
- val w = z.foo() // ERROR!
+ val w = z.foo() // ERROR!
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/privateVisibility.kt b/compiler/fir/analysis-tests/testData/resolve/expresssions/privateVisibility.kt
index f1426b42391..c61aef1fbcf 100644
--- a/compiler/fir/analysis-tests/testData/resolve/expresssions/privateVisibility.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/privateVisibility.kt
@@ -9,21 +9,21 @@ private class Private {
bar()
Nested()
fromCompanion()
- NotCompanion.foo() // hidden
+ NotCompanion.foo() // hidden
}
inner class Inner {
fun foo() {
bar()
fromCompanion()
- NotCompanion.foo() // hidden
+ NotCompanion.foo() // hidden
}
}
private class Nested {
fun foo() {
fromCompanion()
- NotCompanion.foo() // hidden
+ NotCompanion.foo() // hidden
}
}
@@ -54,7 +54,7 @@ fun withLocals() {
Local().baz()
- Local().bar() // hidden
+ Local().bar() // hidden
}
fun test() {
@@ -62,14 +62,14 @@ fun test() {
Private().baz()
Private().Inner()
- Private().bar() // hidden
- Private.Nested() // hidden
- Private.fromCompanion() // hidden
+ Private().bar() // hidden
+ Private.Nested() // hidden
+ Private.fromCompanion() // hidden
}
// FILE: second.kt
fun secondTest() {
- foo() // hidden
- Private() // hidden
+ foo() // hidden
+ Private() // hidden
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/protectedVisibility.kt b/compiler/fir/analysis-tests/testData/resolve/expresssions/protectedVisibility.kt
index 537f0fd2009..f27cce779d2 100644
--- a/compiler/fir/analysis-tests/testData/resolve/expresssions/protectedVisibility.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/protectedVisibility.kt
@@ -31,7 +31,7 @@ class Derived : Protected() {
fun foo() {
bar()
Nested().foo()
- Nested().bar() // hidden
+ Nested().bar() // hidden
fromCompanion()
protectedFromCompanion()
@@ -48,8 +48,8 @@ fun test() {
Protected().baz()
Protected().Inner()
- Protected().bar() // hidden
- Protected.Nested() // hidden
+ Protected().bar() // hidden
+ Protected.Nested() // hidden
}
open class Generic(val x: T) {
diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/receiverConsistency.kt b/compiler/fir/analysis-tests/testData/resolve/expresssions/receiverConsistency.kt
index 86ab1c8ab94..e95a3e3bf6a 100644
--- a/compiler/fir/analysis-tests/testData/resolve/expresssions/receiverConsistency.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/receiverConsistency.kt
@@ -6,7 +6,7 @@ class C {
class Nested {
fun test() {
- err()
+ err()
}
}
}
@@ -17,5 +17,5 @@ fun test() {
c.bar()
val err = C()
- err.foo()
+ err.foo()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantModalityModifierChecker.kt b/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantModalityModifierChecker.kt
index 29ef5c58d94..bf353fc648e 100644
--- a/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantModalityModifierChecker.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantModalityModifierChecker.kt
@@ -47,7 +47,7 @@ class FinalDerived : Base() {
// Redundant final
override final fun bar() {}
// Non-final member in final class
- override open val gav = 13
+ override open val gav = 13
}
// Open
open class OpenDerived : Base() {
diff --git a/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantVisibilityModifierChecker.fir.txt b/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantVisibilityModifierChecker.fir.txt
index 3d9510284c9..2fd1132eb4c 100644
--- a/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantVisibilityModifierChecker.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantVisibilityModifierChecker.fir.txt
@@ -22,7 +22,7 @@ FILE: RedundantVisibilityModifierChecker.kt
super()
}
- internal final val z: R|| = object : R|kotlin/Any| {
+ internal final val z: R|kotlin/Any| = object : R|kotlin/Any| {
private constructor(): R|| {
super()
}
@@ -33,7 +33,7 @@ FILE: RedundantVisibilityModifierChecker.kt
}
- internal get(): R||
+ internal get(): R|kotlin/Any|
}
public final class Foo2 : R|kotlin/Any| {
@@ -111,7 +111,7 @@ FILE: RedundantVisibilityModifierChecker.kt
}
public sealed class G : R|kotlin/Any| {
- private constructor(y: R|kotlin/Int|): R|G| {
+ protected constructor(y: R|kotlin/Int|): R|G| {
super()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/fromBuilder/enums.kt b/compiler/fir/analysis-tests/testData/resolve/fromBuilder/enums.kt
index 0e6ac864eb4..b651fd02343 100644
--- a/compiler/fir/analysis-tests/testData/resolve/fromBuilder/enums.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/fromBuilder/enums.kt
@@ -9,17 +9,17 @@ enum class Order {
enum class Planet(val m: Double, internal val r: Double) {
MERCURY(1.0, 2.0) {
override fun sayHello() {
- println("Hello!!!")
+ println("Hello!!!")
}
},
VENERA(3.0, 4.0) {
override fun sayHello() {
- println("Ola!!!")
+ println("Ola!!!")
}
},
EARTH(5.0, 6.0) {
override fun sayHello() {
- println("Privet!!!")
+ println("Privet!!!")
}
};
diff --git a/compiler/fir/analysis-tests/testData/resolve/fromBuilder/simpleClass.kt b/compiler/fir/analysis-tests/testData/resolve/fromBuilder/simpleClass.kt
index d6e91bf884b..bdadf0db4d7 100644
--- a/compiler/fir/analysis-tests/testData/resolve/fromBuilder/simpleClass.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/fromBuilder/simpleClass.kt
@@ -15,7 +15,7 @@ class SomeClass : SomeInterface {
get() = true
set(value) {}
- lateinit var fau: Double
+ lateinit var fau: Double
}
inline class InlineClass
diff --git a/compiler/fir/analysis-tests/testData/resolve/incorrectSuperCall.kt b/compiler/fir/analysis-tests/testData/resolve/incorrectSuperCall.kt
index 50c694c5335..923a96486fc 100644
--- a/compiler/fir/analysis-tests/testData/resolve/incorrectSuperCall.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/incorrectSuperCall.kt
@@ -15,7 +15,7 @@ class C : A, B() {
override fun foo() {
super.foo()
- super.bar() // should be ambiguity (NB: really we should have overridden bar in C)
+ super.bar() // should be ambiguity (NB: really we should have overridden bar in C)
super.baz() // Ok
baz() // Ok
diff --git a/compiler/fir/analysis-tests/testData/resolve/inference/nullableIntegerLiteralType.kt b/compiler/fir/analysis-tests/testData/resolve/inference/nullableIntegerLiteralType.kt
index 51b826f6b5a..14fcd4dd0ff 100644
--- a/compiler/fir/analysis-tests/testData/resolve/inference/nullableIntegerLiteralType.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/inference/nullableIntegerLiteralType.kt
@@ -4,10 +4,10 @@ fun takeInt(x: Int) {}
fun test_1(b: Boolean) {
val x = if (b) 1 else null
- takeInt(x)
+ takeInt(x)
}
fun test_2(b: Boolean, y: Int) {
val x = if (b) y else null
- takeInt(x)
+ takeInt(x)
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/inference/receiverWithCapturedType.kt b/compiler/fir/analysis-tests/testData/resolve/inference/receiverWithCapturedType.kt
index 281eb062606..0a52fd88247 100644
--- a/compiler/fir/analysis-tests/testData/resolve/inference/receiverWithCapturedType.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/inference/receiverWithCapturedType.kt
@@ -24,7 +24,7 @@ fun test_1_3(resolvedCall: ResolvedCall) {
}
fun test_2_1(resolvedCall: ResolvedCall, d: CallableDescriptor) {
- val x = resolvedCall.updateD(d) // should fail
+ val x = resolvedCall.updateD(d) // should fail
}
fun test_2_2(resolvedCall: ResolvedCall, d: CallableDescriptor) {
diff --git a/compiler/fir/analysis-tests/testData/resolve/innerClasses/inner.kt b/compiler/fir/analysis-tests/testData/resolve/innerClasses/inner.kt
index 1c6aaf68ba1..d6758a13e51 100644
--- a/compiler/fir/analysis-tests/testData/resolve/innerClasses/inner.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/innerClasses/inner.kt
@@ -23,7 +23,7 @@ class Owner {
o.foo()
foo()
this@Owner.foo()
- this.err()
+ this.err()
}
}
}
@@ -31,8 +31,8 @@ class Owner {
fun test() {
val o = Owner()
o.foo()
- val err = Owner.Inner()
- err.baz()
+ val err = Owner.Inner()
+ err.baz()
val i = o.Inner()
i.gau()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/innerClasses/innerTypes.kt b/compiler/fir/analysis-tests/testData/resolve/innerClasses/innerTypes.kt
index 8c866732348..6e298256607 100644
--- a/compiler/fir/analysis-tests/testData/resolve/innerClasses/innerTypes.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/innerClasses/innerTypes.kt
@@ -12,10 +12,10 @@ val rr = Outer().Inner()
val rrq = Boxed().substitute()
fun check() {
- accept(Outer().Inner()) // illegal
- accept(Outer().Inner()) // illegal
+ accept(Outer().Inner()) // illegal
+ accept(Outer().Inner()) // illegal
accept(Outer().Inner()) // ok
- accept(Boxed().substitute()) // illegal
+ accept(Boxed().substitute()) // illegal
accept(Boxed().substitute()) // ok
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/innerClasses/simple.kt b/compiler/fir/analysis-tests/testData/resolve/innerClasses/simple.kt
index 0046ca0b2b2..d10a2c4c0f0 100644
--- a/compiler/fir/analysis-tests/testData/resolve/innerClasses/simple.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/innerClasses/simple.kt
@@ -22,8 +22,8 @@ class Owner {
}
fun err() {
- foo()
- this.foo()
+ foo()
+ this.foo()
}
}
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/kt41984.kt b/compiler/fir/analysis-tests/testData/resolve/kt41984.kt
index 41180d7f030..e693f6acce1 100644
--- a/compiler/fir/analysis-tests/testData/resolve/kt41984.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/kt41984.kt
@@ -26,6 +26,6 @@ open class B : A() {
fun test_1(b: B, x: Int, inv: Inv) {
b.take(x)
- b.take(null)
+ b.take(null)
b.takeInv(inv)
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/lambdaArgInScopeFunction.kt b/compiler/fir/analysis-tests/testData/resolve/lambdaArgInScopeFunction.kt
index 6cbf919f1ec..16b0ad25478 100644
--- a/compiler/fir/analysis-tests/testData/resolve/lambdaArgInScopeFunction.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/lambdaArgInScopeFunction.kt
@@ -21,7 +21,7 @@ fun case1(kotlinClass: KotlinClass?) {
{it}
}
- lambda.checkType { _>() }
+ lambda.checkType { _>() }
}
// TESTCASE NUMBER: 2
fun case2(kotlinClass: KotlinClass) {
@@ -36,5 +36,5 @@ fun case2(kotlinClass: KotlinClass) {
{it}
}
- lambda.checkType { _>() }
+ lambda.checkType { _>() }
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/lambdaPropertyTypeInference.kt b/compiler/fir/analysis-tests/testData/resolve/lambdaPropertyTypeInference.kt
index 03ce460d5d4..8bae96c5e36 100644
--- a/compiler/fir/analysis-tests/testData/resolve/lambdaPropertyTypeInference.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/lambdaPropertyTypeInference.kt
@@ -26,9 +26,9 @@ fun case1(javaClass: JavaClass?) {
validType.checkType { _>() } //ok
- invalidType.checkType { _>() } //(!!!)
+ invalidType.checkType { _>() } //(!!!)
- Case1(javaClass).x.checkType { _>() } //(!!!)
+ Case1(javaClass).x.checkType { _>() } //(!!!)
}
class Case1(val javaClass: JavaClass?) {
@@ -55,9 +55,9 @@ fun case2(kotlinClass: KotlinClass?) {
validType.checkType { _>() } //ok
- invalidType.checkType { _>() } //(!!!)
+ invalidType.checkType { _>() } //(!!!)
- Case2(kotlinClass).x.checkType { _>() } //(!!!)
+ Case2(kotlinClass).x.checkType { _>() } //(!!!)
}
class Case2(val kotlinClass: KotlinClass?) {
diff --git a/compiler/fir/analysis-tests/testData/resolve/multifile/sealedStarImport.fir.txt b/compiler/fir/analysis-tests/testData/resolve/multifile/sealedStarImport.fir.txt
index 5e81cbcc178..3122e0aca97 100644
--- a/compiler/fir/analysis-tests/testData/resolve/multifile/sealedStarImport.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolve/multifile/sealedStarImport.fir.txt
@@ -1,6 +1,6 @@
FILE: test.kt
public sealed class Test : R|kotlin/Any| {
- private constructor(): R|test/Test| {
+ protected constructor(): R|test/Test| {
super()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/nestedClassContructor.kt b/compiler/fir/analysis-tests/testData/resolve/nestedClassContructor.kt
index 0f5bdbfd63e..076512e710a 100644
--- a/compiler/fir/analysis-tests/testData/resolve/nestedClassContructor.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/nestedClassContructor.kt
@@ -17,7 +17,7 @@ class D : A.C() {
val a = A()
val ac = A.C()
- val c = C() // shouldn't resolve
+ val c = C() // shouldn't resolve
}
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/overrides/simple.kt b/compiler/fir/analysis-tests/testData/resolve/overrides/simple.kt
index a956ba7e5e9..f87bf8fb820 100644
--- a/compiler/fir/analysis-tests/testData/resolve/overrides/simple.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/overrides/simple.kt
@@ -14,7 +14,7 @@ class B : A() {
fun test() {
foo()
bar()
- buz()
+ buz()
}
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/overrides/supertypeGenericsComplex.kt b/compiler/fir/analysis-tests/testData/resolve/overrides/supertypeGenericsComplex.kt
index b7e5ab8f445..5fd73df0428 100644
--- a/compiler/fir/analysis-tests/testData/resolve/overrides/supertypeGenericsComplex.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/overrides/supertypeGenericsComplex.kt
@@ -10,5 +10,5 @@ class C : Base()
fun f(list: MutableList, s: MutableList) {
C().f(list, s)
- C().f(s, list)
+ C().f(s, list)
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/definitelyNotNullAndOriginalType.kt b/compiler/fir/analysis-tests/testData/resolve/problems/definitelyNotNullAndOriginalType.kt
index 384164d4d76..0230fdf919f 100644
--- a/compiler/fir/analysis-tests/testData/resolve/problems/definitelyNotNullAndOriginalType.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/problems/definitelyNotNullAndOriginalType.kt
@@ -11,5 +11,5 @@ public interface SLRUMap {
// FILE: main.kt
fun SLRUMap.getOrPut(value: V) {
- takeV(value)
+ takeV(value)
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/inaccessibleJavaGetter.kt b/compiler/fir/analysis-tests/testData/resolve/problems/inaccessibleJavaGetter.kt
index c7645a90525..44ef3776643 100644
--- a/compiler/fir/analysis-tests/testData/resolve/problems/inaccessibleJavaGetter.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/problems/inaccessibleJavaGetter.kt
@@ -20,7 +20,7 @@ class WrappedPropertyDescriptor : PropertyDescriptor {
fun test() {
val descriptor = WrappedPropertyDescriptor()
val res1 = descriptor.setter
- val res2 = descriptor.getSetter() // Should be error
+ val res2 = descriptor.getSetter() // Should be error
val res3 = descriptor.isDelegated
- val res4 = descriptor.isDelegated() // Should be error
+ val res4 = descriptor.isDelegated() // Should be error
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/multipleJavaClassesInOneFile.kt b/compiler/fir/analysis-tests/testData/resolve/problems/multipleJavaClassesInOneFile.kt
index 704db700550..1ba85216a6c 100644
--- a/compiler/fir/analysis-tests/testData/resolve/problems/multipleJavaClassesInOneFile.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/problems/multipleJavaClassesInOneFile.kt
@@ -10,5 +10,5 @@ class Another {}
fun test() {
val some = Some()
- val another = Another()
+ val another = Another()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/properties/syntheticPropertiesForJavaAnnotations.kt b/compiler/fir/analysis-tests/testData/resolve/properties/syntheticPropertiesForJavaAnnotations.kt
index 0c98ff8eb99..30c39006a34 100644
--- a/compiler/fir/analysis-tests/testData/resolve/properties/syntheticPropertiesForJavaAnnotations.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/properties/syntheticPropertiesForJavaAnnotations.kt
@@ -10,5 +10,5 @@ public @interface Ann {
fun test(ann: Ann) {
ann.value
- ann.value() // should be an error
+ ann.value() // should be an error
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/recursiveCallOnWhenWithSealedClass.fir.txt b/compiler/fir/analysis-tests/testData/resolve/recursiveCallOnWhenWithSealedClass.fir.txt
index 35ec125e8b5..92b335ce9db 100644
--- a/compiler/fir/analysis-tests/testData/resolve/recursiveCallOnWhenWithSealedClass.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolve/recursiveCallOnWhenWithSealedClass.fir.txt
@@ -1,6 +1,6 @@
FILE: recursiveCallOnWhenWithSealedClass.kt
public sealed class Maybe : R|kotlin/Any| {
- private constructor(): R|Maybe| {
+ protected constructor(): R|Maybe| {
super()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/samConstructors/genericSamInferenceFromExpectType.kt b/compiler/fir/analysis-tests/testData/resolve/samConstructors/genericSamInferenceFromExpectType.kt
index 2316e66886c..dda848e2b85 100644
--- a/compiler/fir/analysis-tests/testData/resolve/samConstructors/genericSamInferenceFromExpectType.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/samConstructors/genericSamInferenceFromExpectType.kt
@@ -18,9 +18,9 @@ fun main() {
x.toInt().toString()
})
- foo2(MyFunction { x: Int ->
+ foo2(MyFunction { x: Int ->
x.toString()
- })
+ })
foo3(
MyFunction { x ->
diff --git a/compiler/fir/analysis-tests/testData/resolve/samConstructors/realConstructorFunction.kt b/compiler/fir/analysis-tests/testData/resolve/samConstructors/realConstructorFunction.kt
index b3fa3fb01dc..d2426e224ed 100644
--- a/compiler/fir/analysis-tests/testData/resolve/samConstructors/realConstructorFunction.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/samConstructors/realConstructorFunction.kt
@@ -10,13 +10,13 @@ fun foo(m: MyRunnable) {}
fun MyRunnable(x: (Int) -> Boolean) = 1
fun main() {
- foo(MyRunnable { x ->
+ foo(MyRunnable { x ->
x > 1
- })
+ })
- foo(MyRunnable({ it > 1 }))
+ foo(MyRunnable({ it > 1 }))
val x = { x: Int -> x > 1 }
- foo(MyRunnable(x))
+ foo(MyRunnable(x))
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/samConversions/genericSam.kt b/compiler/fir/analysis-tests/testData/resolve/samConversions/genericSam.kt
index 78977c1f58b..c4eac6be67d 100644
--- a/compiler/fir/analysis-tests/testData/resolve/samConversions/genericSam.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/samConversions/genericSam.kt
@@ -21,9 +21,9 @@ fun main() {
x.toInt().toString()
}
- JavaUsage.foo2 { x: Int ->
+ JavaUsage.foo2 { x: Int ->
x.toString()
- }
+ }
JavaUsage.foo3(
{ x ->
diff --git a/compiler/fir/analysis-tests/testData/resolve/samConversions/kotlinSam.kt b/compiler/fir/analysis-tests/testData/resolve/samConversions/kotlinSam.kt
index cca6f7e9917..5fb027ccb83 100644
--- a/compiler/fir/analysis-tests/testData/resolve/samConversions/kotlinSam.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/samConversions/kotlinSam.kt
@@ -29,11 +29,11 @@ fun main() {
foo1 { x -> x > 1 }
foo1(f)
- foo2 { x -> x > 1 }
- foo2(f)
+ foo2 { x -> x > 1 }
+ foo2(f)
- foo3 { x -> x > 1 }
- foo3(f)
+ foo3 { x -> x > 1 }
+ foo3(f)
foo4 { x -> x > 1 }
foo4(f)
diff --git a/compiler/fir/analysis-tests/testData/resolve/samConversions/notSamBecauseOfSupertype.kt b/compiler/fir/analysis-tests/testData/resolve/samConversions/notSamBecauseOfSupertype.kt
index da5d1c5b163..016843b8718 100644
--- a/compiler/fir/analysis-tests/testData/resolve/samConversions/notSamBecauseOfSupertype.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/samConversions/notSamBecauseOfSupertype.kt
@@ -18,14 +18,14 @@ public class JavaUsage {
fun foo(m: MyRunnable) {}
fun main() {
- JavaUsage.foo {
+ JavaUsage.foo {
x ->
x > 1
- }
+ }
- JavaUsage.foo({ it > 1 })
+ JavaUsage.foo({ it > 1 })
val x = { x: Int -> x > 1 }
- JavaUsage.foo(x)
+ JavaUsage.foo(x)
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/sealedClass.fir.txt b/compiler/fir/analysis-tests/testData/resolve/sealedClass.fir.txt
index 0f0589d2813..6b8b7de1418 100644
--- a/compiler/fir/analysis-tests/testData/resolve/sealedClass.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolve/sealedClass.fir.txt
@@ -1,6 +1,6 @@
FILE: sealedClass.kt
public sealed class Foo : R|kotlin/Any| {
- private constructor(value: R|kotlin/String|): R|Foo| {
+ protected constructor(value: R|kotlin/String|): R|Foo| {
super()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/booleanOperators.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/booleanOperators.kt
index e45272656a6..4f293d49cd0 100644
--- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/booleanOperators.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/booleanOperators.kt
@@ -24,8 +24,8 @@ fun test_1(x: Any) {
fun test_2(x: Any) {
if (x is B || x is C) {
x.foo()
- x.bar()
- x.baz()
+ x.bar()
+ x.baz()
}
}
@@ -59,26 +59,26 @@ fun test_6(x: Any) {
fun test_7(x: Any) {
if (x is A || false) {
// TODO: should be smartcast
- x.foo()
+ x.foo()
}
}
fun test_8(x: Any) {
if (false || x is A) {
// TODO: should be smartcast
- x.foo()
+ x.foo()
}
}
fun test_9(x: Any) {
if (x is A || true) {
- x.foo()
+ x.foo()
}
}
fun test_10(x: Any) {
if (true || x is A) {
- x.foo()
+ x.foo()
}
}
@@ -86,7 +86,7 @@ fun test_10(x: Any) {
fun test_11(x: Any, b: Boolean) {
if (false && x is A) {
- x.foo()
+ x.foo()
}
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.kt
index f6e34990a98..e7be4c1de50 100644
--- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.kt
@@ -30,7 +30,7 @@ fun test_3(x: Any, y: Any) {
}
z = y
if (y is B) {
- z.foo()
+ z.foo()
z.bar()
}
}
@@ -40,7 +40,7 @@ fun test_4(y: Any) {
x as Int
x.inc()
x = y
- x.inc()
+ x.inc()
if (y is A) {
x.foo()
y.foo()
diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/thisAssignment.fir.txt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/thisAssignment.fir.txt
new file mode 100644
index 00000000000..7b4d98deb9d
--- /dev/null
+++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/thisAssignment.fir.txt
@@ -0,0 +1,14 @@
+FILE: thisAssignment.kt
+ public abstract interface A : R|kotlin/Any| {
+ public abstract fun foo(): R|kotlin/Unit|
+
+ }
+ public final fun R|kotlin/Any|.test(): R|kotlin/Unit| {
+ when () {
+ (this@R|/test| is R|A|) -> {
+ lval a: R|kotlin/Any| = this@R|/test|
+ R|/a|.R|/A.foo|()
+ }
+ }
+
+ }
diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/thisAssignment.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/thisAssignment.kt
new file mode 100644
index 00000000000..9ead2245296
--- /dev/null
+++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/thisAssignment.kt
@@ -0,0 +1,12 @@
+interface A {
+ fun foo()
+}
+
+fun Any.test() {
+ if (this is A) {
+ val a = this
+ a.foo()
+ }
+}
+
+
diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/casts.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/casts.kt
index dfb08e48fb6..b8dadae553d 100644
--- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/casts.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/casts.kt
@@ -15,31 +15,31 @@ fun test_3(b: Boolean, x: Any?) {
if (b && x as Boolean) {
x.not()
}
- x.not()
+ x.not()
if (b && x as Boolean == true) {
x.not()
}
- x.not()
+ x.not()
if (b || x as Boolean) {
- x.not()
+ x.not()
}
- x.not()
+ x.not()
}
fun test_4(b: Any) {
if (b as? Boolean != null) {
b.not()
} else {
- b.not()
+ b.not()
}
- b.not()
+ b.not()
if (b as? Boolean == null) {
- b.not()
+ b.not()
} else {
b.not()
}
- b.not()
+ b.not()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/returns.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/returns.kt
index 58f167ec50d..cacf8dcd98e 100644
--- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/returns.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/returns.kt
@@ -36,8 +36,8 @@ fun test_2(x: Any) {
else -> return
}
x.foo()
- x.bar()
- x.baz()
+ x.bar()
+ x.baz()
}
fun test_3(x: Any) {
@@ -45,9 +45,9 @@ fun test_3(x: Any) {
x is B -> x.bar()
x is C -> x.baz()
}
- x.foo()
- x.bar()
- x.baz()
+ x.foo()
+ x.bar()
+ x.baz()
}
fun runHigherOrder(f: () -> T): T = f()
diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/kt37327.fir.txt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/kt37327.fir.txt
index 1aa8f2fa51e..dd498c79d99 100644
--- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/kt37327.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/kt37327.fir.txt
@@ -2,7 +2,7 @@ FILE: kt37327.kt
public abstract interface Q : R|kotlin/Any| {
}
public sealed class A : R|Q| {
- private constructor(): R|A| {
+ protected constructor(): R|A| {
super()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/lambdaInWhenBranch.fir.txt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/lambdaInWhenBranch.fir.txt
index 30d59e0510e..a589aac53c9 100644
--- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/lambdaInWhenBranch.fir.txt
+++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/lambdaInWhenBranch.fir.txt
@@ -1,6 +1,6 @@
FILE: lambdaInWhenBranch.kt
private sealed class Sealed : R|kotlin/Any| {
- private constructor(): R|Sealed| {
+ protected constructor(): R|Sealed| {
super()
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/endlessLoops.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/endlessLoops.kt
index bc94abdb650..1776f00f971 100644
--- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/endlessLoops.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/endlessLoops.kt
@@ -44,7 +44,7 @@ fun test_4(x: Any, b: Boolean) {
}
break
}
- x.foo() // No smartcast
+ x.foo() // No smartcast
}
fun test_5(x: Any, b: Boolean) {
diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/orInWhenBranch.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/orInWhenBranch.kt
index 50a6d0cc510..36f096e22e1 100644
--- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/orInWhenBranch.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/orInWhenBranch.kt
@@ -4,19 +4,19 @@ fun String.foo() {}
fun test_1(a: Any?) {
when (a) {
- is String, is Any -> a.foo() // Should be Bad
+ is String, is Any -> a.foo() // Should be Bad
}
}
fun test_2(a: Any?) {
if (a is String || a is Any) {
- a.foo() // Should be Bad
+ a.foo() // Should be Bad
}
}
fun test_3(a: Any?, b: Boolean) {
when (a) {
- is String, b -> a.foo() // Should be Bad
+ is String, b -> a.foo() // Should be Bad
}
}
diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/implicitReceivers.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/implicitReceivers.kt
index f13a9b24ca5..b1ddb729fcc 100644
--- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/implicitReceivers.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/implicitReceivers.kt
@@ -14,23 +14,23 @@ fun Any?.test_1() {
this.foo()
foo()
} else {
- this.foo()
- foo()
+ this.foo()
+ foo()
}
- this.foo()
- foo()
+ this.foo()
+ foo()
}
fun Any?.test_2() {
if (this !is A) {
- this.foo()
- foo()
+ this.foo()
+ foo()
} else {
this.foo()
foo()
}
- this.foo()
- foo()
+ this.foo()
+ foo()
}
fun test_3(a: Any, b: Any, c: Any) {
@@ -49,13 +49,13 @@ fun test_3(a: Any, b: Any, c: Any) {
fun Any?.test_4() {
if (this !is A) {
- this.foo()
- foo()
- this.bar()
- bar()
+ this.foo()
+ foo()
+ this.bar()
+ bar()
} else if (this !is B) {
- this.bar()
- bar()
+ this.bar()
+ bar()
this.foo()
foo()
} else {
@@ -64,10 +64,10 @@ fun Any?.test_4() {
this.bar()
bar()
}
- this.foo()
- foo()
- this.bar()
- bar()
+ this.foo()
+ foo()
+ this.bar()
+ bar()
}
fun Any.test_5(): Int = when {
diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.kt
index 83a74410769..3c681bde320 100644
--- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.kt
+++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.kt
@@ -22,7 +22,7 @@ fun test_3(x: Any) {
(x as? A)?.bar(x)?.foo(x.bool())?.let {
x.bool()
}
- x.bool()
+ x.bool()
}
fun test_4(x: A?) {
diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToTypeParameter.fir.txt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToTypeParameter.fir.txt
new file mode 100644
index 00000000000..bd24dd43109
--- /dev/null
+++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToTypeParameter.fir.txt
@@ -0,0 +1,43 @@
+FILE: smartcastToTypeParameter.kt
+ public abstract interface FirTypeScope : R|kotlin/Any| {
+ }
+ public abstract interface AbstractFirBasedSymbol|, R|FirDeclaration|> : R|kotlin/Any| {
+ public abstract val fir: R|E|
+ public get(): R|E|
+
+ }
+ public abstract interface FirCallableSymbol|> : R|AbstractFirBasedSymbol| {
+ }
+ public abstract interface FirElement : R|kotlin/Any| {
+ }
+ public abstract interface FirSymbolOwner|, R|FirDeclaration|> : R|FirElement| {
+ public abstract val symbol: R|AbstractFirBasedSymbol|
+ public get(): R|AbstractFirBasedSymbol|
+
+ }
+ public abstract interface FirDeclaration : R|FirElement| {
+ }
+ public abstract interface FirCallableDeclaration|> : R|FirDeclaration|, R|FirSymbolOwner| {
+ }
+ public abstract interface FirCallableMemberDeclaration|> : R|FirCallableDeclaration| {
+ }
+ private final inline fun |> computeBaseSymbols(symbol: R|S|, basedSymbol: R|S|, directOverridden: R|FirTypeScope.(S) -> kotlin/collections/List|): R|kotlin/Unit| {
+ }
+ public final fun R|FirCallableSymbol<*>|.dispatchReceiverClassOrNull(): R|kotlin/Boolean?| {
+ ^dispatchReceiverClassOrNull Boolean(true)
+ }
+ private final inline fun |, reified S : R|FirCallableSymbol|> createFakeOverriddenIfNeeded(originalSymbol: R|FirCallableSymbol<*>|, basedSymbol: R|S|, computeDirectOverridden: R|FirTypeScope.(S) -> kotlin/collections/List|, someCondition: R|kotlin/Boolean|): R|kotlin/Unit| {
+ when () {
+ (R|/originalSymbol| !is R|S|) -> {
+ ^createFakeOverriddenIfNeeded Unit
+ }
+ }
+
+ when () {
+ ==(R|/originalSymbol|.R|/dispatchReceiverClassOrNull|(), Boolean(true)) && R|/someCondition| -> {
+ ^createFakeOverriddenIfNeeded Unit
+ }
+ }
+
+ R|/computeBaseSymbols|(R|/originalSymbol|, R|/basedSymbol|, R|/computeDirectOverridden|)
+ }
diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToTypeParameter.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToTypeParameter.kt
new file mode 100644
index 00000000000..47e65b2328e
--- /dev/null
+++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToTypeParameter.kt
@@ -0,0 +1,34 @@
+interface FirTypeScope
+
+interface AbstractFirBasedSymbol where E : FirSymbolOwner, E : FirDeclaration {
+ val fir: E
+}
+
+interface FirCallableSymbol> : AbstractFirBasedSymbol
+
+interface FirElement
+interface FirSymbolOwner : FirElement where E : FirSymbolOwner, E : FirDeclaration {
+ val symbol: AbstractFirBasedSymbol
+}
+interface FirDeclaration : FirElement
+interface FirCallableDeclaration> : FirDeclaration, FirSymbolOwner
+interface FirCallableMemberDeclaration> : FirCallableDeclaration
+
+private inline fun > computeBaseSymbols(
+ symbol: S,
+ basedSymbol: S,
+ directOverridden: FirTypeScope.(S) -> List
+) {}
+
+fun FirCallableSymbol<*>.dispatchReceiverClassOrNull(): Boolean? = true
+
+private inline fun , reified S : FirCallableSymbol> createFakeOverriddenIfNeeded(
+ originalSymbol: FirCallableSymbol<*>,
+ basedSymbol: S,
+ computeDirectOverridden: FirTypeScope.(S) -> List