Merge Kotlin build-1.5.0-dev-1282 with K/N (6b8547b8f93adb)


Straighten Char-to-code and Char-to-digit conversions out #KT-23451
Kotlin/Native base commit: 6b8547b8f93adb49447d6583d3d9934acd1b0922
This commit is contained in:
Nikolay Krasko
2021-01-12 16:10:02 +03:00
1178 changed files with 10285 additions and 2536 deletions
+4 -4
View File
@@ -2387,7 +2387,7 @@
## Recent ChangeLogs: ## Recent ChangeLogs:
### [ChangeLog-1.3.X](ChangeLog-1.3.X.md) ### [ChangeLog-1.3.X](docs/changelogs/ChangeLog-1.3.X.md)
### [ChangeLog-1.2.X](ChangeLog-1.2.X.md) ### [ChangeLog-1.2.X](docs/changelogs/ChangeLog-1.2.X.md)
### [ChangeLog-1.1.X](ChangeLog-1.1.X.md) ### [ChangeLog-1.1.X](docs/changelogs/ChangeLog-1.1.X.md)
### [ChangeLog-1.0.X](ChangeLog-1.0.X.md) ### [ChangeLog-1.0.X](docs/changelogs/ChangeLog-1.0.X.md)
+1
View File
@@ -2,6 +2,7 @@
[![TeamCity (simple build status)](https://img.shields.io/teamcity/http/teamcity.jetbrains.com/s/Kotlin_KotlinPublic_Compiler.svg)](https://teamcity.jetbrains.com/buildConfiguration/Kotlin_KotlinPublic_Compiler?branch=%3Cdefault%3E&buildTypeTab=overview&mode=builds) [![TeamCity (simple build status)](https://img.shields.io/teamcity/http/teamcity.jetbrains.com/s/Kotlin_KotlinPublic_Compiler.svg)](https://teamcity.jetbrains.com/buildConfiguration/Kotlin_KotlinPublic_Compiler?branch=%3Cdefault%3E&buildTypeTab=overview&mode=builds)
[![Maven Central](https://img.shields.io/maven-central/v/org.jetbrains.kotlin/kotlin-maven-plugin.svg)](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.jetbrains.kotlin%22) [![Maven Central](https://img.shields.io/maven-central/v/org.jetbrains.kotlin/kotlin-maven-plugin.svg)](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.jetbrains.kotlin%22)
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0) [![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0)
[![Revved up by Gradle Enterprise](https://img.shields.io/badge/Revved%20up%20by-Gradle%20Enterprise-06A0CE?logo=Gradle&labelColor=02303A)](https://ge.jetbrains.com/scans?search.rootProjectNames=Kotlin)
# Kotlin Programming Language # Kotlin Programming Language
@@ -32,6 +32,7 @@ import org.jetbrains.kotlin.name.parentOrNull
import org.jetbrains.kotlin.serialization.SerializerExtensionProtocol import org.jetbrains.kotlin.serialization.SerializerExtensionProtocol
import org.jetbrains.kotlin.serialization.deserialization.getClassId import org.jetbrains.kotlin.serialization.deserialization.getClassId
import org.jetbrains.kotlin.serialization.js.JsSerializerProtocol import org.jetbrains.kotlin.serialization.js.JsSerializerProtocol
import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly
import java.io.DataInput import java.io.DataInput
import java.io.DataOutput import java.io.DataOutput
import java.io.File import java.io.File
@@ -326,7 +327,7 @@ private class ProtoDataProvider(private val serializerProtocol: SerializerExtens
proto.`package`.apply { proto.`package`.apply {
val packageNameId = getExtensionOrNull(serializerProtocol.packageFqName) val packageNameId = getExtensionOrNull(serializerProtocol.packageFqName)
val packageFqName = packageNameId?.let { FqName(nameResolver.getPackageFqName(it)) } ?: FqName.ROOT val packageFqName = packageNameId?.let { FqName(nameResolver.getPackageFqName(it)) } ?: FqName.ROOT
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalize() + "Kt")) val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalizeAsciiOnly() + "Kt"))
classes[packagePartClassId] = PackagePartProtoData(this, nameResolver, packageFqName) classes[packagePartClassId] = PackagePartProtoData(this, nameResolver, packageFqName)
} }
@@ -347,7 +348,7 @@ fun getProtoData(sourceFile: File, metadata: ByteArray): Map<ClassId, ProtoData>
proto.`package`.apply { proto.`package`.apply {
val packageFqName = getExtensionOrNull(JsProtoBuf.packageFqName)?.let(nameResolver::getPackageFqName)?.let(::FqName) ?: FqName.ROOT val packageFqName = getExtensionOrNull(JsProtoBuf.packageFqName)?.let(nameResolver::getPackageFqName)?.let(::FqName) ?: FqName.ROOT
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalize() + "Kt")) val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalizeAsciiOnly() + "Kt"))
classes[packagePartClassId] = PackagePartProtoData(this, nameResolver, packageFqName) classes[packagePartClassId] = PackagePartProtoData(this, nameResolver, packageFqName)
} }
-1
View File
@@ -445,7 +445,6 @@ allprojects {
if (useJvmIrBackend) { if (useJvmIrBackend) {
useIR = true useIR = true
freeCompilerArgs += "-Xir-binary-with-stable-abi"
} }
} }
} }
+6 -2
View File
@@ -101,8 +101,12 @@ fun MutableCollection<JdkId>.discoverJdks(project: Project) {
} }
} }
private val macOsJavaHomeOutRegexes = listOf(Regex("""\s+(\S+),\s+(\S+):\s+".*?"\s+(.+)"""), private val macOsJavaHomeOutRegexes =
Regex("""\s+(\S+)\s+\((.*?)\):\s+(.+)""")) listOf(
Regex("""\s+(\S+),\s+(\S+):\s+".*?"\s+(.+)"""),
Regex("""\s+(\S+)\s+\((.*?)\):\s+(.+)"""),
Regex("""\s+(\S+)\s+\((.*?)\)\s+"[^"]*"\s+-\s+"[^"]*"\s(.+)""")
)
fun MutableCollection<JdkId>.discoverJdksOnMacOS(project: Project) { fun MutableCollection<JdkId>.discoverJdksOnMacOS(project: Project) {
val procBuilder = ProcessBuilder("/usr/libexec/java_home", "-V").redirectErrorStream(true) val procBuilder = ProcessBuilder("/usr/libexec/java_home", "-V").redirectErrorStream(true)
@@ -33,6 +33,7 @@ import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.name.Name; import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.resolve.AnnotationChecker; import org.jetbrains.kotlin.resolve.AnnotationChecker;
import org.jetbrains.kotlin.resolve.DescriptorUtils; import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.InlineClassesUtilsKt;
import org.jetbrains.kotlin.resolve.checkers.ExpectedActualDeclarationChecker; import org.jetbrains.kotlin.resolve.checkers.ExpectedActualDeclarationChecker;
import org.jetbrains.kotlin.resolve.constants.*; import org.jetbrains.kotlin.resolve.constants.*;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt; import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
@@ -497,6 +498,9 @@ public abstract class AnnotationCodegen {
public Void visitKClassValue(KClassValue value, Void data) { public Void visitKClassValue(KClassValue value, Void data) {
KotlinType classType = value.getArgumentType(module); KotlinType classType = value.getArgumentType(module);
innerClassConsumer.addInnerClassInfoFromAnnotation(DescriptorUtils.getClassDescriptorForType(classType)); innerClassConsumer.addInnerClassInfoFromAnnotation(DescriptorUtils.getClassDescriptorForType(classType));
if (InlineClassesUtilsKt.isInlineClassType(classType)) {
classType = TypeUtils.makeNullable(classType);
}
annotationVisitor.visit(name, typeMapper.mapType(classType)); annotationVisitor.visit(name, typeMapper.mapType(classType));
return null; return null;
} }
@@ -17,11 +17,10 @@
package org.jetbrains.kotlin.codegen.intrinsics; package org.jetbrains.kotlin.codegen.intrinsics;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import kotlin.text.StringsKt;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.builtins.StandardNames;
import org.jetbrains.kotlin.builtins.PrimitiveType; import org.jetbrains.kotlin.builtins.PrimitiveType;
import org.jetbrains.kotlin.builtins.StandardNames;
import org.jetbrains.kotlin.codegen.AsmUtil; import org.jetbrains.kotlin.codegen.AsmUtil;
import org.jetbrains.kotlin.config.JvmTarget; import org.jetbrains.kotlin.config.JvmTarget;
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor; import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor;
@@ -30,6 +29,7 @@ import org.jetbrains.kotlin.name.FqNameUnsafe;
import org.jetbrains.kotlin.name.Name; import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType; import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType;
import org.jetbrains.kotlin.types.expressions.OperatorConventions; import org.jetbrains.kotlin.types.expressions.OperatorConventions;
import org.jetbrains.kotlin.util.capitalizeDecapitalize.CapitalizeDecapitalizeKt;
import org.jetbrains.org.objectweb.asm.Type; import org.jetbrains.org.objectweb.asm.Type;
import static org.jetbrains.kotlin.builtins.StandardNames.*; import static org.jetbrains.kotlin.builtins.StandardNames.*;
@@ -122,7 +122,9 @@ public class IntrinsicMethods {
declareIntrinsicFunction(typeFqName, "toString", 0, TO_STRING); declareIntrinsicFunction(typeFqName, "toString", 0, TO_STRING);
intrinsicsMap.registerIntrinsic( intrinsicsMap.registerIntrinsic(
BUILT_INS_PACKAGE_FQ_NAME, null, StringsKt.decapitalize(type.getArrayTypeName().asString()) + "Of", 1, new ArrayOf() BUILT_INS_PACKAGE_FQ_NAME, null,
CapitalizeDecapitalizeKt.decapitalizeAsciiOnly(type.getArrayTypeName().asString()) + "Of",
1, new ArrayOf()
); );
} }
@@ -108,7 +108,7 @@ class GenerationState private constructor(
fun wantsDiagnostics(v: Boolean) = fun wantsDiagnostics(v: Boolean) =
apply { wantsDiagnostics = v } apply { wantsDiagnostics = v }
var jvmBackendClassResolver: JvmBackendClassResolver = JvmBackendClassResolverForModuleWithDependencies(module); private set private var jvmBackendClassResolver: JvmBackendClassResolver = JvmBackendClassResolverForModuleWithDependencies(module)
fun jvmBackendClassResolver(v: JvmBackendClassResolver) = fun jvmBackendClassResolver(v: JvmBackendClassResolver) =
apply { jvmBackendClassResolver = v } apply { jvmBackendClassResolver = v }
@@ -153,8 +153,10 @@ class GenerationState private constructor(
val deserializationConfiguration: DeserializationConfiguration = val deserializationConfiguration: DeserializationConfiguration =
CompilerDeserializationConfiguration(configuration.languageVersionSettings) CompilerDeserializationConfiguration(configuration.languageVersionSettings)
val deprecationProvider = val deprecationProvider = DeprecationResolver(
DeprecationResolver(LockBasedStorageManager.NO_LOCKS, configuration.languageVersionSettings, CoroutineCompatibilitySupport.ENABLED, JavaDeprecationSettings) LockBasedStorageManager.NO_LOCKS, configuration.languageVersionSettings, CoroutineCompatibilitySupport.ENABLED,
JavaDeprecationSettings
)
init { init {
val icComponents = configuration.get(JVMConfigurationKeys.INCREMENTAL_COMPILATION_COMPONENTS) val icComponents = configuration.get(JVMConfigurationKeys.INCREMENTAL_COMPILATION_COMPONENTS)
@@ -250,6 +252,7 @@ class GenerationState private constructor(
class ForScript { class ForScript {
// quite a mess, this one is an input from repl interpreter // quite a mess, this one is an input from repl interpreter
var earlierScriptsForReplInterpreter: List<ScriptDescriptor>? = null var earlierScriptsForReplInterpreter: List<ScriptDescriptor>? = null
// and the rest is an output from the codegen // and the rest is an output from the codegen
var resultFieldName: String? = null var resultFieldName: String? = null
var resultTypeString: String? = null var resultTypeString: String? = null
@@ -346,7 +349,7 @@ class GenerationState private constructor(
fun beforeCompile() { fun beforeCompile() {
markUsed() markUsed()
if (!isIrBackend || languageVersionSettings.getFlag(JvmAnalysisFlags.irCheckLocalNames)) { if (!isIrBackend) {
CodegenBinding.initTrace(this) CodegenBinding.initTrace(this)
} }
} }
@@ -88,12 +88,6 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
@Argument(value = "-Xno-use-ir", description = "Do not use the IR backend. Useful for a custom-built compiler where IR backend is enabled by default") @Argument(value = "-Xno-use-ir", description = "Do not use the IR backend. Useful for a custom-built compiler where IR backend is enabled by default")
var noUseIR: Boolean by FreezableVar(false) var noUseIR: Boolean by FreezableVar(false)
@Argument(
value = "-Xir-check-local-names",
description = "Check that names of local classes and anonymous objects are the same in the IR backend as in the old backend"
)
var irCheckLocalNames: Boolean by FreezableVar(false)
@Argument( @Argument(
value = "-Xallow-unstable-dependencies", value = "-Xallow-unstable-dependencies",
description = "Do not report errors on classes in dependencies, which were compiled by an unstable version of the Kotlin compiler" description = "Do not report errors on classes in dependencies, which were compiled by an unstable version of the Kotlin compiler"
@@ -314,6 +308,13 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
) )
var jvmDefault: String by FreezableVar(JvmDefaultMode.DEFAULT.description) var jvmDefault: String by FreezableVar(JvmDefaultMode.DEFAULT.description)
@Argument(
value = "-Xdefault-script-extension",
valueDescription = "<script filename extension>",
description = "Compile expressions and unrecognized scripts passed with the -script argument as scripts with given filename extension"
)
var defaultScriptExtension: String? by FreezableVar(null)
@Argument(value = "-Xdisable-standard-script", description = "Disable standard kotlin script support") @Argument(value = "-Xdisable-standard-script", description = "Disable standard kotlin script support")
var disableStandardScript: Boolean by FreezableVar(false) var disableStandardScript: Boolean by FreezableVar(false)
@@ -446,7 +447,6 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
result[JvmAnalysisFlags.inheritMultifileParts] = inheritMultifileParts result[JvmAnalysisFlags.inheritMultifileParts] = inheritMultifileParts
result[JvmAnalysisFlags.sanitizeParentheses] = sanitizeParentheses result[JvmAnalysisFlags.sanitizeParentheses] = sanitizeParentheses
result[JvmAnalysisFlags.suppressMissingBuiltinsError] = suppressMissingBuiltinsError result[JvmAnalysisFlags.suppressMissingBuiltinsError] = suppressMissingBuiltinsError
result[JvmAnalysisFlags.irCheckLocalNames] = irCheckLocalNames
result[JvmAnalysisFlags.enableJvmPreview] = enableJvmPreview result[JvmAnalysisFlags.enableJvmPreview] = enableJvmPreview
result[AnalysisFlags.allowUnstableDependencies] = allowUnstableDependencies || useFir result[AnalysisFlags.allowUnstableDependencies] = allowUnstableDependencies || useFir
result[JvmAnalysisFlags.disableUltraLightClasses] = disableUltraLightClasses result[JvmAnalysisFlags.disableUltraLightClasses] = disableUltraLightClasses
@@ -34,22 +34,36 @@ object Main {
KOTLIN_HOME = File(home) KOTLIN_HOME = File(home)
} }
enum class HowToRun(val argName: String) {
GUESS("guess"),
CLASSFILE("classfile"),
JAR("jar"),
SCRIPT("script");
// TODO: consider implementing REPL as well
companion object {
val validValues = "${GUESS.argName} (default), ${CLASSFILE.argName}, ${JAR.argName}, ${SCRIPT.argName} (or .<script filename extension>)"
fun fromArg(name: String): HowToRun? =
HowToRun.values().find { it.argName == name }
}
}
private fun run(args: Array<String>) { private fun run(args: Array<String>) {
val classpath = arrayListOf<URL>() val classpath = arrayListOf<URL>()
val compilerClasspath = arrayListOf<URL>() val compilerClasspath = arrayListOf<URL>()
var runner: Runner? = null var runner: Runner? = null
var collectingArguments = false
var collectingExpressions = false
var needsCompiler = false
val arguments = arrayListOf<String>() val arguments = arrayListOf<String>()
var expression: String? = null val compilerArguments = arrayListOf<String>()
var noStdLib = false
var noReflect = false var noReflect = false
var howtorun = HowToRun.GUESS
fun setExpression(expr: String) { fun setRunner(newRunner: Runner) {
if (expression == null) { if (runner == null) {
expression = expr runner = newRunner
} else { } else {
throw RunnerException("Only single -e/-expression argument supported") throw AssertionError("conflicting runner settings")
} }
} }
@@ -64,20 +78,8 @@ object Main {
return args[i] return args[i]
} }
if (collectingExpressions) { fun restAsArguments() {
if ("-expression" == arg || "-e" == arg) { arguments.addAll(args.copyOfRange(i+1, args.size))
setExpression(next())
i++
continue
} else {
collectingArguments = true
}
}
if (collectingArguments) {
arguments.add(arg)
i++
continue
} }
if ("-help" == arg || "-h" == arg) { if ("-help" == arg || "-h" == arg) {
@@ -96,29 +98,55 @@ object Main {
compilerClasspath.addPath(path) compilerClasspath.addPath(path)
} }
} }
else if ("-howtorun" == arg) {
if (howtorun != HowToRun.GUESS) {
throw RunnerException("-howtorun is already set to ${howtorun.argName}")
}
val howToRunArg = next()
if (howToRunArg.startsWith(".")) {
howtorun = HowToRun.SCRIPT
compilerArguments.add("-Xdefault-script-extension=$howToRunArg")
} else {
howtorun = HowToRun.fromArg(howToRunArg)
?: throw RunnerException("invalid argument to the option -howtorun $howToRunArg, valid arguments are: ${HowToRun.validValues}")
}
}
else if ("-expression" == arg || "-e" == arg) { else if ("-expression" == arg || "-e" == arg) {
setExpression(next()) if (howtorun != HowToRun.GUESS && howtorun != HowToRun.SCRIPT) {
collectingExpressions = true throw RunnerException("expression evaluation is not compatible with -howtorun argument ${howtorun.argName}")
needsCompiler = true }
setRunner(ExpressionRunner(next()))
restAsArguments()
break
}
else if ("-no-stdlib" == arg) {
noStdLib = true
compilerArguments.add(arg)
} }
else if ("-no-reflect" == arg) { else if ("-no-reflect" == arg) {
noReflect = true noReflect = true
compilerArguments.add(arg)
}
else if (arg.startsWith("-X")) {
compilerArguments.add(arg)
} }
else if (arg.startsWith("-")) { else if (arg.startsWith("-")) {
throw RunnerException("unsupported argument: $arg") throw RunnerException("unknown option: $arg")
} }
else if (arg.endsWith(".jar")) { else if (howtorun == HowToRun.JAR || (howtorun == HowToRun.GUESS && arg.endsWith(".jar"))) {
runner = JarRunner(arg) setRunner(JarRunner(arg))
collectingArguments = true restAsArguments()
break
} }
else if (arg.endsWith(".kts")) { else if (howtorun == HowToRun.SCRIPT || (howtorun == HowToRun.GUESS && arg.endsWith(".kts"))) {
runner = ScriptRunner(arg) setRunner(ScriptRunner(arg))
collectingArguments = true restAsArguments()
needsCompiler = true break
} }
else { else {
runner = MainClassRunner(arg) setRunner(MainClassRunner(arg))
collectingArguments = true restAsArguments()
break
} }
i++ i++
} }
@@ -127,26 +155,25 @@ object Main {
classpath.addPath(".") classpath.addPath(".")
} }
classpath.addPath("$KOTLIN_HOME/lib/kotlin-stdlib.jar") if (!noStdLib) {
classpath.addPath("$KOTLIN_HOME/lib/kotlin-stdlib.jar")
}
if (!noReflect) { if (!noReflect) {
classpath.addPath("$KOTLIN_HOME/lib/kotlin-reflect.jar") classpath.addPath("$KOTLIN_HOME/lib/kotlin-reflect.jar")
} }
if (expression != null) { if (runner == null) {
runner = ExpressionRunner(expression!!) setRunner(ReplRunner())
} else if (runner == null) {
runner = ReplRunner()
needsCompiler = true
} }
if (needsCompiler && compilerClasspath.isEmpty()) { if (runner is RunnerWithCompiler && compilerClasspath.isEmpty()) {
findCompilerJar(this::class.java, KOTLIN_HOME.resolve("lib")).forEach { findCompilerJar(this::class.java, KOTLIN_HOME.resolve("lib")).forEach {
compilerClasspath.add(it.absoluteFile.toURI().toURL()) compilerClasspath.add(it.absoluteFile.toURI().toURL())
} }
} }
runner.run(classpath, arguments, compilerClasspath) runner!!.run(classpath, compilerArguments, arguments, compilerClasspath)
} }
private fun MutableList<URL>.addPath(path: String) { private fun MutableList<URL>.addPath(path: String) {
@@ -167,21 +194,31 @@ object Main {
private fun printUsageAndExit() { private fun printUsageAndExit() {
println("""kotlin: run Kotlin programs, scripts or REPL. println("""kotlin: run Kotlin programs, scripts or REPL.
Usage: kotlin <options> <command> <arguments> Usage: kotlin <options> <command> [<arguments>]
where command may be one of: where possible options include:
foo.Bar Runs the 'main' function from the class with the given qualified name -howtorun <value> How to run the supplied command with arguments,
app.jar Runs the given JAR file as 'java -jar' would do valid values: ${HowToRun.validValues}
(-classpath argument is ignored and no Kotlin runtime is added to the classpath)
""" +
// script.kts Compiles and runs the given script
// -expression (-e) '2+2' Evaluates the expression and prints the result
"""and possible options include:
-classpath (-cp) <path> Paths where to find user class files -classpath (-cp) <path> Paths where to find user class files
-Dname=value Set a system JVM property -Dname=value Set a system JVM property
-J<option> Pass an option directly to JVM -J<option> Pass an option directly to JVM
-no-stdlib Don't include Kotlin standard library into classpath
-no-reflect Don't include Kotlin reflection implementation into classpath -no-reflect Don't include Kotlin reflection implementation into classpath
-compiler-path Kotlin compiler classpath for compiling script or expression or running REPL
If not specified, try to find the compiler in the environment
-X<flag>[=value] Pass -X argument to the compiler
-version Display Kotlin version -version Display Kotlin version
-help (-h) Print a synopsis of options -help (-h) Print a synopsis of options
and command is interpreted according to the -howtorun option argument
or, in case of guess, according to the following rules:
foo.Bar Runs the 'main' function from the class with the given qualified name
(compiler arguments are ignored)
app.jar Runs the given JAR file as 'java -jar' would do
(compiler arguments are ignored and no Kotlin stdlib is added to the classpath)
script.kts Compiles and runs the given script, passing <arguments> to it
-expression (-e) '2+2' Evaluates the expression and prints the result, passing <arguments> to it
<no command> Runs Kotlin REPL
arguments are passed to the main function when running class or jar file, and for standard script definitions
as the 'args' parameter when running script or expression
""") """)
exitProcess(0) exitProcess(0)
} }
@@ -21,6 +21,7 @@ import java.net.URL
interface Runner { interface Runner {
fun run( fun run(
classpath: List<URL>, classpath: List<URL>,
compilerArguments: List<String>,
arguments: List<String>, arguments: List<String>,
compilerClasspath: List<URL> compilerClasspath: List<URL>
) )
@@ -32,7 +32,7 @@ abstract class AbstractRunner : Runner {
protected abstract fun createClassLoader(classpath: List<URL>): ClassLoader protected abstract fun createClassLoader(classpath: List<URL>): ClassLoader
override fun run(classpath: List<URL>, arguments: List<String>, compilerClasspath: List<URL>) { override fun run(classpath: List<URL>, compilerArguments: List<String>, arguments: List<String>, compilerClasspath: List<URL>) {
val classLoader = createClassLoader(classpath) val classLoader = createClassLoader(classpath)
val mainClass = try { val mainClass = try {
@@ -127,39 +127,45 @@ private fun MutableList<String>.addClasspathArgIfNeeded(classpath: List<URL>) {
} }
} }
private fun ArrayList<String>.addScriptArguments(arguments: List<String>) {
if (arguments.isNotEmpty() && arguments.first() != "--") {
add("--")
}
addAll(arguments)
}
class ReplRunner : RunnerWithCompiler() { class ReplRunner : RunnerWithCompiler() {
override fun run(classpath: List<URL>, arguments: List<String>, compilerClasspath: List<URL>) { override fun run(classpath: List<URL>, compilerArguments: List<String>, arguments: List<String>, compilerClasspath: List<URL>) {
val compilerArgs = ArrayList<String>() val compilerArgs = ArrayList<String>().apply {
compilerArgs.addClasspathArgIfNeeded(classpath) addClasspathArgIfNeeded(classpath)
addAll(compilerArguments)
addScriptArguments(arguments)
}
runCompiler(compilerClasspath, compilerArgs) runCompiler(compilerClasspath, compilerArgs)
} }
} }
class ScriptRunner(private val path: String) : RunnerWithCompiler() { class ScriptRunner(private val path: String) : RunnerWithCompiler() {
override fun run(classpath: List<URL>, arguments: List<String>, compilerClasspath: List<URL>) { override fun run(classpath: List<URL>, compilerArguments: List<String>, arguments: List<String>, compilerClasspath: List<URL>) {
val compilerArgs = ArrayList<String>().apply { val compilerArgs = ArrayList<String>().apply {
addClasspathArgIfNeeded(classpath) addClasspathArgIfNeeded(classpath)
addAll(compilerArguments)
add("-script") add("-script")
add(path) add(path)
if (arguments.isNotEmpty() && arguments.first() != "--") { addScriptArguments(arguments)
add("--")
}
addAll(arguments)
} }
runCompiler(compilerClasspath, compilerArgs) runCompiler(compilerClasspath, compilerArgs)
} }
} }
class ExpressionRunner(private val code: String) : RunnerWithCompiler() { class ExpressionRunner(private val code: String) : RunnerWithCompiler() {
override fun run(classpath: List<URL>, arguments: List<String>, compilerClasspath: List<URL>) { override fun run(classpath: List<URL>, compilerArguments: List<String>, arguments: List<String>, compilerClasspath: List<URL>) {
val compilerArgs = ArrayList<String>().apply { val compilerArgs = ArrayList<String>().apply {
addClasspathArgIfNeeded(classpath) addClasspathArgIfNeeded(classpath)
addAll(compilerArguments)
add("-expression") add("-expression")
add(code) add(code)
if (arguments.isNotEmpty() && arguments.first() != "--") { addScriptArguments(arguments)
add("--")
}
addAll(arguments)
} }
runCompiler(compilerClasspath, compilerArgs) runCompiler(compilerClasspath, compilerArgs)
} }
@@ -23,6 +23,7 @@ import org.fusesource.jansi.Ansi;
import org.fusesource.jansi.internal.CLibrary; import org.fusesource.jansi.internal.CLibrary;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.util.capitalizeDecapitalize.CapitalizeDecapitalizeKt;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.Set; import java.util.Set;
@@ -130,7 +131,7 @@ public abstract class PlainTextMessageRenderer implements MessageRenderer {
return message; return message;
} }
return StringsKt.decapitalize(message); return CapitalizeDecapitalizeKt.decapitalizeAsciiOnly(message);
} }
@NotNull @NotNull
@@ -30,6 +30,7 @@ import org.xml.sax.SAXException
import org.xml.sax.helpers.DefaultHandler import org.xml.sax.helpers.DefaultHandler
import java.io.IOException import java.io.IOException
import java.io.Reader import java.io.Reader
import java.util.*
import javax.xml.parsers.SAXParserFactory import javax.xml.parsers.SAXParserFactory
object CompilerOutputParser { object CompilerOutputParser {
@@ -124,7 +125,7 @@ object CompilerOutputParser {
// We're directly inside the root tag: <MESSAGES> // We're directly inside the root tag: <MESSAGES>
return return
} }
val qNameLowerCase = qName.toLowerCase() val qNameLowerCase = qName.toLowerCase(Locale.US)
var category: CompilerMessageSeverity? = CATEGORIES[qNameLowerCase] var category: CompilerMessageSeverity? = CATEGORIES[qNameLowerCase]
if (category == null) { if (category == null) {
messageCollector.report(ERROR, "Unknown compiler message tag: $qName") messageCollector.report(ERROR, "Unknown compiler message tag: $qName")
@@ -27,9 +27,6 @@ object JvmAnalysisFlags {
@JvmStatic @JvmStatic
val suppressMissingBuiltinsError by AnalysisFlag.Delegates.Boolean val suppressMissingBuiltinsError by AnalysisFlag.Delegates.Boolean
@JvmStatic
val irCheckLocalNames by AnalysisFlag.Delegates.Boolean
@JvmStatic @JvmStatic
val disableUltraLightClasses by AnalysisFlag.Delegates.Boolean val disableUltraLightClasses by AnalysisFlag.Delegates.Boolean
@@ -16,6 +16,7 @@
package org.jetbrains.kotlin.daemon.common package org.jetbrains.kotlin.daemon.common
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
import java.io.File import java.io.File
enum class OSKind { enum class OSKind {
@@ -25,7 +26,7 @@ enum class OSKind {
Unknown; Unknown;
companion object { companion object {
val current: OSKind = System.getProperty("os.name").toLowerCase().let { val current: OSKind = System.getProperty("os.name").toLowerCaseAsciiOnly().let {
when { when {
// partly taken from http://www.code4copy.com/java/post/detecting-os-type-in-java // partly taken from http://www.code4copy.com/java/post/detecting-os-type-in-java
it.startsWith("windows") -> Windows it.startsWith("windows") -> Windows
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -75,7 +75,7 @@ FILE: RedundantExplicitTypeChecker.kt
public final fun test(boolean: R|kotlin/Boolean|): R|kotlin/Unit| { public final fun test(boolean: R|kotlin/Boolean|): R|kotlin/Unit| {
lval expectedLong: R|kotlin/Long| = when () { lval expectedLong: R|kotlin/Long| = when () {
R|<local>/boolean| -> { R|<local>/boolean| -> {
Int(42) Long(42)
} }
else -> { else -> {
^test Unit ^test Unit
@@ -0,0 +1,17 @@
FILE: SpecialCallsWithLambdas.kt
public final fun foo(): R|kotlin/Unit| {
lval inv: R|() -> kotlin/Function0<kotlin/Unit>| = fun <anonymous>(): R|() -> kotlin/Unit| {
^ fun <anonymous>(): R|kotlin/Unit| {
^ Unit
}
}
!!
lval bar: R|() -> kotlin/Function0<kotlin/Unit>| = fun <anonymous>(): R|() -> kotlin/Unit| {
^ fun <anonymous>(): R|kotlin/Unit| {
^ Unit
}
}
}
@@ -0,0 +1,4 @@
fun foo() {
val inv = {{}}!!
val bar = {{}}
}
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -4889,6 +4889,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/receiverResolutionInLambda.kt"); runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/receiverResolutionInLambda.kt");
} }
@Test
@TestMetadata("SpecialCallsWithLambdas.kt")
public void testSpecialCallsWithLambdas() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/SpecialCallsWithLambdas.kt");
}
@Test @Test
@TestMetadata("TypesEligibleForSimpleVisit.kt") @TestMetadata("TypesEligibleForSimpleVisit.kt")
public void testTypesEligibleForSimpleVisit() throws Exception { public void testTypesEligibleForSimpleVisit() throws Exception {
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -6957,12 +6957,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/delegatedProperty/incompleteTypeInference.kt"); runTest("compiler/testData/diagnostics/tests/delegatedProperty/incompleteTypeInference.kt");
} }
@Test
@TestMetadata("kt37796.kt")
public void testKt37796() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/kt37796.kt");
}
@Test @Test
@TestMetadata("kt4640.kt") @TestMetadata("kt4640.kt")
public void testKt4640() throws Exception { public void testKt4640() throws Exception {
@@ -12426,6 +12420,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/capturedTypeWithTypeVariableSubtyping.kt"); runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/capturedTypeWithTypeVariableSubtyping.kt");
} }
@Test
@TestMetadata("capturedTypesSubstitutionIntoAbbreviation.kt")
public void testCapturedTypesSubstitutionIntoAbbreviation() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/capturedTypesSubstitutionIntoAbbreviation.kt");
}
@Test @Test
@TestMetadata("capturingFromArgumentOfFlexibleType.kt") @TestMetadata("capturingFromArgumentOfFlexibleType.kt")
public void testCapturingFromArgumentOfFlexibleType() throws Exception { public void testCapturingFromArgumentOfFlexibleType() throws Exception {
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol
import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.*
import org.jetbrains.kotlin.fir.visitors.FirVisitor import org.jetbrains.kotlin.fir.visitors.FirVisitor
import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty
open class FirJvmMangleComputer( open class FirJvmMangleComputer(
@@ -210,7 +211,7 @@ open class FirJvmMangleComputer(
is ConeStarProjection -> appendSignature(MangleConstant.STAR_MARK) is ConeStarProjection -> appendSignature(MangleConstant.STAR_MARK)
is ConeKotlinTypeProjection -> { is ConeKotlinTypeProjection -> {
if (arg.kind != ProjectionKind.INVARIANT) { if (arg.kind != ProjectionKind.INVARIANT) {
appendSignature(arg.kind.name.toLowerCase()) appendSignature(arg.kind.name.toLowerCaseAsciiOnly())
appendSignature(MangleConstant.VARIANCE_SEPARATOR) appendSignature(MangleConstant.VARIANCE_SEPARATOR)
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -10030,6 +10030,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/delegatedProperty/delegateWithPrivateSet.kt"); runTest("compiler/testData/codegen/box/delegatedProperty/delegateWithPrivateSet.kt");
} }
@TestMetadata("delegatedPropertyInEnum.kt")
public void testDelegatedPropertyInEnum() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegatedPropertyInEnum.kt");
}
@TestMetadata("extensionDelegatesWithSameNames.kt") @TestMetadata("extensionDelegatesWithSameNames.kt")
public void testExtensionDelegatesWithSameNames() throws Exception { public void testExtensionDelegatesWithSameNames() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/extensionDelegatesWithSameNames.kt"); runTest("compiler/testData/codegen/box/delegatedProperty/extensionDelegatesWithSameNames.kt");
@@ -11072,6 +11077,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/enum/asReturnExpression.kt"); runTest("compiler/testData/codegen/box/enum/asReturnExpression.kt");
} }
@TestMetadata("bigEnum.kt")
public void testBigEnum() throws Exception {
runTest("compiler/testData/codegen/box/enum/bigEnum.kt");
}
@TestMetadata("classForEnumEntry.kt") @TestMetadata("classForEnumEntry.kt")
public void testClassForEnumEntry() throws Exception { public void testClassForEnumEntry() throws Exception {
runTest("compiler/testData/codegen/box/enum/classForEnumEntry.kt"); runTest("compiler/testData/codegen/box/enum/classForEnumEntry.kt");
@@ -11177,6 +11187,21 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/enum/inclassobj.kt"); runTest("compiler/testData/codegen/box/enum/inclassobj.kt");
} }
@TestMetadata("initEntriesInCompanionObject.kt")
public void testInitEntriesInCompanionObject() throws Exception {
runTest("compiler/testData/codegen/box/enum/initEntriesInCompanionObject.kt");
}
@TestMetadata("initEntriesInValueOf.kt")
public void testInitEntriesInValueOf() throws Exception {
runTest("compiler/testData/codegen/box/enum/initEntriesInValueOf.kt");
}
@TestMetadata("initEnumAfterObjectAccess.kt")
public void testInitEnumAfterObjectAccess() throws Exception {
runTest("compiler/testData/codegen/box/enum/initEnumAfterObjectAccess.kt");
}
@TestMetadata("inner.kt") @TestMetadata("inner.kt")
public void testInner() throws Exception { public void testInner() throws Exception {
runTest("compiler/testData/codegen/box/enum/inner.kt"); runTest("compiler/testData/codegen/box/enum/inner.kt");
@@ -13301,6 +13326,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/inference/capturedStarProjection.kt"); runTest("compiler/testData/codegen/box/inference/capturedStarProjection.kt");
} }
@TestMetadata("capturedTypesSubstitutionIntoAbbreviation.kt")
public void testCapturedTypesSubstitutionIntoAbbreviation() throws Exception {
runTest("compiler/testData/codegen/box/inference/capturedTypesSubstitutionIntoAbbreviation.kt");
}
@TestMetadata("coercionToUnitForLambdaReturnTypeWithFlexibleConstraint.kt") @TestMetadata("coercionToUnitForLambdaReturnTypeWithFlexibleConstraint.kt")
public void testCoercionToUnitForLambdaReturnTypeWithFlexibleConstraint() throws Exception { public void testCoercionToUnitForLambdaReturnTypeWithFlexibleConstraint() throws Exception {
runTest("compiler/testData/codegen/box/inference/coercionToUnitForLambdaReturnTypeWithFlexibleConstraint.kt"); runTest("compiler/testData/codegen/box/inference/coercionToUnitForLambdaReturnTypeWithFlexibleConstraint.kt");
@@ -13982,6 +14012,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/inlineClasses/jvmStaticVarInInlineClassCompanion.kt"); runTest("compiler/testData/codegen/box/inlineClasses/jvmStaticVarInInlineClassCompanion.kt");
} }
@TestMetadata("kclassInAnnotation.kt")
public void testKclassInAnnotation() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/kclassInAnnotation.kt");
}
@TestMetadata("kt25246.kt") @TestMetadata("kt25246.kt")
public void testKt25246() throws Exception { public void testKt25246() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/kt25246.kt"); runTest("compiler/testData/codegen/box/inlineClasses/kt25246.kt");
@@ -16235,6 +16270,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
} }
@TestMetadata("ambiguousJavaVararg.kt")
public void testAmbiguousJavaVararg() throws Exception {
runTest("compiler/testData/codegen/box/javaInterop/ambiguousJavaVararg.kt");
}
@TestMetadata("genericSamProjectedOut.kt") @TestMetadata("genericSamProjectedOut.kt")
public void testGenericSamProjectedOut() throws Exception { public void testGenericSamProjectedOut() throws Exception {
runTest("compiler/testData/codegen/box/javaInterop/genericSamProjectedOut.kt"); runTest("compiler/testData/codegen/box/javaInterop/genericSamProjectedOut.kt");
@@ -31078,6 +31118,16 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/strings/javaToStringNPE.kt"); runTest("compiler/testData/codegen/box/strings/javaToStringNPE.kt");
} }
@TestMetadata("kt13213.kt")
public void testKt13213() throws Exception {
runTest("compiler/testData/codegen/box/strings/kt13213.kt");
}
@TestMetadata("kt13213a.kt")
public void testKt13213a() throws Exception {
runTest("compiler/testData/codegen/box/strings/kt13213a.kt");
}
@TestMetadata("kt2592.kt") @TestMetadata("kt2592.kt")
public void testKt2592() throws Exception { public void testKt2592() throws Exception {
runTest("compiler/testData/codegen/box/strings/kt2592.kt"); runTest("compiler/testData/codegen/box/strings/kt2592.kt");
@@ -32363,6 +32413,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/unsignedTypes/kt25784.kt"); runTest("compiler/testData/codegen/box/unsignedTypes/kt25784.kt");
} }
@TestMetadata("kt30402.kt")
public void testKt30402() throws Exception {
runTest("compiler/testData/codegen/box/unsignedTypes/kt30402.kt");
}
@TestMetadata("kt43286.kt") @TestMetadata("kt43286.kt")
public void testKt43286() throws Exception { public void testKt43286() throws Exception {
runTest("compiler/testData/codegen/box/unsignedTypes/kt43286.kt"); runTest("compiler/testData/codegen/box/unsignedTypes/kt43286.kt");
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -2133,6 +2133,24 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn
} }
} }
@TestMetadata("compiler/testData/codegen/boxInline/jvmName")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class JvmName extends AbstractFirBlackBoxInlineCodegenTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: ");
}
public void testAllFilesPresentInJvmName() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/jvmName"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/codegen/boxInline/jvmName/simple.kt");
}
}
@TestMetadata("compiler/testData/codegen/boxInline/jvmPackageName") @TestMetadata("compiler/testData/codegen/boxInline/jvmPackageName")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) @RunWith(JUnit3RunnerWithInners.class)
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1453,6 +1453,11 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest {
runTest("compiler/testData/codegen/bytecodeText/coroutines/effectivelyInlineOnly.kt"); runTest("compiler/testData/codegen/bytecodeText/coroutines/effectivelyInlineOnly.kt");
} }
@TestMetadata("internalInlineSuspend.kt")
public void testInternalInlineSuspend() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/coroutines/internalInlineSuspend.kt");
}
@TestMetadata("mergeLvt.kt") @TestMetadata("mergeLvt.kt")
public void testMergeLvt() throws Exception { public void testMergeLvt() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/coroutines/mergeLvt.kt"); runTest("compiler/testData/codegen/bytecodeText/coroutines/mergeLvt.kt");
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -2246,6 +2246,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
runTest("compiler/testData/ir/irText/types/starProjection_OI.kt"); runTest("compiler/testData/ir/irText/types/starProjection_OI.kt");
} }
@TestMetadata("typeAliasWithUnsafeVariance.kt")
public void testTypeAliasWithUnsafeVariance() throws Exception {
runTest("compiler/testData/ir/irText/types/typeAliasWithUnsafeVariance.kt");
}
@TestMetadata("compiler/testData/ir/irText/types/nullChecks") @TestMetadata("compiler/testData/ir/irText/types/nullChecks")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) @RunWith(JUnit3RunnerWithInners.class)
@@ -178,7 +178,6 @@ class JavaSymbolProvider(
javaTypeParameterStack.addStack(parentStack) javaTypeParameterStack.addStack(parentStack)
} }
} }
val methodMap = mutableMapOf<JavaMethod, FirJavaMethod>()
val firJavaClass = buildJavaClass { val firJavaClass = buildJavaClass {
source = (javaClass as? JavaElementImpl<*>)?.psi?.toFirPsiSourceElement() source = (javaClass as? JavaElementImpl<*>)?.psi?.toFirPsiSourceElement()
session = this@JavaSymbolProvider.session session = this@JavaSymbolProvider.session
@@ -201,7 +200,7 @@ class JavaSymbolProvider(
} }
} }
val dispatchReceiver = classId.defaultType(typeParameters.map { it.symbol } ) val dispatchReceiver = classId.defaultType(typeParameters.map { it.symbol })
status = FirResolvedDeclarationStatusImpl( status = FirResolvedDeclarationStatusImpl(
javaClass.visibility, javaClass.visibility,
@@ -230,9 +229,7 @@ class JavaSymbolProvider(
classIsAnnotation, classIsAnnotation,
valueParametersForAnnotationConstructor, valueParametersForAnnotationConstructor,
dispatchReceiver dispatchReceiver
).apply { )
methodMap[javaMethod] = this
}
} }
val javaClassDeclaredConstructors = javaClass.constructors val javaClassDeclaredConstructors = javaClass.constructors
val constructorId = CallableId(classId.packageFqName, classId.relativeClassName, classId.shortClassName) val constructorId = CallableId(classId.packageFqName, classId.relativeClassName, classId.shortClassName)
@@ -283,10 +280,6 @@ class JavaSymbolProvider(
} }
) )
firJavaClass.addAnnotationsFrom(this@JavaSymbolProvider.session, javaClass, javaTypeParameterStack) firJavaClass.addAnnotationsFrom(this@JavaSymbolProvider.session, javaClass, javaTypeParameterStack)
// NB: this is done here to unbind possible annotation cycle
for ((javaMethod, firJavaMethod) in methodMap) {
firJavaMethod.annotations.addAnnotationsFrom(session, javaMethod, javaTypeParameterStack)
}
return firJavaClass return firJavaClass
} }
@@ -340,7 +333,7 @@ class JavaSymbolProvider(
returnTypeRef = returnType.toFirJavaTypeRef(this@JavaSymbolProvider.session, javaTypeParameterStack) returnTypeRef = returnType.toFirJavaTypeRef(this@JavaSymbolProvider.session, javaTypeParameterStack)
isVar = !javaField.isFinal isVar = !javaField.isFinal
isStatic = javaField.isStatic isStatic = javaField.isStatic
addAnnotationsFrom(this@JavaSymbolProvider.session, javaField, javaTypeParameterStack) annotationBuilder = { javaField.annotations.map { it.toFirAnnotationCall(session, javaTypeParameterStack) } }
initializer = convertJavaInitializerToFir(javaField.initializerValue) initializer = convertJavaInitializerToFir(javaField.initializerValue)
if (!javaField.isStatic) { if (!javaField.isStatic) {
@@ -386,6 +379,7 @@ class JavaSymbolProvider(
this@JavaSymbolProvider.session, index, javaTypeParameterStack, this@JavaSymbolProvider.session, index, javaTypeParameterStack,
) )
} }
annotationBuilder = { javaMethod.annotations.map { it.toFirAnnotationCall(session, javaTypeParameterStack) } }
status = FirResolvedDeclarationStatusImpl( status = FirResolvedDeclarationStatusImpl(
javaMethod.visibility, javaMethod.visibility,
javaMethod.modality javaMethod.modality
@@ -466,12 +460,14 @@ class JavaSymbolProvider(
if (javaConstructor != null) { if (javaConstructor != null) {
this.typeParameters += javaConstructor.typeParameters.convertTypeParameters(javaTypeParameterStack) this.typeParameters += javaConstructor.typeParameters.convertTypeParameters(javaTypeParameterStack)
addAnnotationsFrom(this@JavaSymbolProvider.session, javaConstructor, javaTypeParameterStack) annotationBuilder = { javaConstructor.annotations.map { it.toFirAnnotationCall(session, javaTypeParameterStack) } }
for ((index, valueParameter) in javaConstructor.valueParameters.withIndex()) { for ((index, valueParameter) in javaConstructor.valueParameters.withIndex()) {
valueParameters += valueParameter.toFirValueParameter( valueParameters += valueParameter.toFirValueParameter(
this@JavaSymbolProvider.session, index, javaTypeParameterStack, this@JavaSymbolProvider.session, index, javaTypeParameterStack,
) )
} }
} else {
annotationBuilder = { emptyList() }
} }
}.apply { }.apply {
containingClassAttr = ownerClassBuilder.symbol.toLookupTag() containingClassAttr = ownerClassBuilder.symbol.toLookupTag()
@@ -495,6 +491,7 @@ class JavaSymbolProvider(
visibility = Visibilities.Public visibility = Visibilities.Public
isInner = false isInner = false
isPrimary = true isPrimary = true
annotationBuilder = { emptyList() }
}.apply { }.apply {
containingClassAttr = ownerClassBuilder.symbol.toLookupTag() containingClassAttr = ownerClassBuilder.symbol.toLookupTag()
} }
@@ -47,6 +47,7 @@ import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.Variance.* import org.jetbrains.kotlin.types.Variance.*
import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly
import org.jetbrains.kotlin.utils.addToStdlib.runIf import org.jetbrains.kotlin.utils.addToStdlib.runIf
import java.lang.Deprecated import java.lang.Deprecated
import java.lang.annotation.Documented import java.lang.annotation.Documented
@@ -140,7 +141,7 @@ internal fun JavaType?.toConeKotlinTypeWithoutEnhancement(
val primitiveType = type val primitiveType = type
val kotlinPrimitiveName = when (val javaName = primitiveType?.typeName?.asString()) { val kotlinPrimitiveName = when (val javaName = primitiveType?.typeName?.asString()) {
null -> "Unit" null -> "Unit"
else -> javaName.capitalize() else -> javaName.capitalizeAsciiOnly()
} }
val classId = StandardClassIds.byName(kotlinPrimitiveName) val classId = StandardClassIds.byName(kotlinPrimitiveName)
@@ -194,7 +195,7 @@ private fun JavaArrayType.toConeKotlinTypeWithoutEnhancement(
) )
} }
} else { } else {
val javaComponentName = componentType.type?.typeName?.asString()?.capitalize() ?: error("Array of voids") val javaComponentName = componentType.type?.typeName?.asString()?.capitalizeAsciiOnly() ?: error("Array of voids")
val classId = StandardClassIds.byName(javaComponentName + "Array") val classId = StandardClassIds.byName(javaComponentName + "Array")
if (forAnnotationValueParameter) { if (forAnnotationValueParameter) {
@@ -35,7 +35,7 @@ class FirJavaConstructor @FirImplementationDetail constructor(
override var returnTypeRef: FirTypeRef, override var returnTypeRef: FirTypeRef,
override val valueParameters: MutableList<FirValueParameter>, override val valueParameters: MutableList<FirValueParameter>,
override val typeParameters: MutableList<FirTypeParameterRef>, override val typeParameters: MutableList<FirTypeParameterRef>,
override val annotations: MutableList<FirAnnotationCall>, annotationBuilder: () -> List<FirAnnotationCall>,
override var status: FirDeclarationStatus, override var status: FirDeclarationStatus,
override var resolvePhase: FirResolvePhase, override var resolvePhase: FirResolvePhase,
override val dispatchReceiverType: ConeKotlinType?, override val dispatchReceiverType: ConeKotlinType?,
@@ -59,6 +59,9 @@ class FirJavaConstructor @FirImplementationDetail constructor(
override val controlFlowGraphReference: FirControlFlowGraphReference? get() = null override val controlFlowGraphReference: FirControlFlowGraphReference? get() = null
override val annotations: List<FirAnnotationCall> by lazy { annotationBuilder() }
override fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirJavaConstructor { override fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirJavaConstructor {
valueParameters.transformInplace(transformer, data) valueParameters.transformInplace(transformer, data)
return this return this
@@ -101,7 +104,6 @@ class FirJavaConstructor @FirImplementationDetail constructor(
} }
override fun <D> transformAnnotations(transformer: FirTransformer<D>, data: D): FirJavaConstructor { override fun <D> transformAnnotations(transformer: FirTransformer<D>, data: D): FirJavaConstructor {
annotations.transformInplace(transformer, data)
return this return this
} }
@@ -143,6 +145,7 @@ class FirJavaConstructorBuilder : FirConstructorBuilder() {
lateinit var visibility: Visibility lateinit var visibility: Visibility
var isInner: Boolean by Delegates.notNull() var isInner: Boolean by Delegates.notNull()
var isPrimary: Boolean by Delegates.notNull() var isPrimary: Boolean by Delegates.notNull()
lateinit var annotationBuilder: () -> List<FirAnnotationCall>
@OptIn(FirImplementationDetail::class) @OptIn(FirImplementationDetail::class)
override fun build(): FirJavaConstructor { override fun build(): FirJavaConstructor {
@@ -154,7 +157,7 @@ class FirJavaConstructorBuilder : FirConstructorBuilder() {
returnTypeRef, returnTypeRef,
valueParameters, valueParameters,
typeParameters, typeParameters,
annotations, annotationBuilder,
status, status,
resolvePhase = FirResolvePhase.ANALYZED_DEPENDENCIES, resolvePhase = FirResolvePhase.ANALYZED_DEPENDENCIES,
dispatchReceiverType dispatchReceiverType
@@ -40,7 +40,7 @@ class FirJavaField @FirImplementationDetail constructor(
override var returnTypeRef: FirTypeRef, override var returnTypeRef: FirTypeRef,
override var status: FirDeclarationStatus, override var status: FirDeclarationStatus,
override val isVar: Boolean, override val isVar: Boolean,
override val annotations: MutableList<FirAnnotationCall>, annotationBuilder: () -> List<FirAnnotationCall>,
override val typeParameters: MutableList<FirTypeParameter>, override val typeParameters: MutableList<FirTypeParameter>,
override var initializer: FirExpression?, override var initializer: FirExpression?,
override val dispatchReceiverType: ConeKotlinType?, override val dispatchReceiverType: ConeKotlinType?,
@@ -58,6 +58,9 @@ class FirJavaField @FirImplementationDetail constructor(
override val origin: FirDeclarationOrigin override val origin: FirDeclarationOrigin
get() = FirDeclarationOrigin.Java get() = FirDeclarationOrigin.Java
override val annotations: List<FirAnnotationCall> by lazy { annotationBuilder() }
override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirField { override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirField {
returnTypeRef = returnTypeRef.transformSingle(transformer, data) returnTypeRef = returnTypeRef.transformSingle(transformer, data)
return this return this
@@ -109,7 +112,6 @@ class FirJavaField @FirImplementationDetail constructor(
} }
override fun <D> transformAnnotations(transformer: FirTransformer<D>, data: D): FirJavaField { override fun <D> transformAnnotations(transformer: FirTransformer<D>, data: D): FirJavaField {
annotations.transformInplace(transformer, data)
return this return this
} }
@@ -147,6 +149,7 @@ internal class FirJavaFieldBuilder : FirFieldBuilder() {
lateinit var visibility: Visibility lateinit var visibility: Visibility
var isStatic: Boolean by Delegates.notNull() var isStatic: Boolean by Delegates.notNull()
var initializer: FirExpression? = null var initializer: FirExpression? = null
lateinit var annotationBuilder: () -> List<FirAnnotationCall>
override var resolvePhase: FirResolvePhase = FirResolvePhase.ANALYZED_DEPENDENCIES override var resolvePhase: FirResolvePhase = FirResolvePhase.ANALYZED_DEPENDENCIES
@@ -161,7 +164,7 @@ internal class FirJavaFieldBuilder : FirFieldBuilder() {
returnTypeRef, returnTypeRef,
status, status,
isVar, isVar,
annotations, annotationBuilder,
typeParameters, typeParameters,
initializer, initializer,
dispatchReceiverType, dispatchReceiverType,
@@ -10,17 +10,24 @@ import org.jetbrains.kotlin.descriptors.Visibility
import org.jetbrains.kotlin.fir.FirImplementationDetail import org.jetbrains.kotlin.fir.FirImplementationDetail
import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.fir.FirSourceElement
import org.jetbrains.kotlin.fir.builder.FirAnnotationContainerBuilder
import org.jetbrains.kotlin.fir.builder.FirBuilderDsl import org.jetbrains.kotlin.fir.builder.FirBuilderDsl
import org.jetbrains.kotlin.fir.contracts.FirContractDescription
import org.jetbrains.kotlin.fir.contracts.impl.FirEmptyContractDescription import org.jetbrains.kotlin.fir.contracts.impl.FirEmptyContractDescription
import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.declarations.builder.FirSimpleFunctionBuilder import org.jetbrains.kotlin.fir.declarations.builder.FirFunctionBuilder
import org.jetbrains.kotlin.fir.declarations.impl.FirSimpleFunctionImpl import org.jetbrains.kotlin.fir.declarations.builder.FirTypeParametersOwnerBuilder
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
import org.jetbrains.kotlin.fir.expressions.FirBlock import org.jetbrains.kotlin.fir.expressions.FirBlock
import org.jetbrains.kotlin.fir.references.FirControlFlowGraphReference
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
import org.jetbrains.kotlin.fir.types.ConeKotlinType import org.jetbrains.kotlin.fir.types.ConeKotlinType
import org.jetbrains.kotlin.fir.types.FirTypeRef import org.jetbrains.kotlin.fir.types.FirTypeRef
import org.jetbrains.kotlin.fir.types.jvm.FirJavaTypeRef import org.jetbrains.kotlin.fir.types.jvm.FirJavaTypeRef
import org.jetbrains.kotlin.fir.visitors.FirTransformer
import org.jetbrains.kotlin.fir.visitors.FirVisitor
import org.jetbrains.kotlin.fir.visitors.transformInplace
import org.jetbrains.kotlin.fir.visitors.transformSingle
import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
import org.jetbrains.kotlin.util.OperatorNameConventions.ASSIGNMENT_OPERATIONS import org.jetbrains.kotlin.util.OperatorNameConventions.ASSIGNMENT_OPERATIONS
@@ -40,51 +47,153 @@ import kotlin.properties.Delegates
@OptIn(FirImplementationDetail::class) @OptIn(FirImplementationDetail::class)
class FirJavaMethod @FirImplementationDetail constructor( class FirJavaMethod @FirImplementationDetail constructor(
source: FirSourceElement?, override val source: FirSourceElement?,
session: FirSession, override val session: FirSession,
resolvePhase: FirResolvePhase, override var resolvePhase: FirResolvePhase,
attributes: FirDeclarationAttributes, override val attributes: FirDeclarationAttributes,
returnTypeRef: FirTypeRef, override var returnTypeRef: FirTypeRef,
receiverTypeRef: FirTypeRef?, override val typeParameters: MutableList<FirTypeParameter>,
typeParameters: MutableList<FirTypeParameter>, override val valueParameters: MutableList<FirValueParameter>,
valueParameters: MutableList<FirValueParameter>, override val name: Name,
body: FirBlock?, override var status: FirDeclarationStatus,
name: Name, override val symbol: FirNamedFunctionSymbol,
status: FirDeclarationStatus, annotationBuilder: () -> List<FirAnnotationCall>,
containerSource: DeserializedContainerSource?, override val dispatchReceiverType: ConeKotlinType?,
symbol: FirNamedFunctionSymbol, ) : FirSimpleFunction() {
annotations: MutableList<FirAnnotationCall>, init {
dispatchReceiverType: ConeKotlinType?, symbol.bind(this)
) : FirSimpleFunctionImpl( }
source,
session, override val receiverTypeRef: FirTypeRef?
resolvePhase, get() = null
FirDeclarationOrigin.Java,
attributes, override val body: FirBlock?
returnTypeRef, get() = null
receiverTypeRef,
valueParameters, override val containerSource: DeserializedContainerSource?
body, get() = null
status,
containerSource, override val origin: FirDeclarationOrigin
dispatchReceiverType = dispatchReceiverType, get() = FirDeclarationOrigin.Java
contractDescription = FirEmptyContractDescription,
name, override val contractDescription: FirContractDescription
symbol, get() = FirEmptyContractDescription
annotations,
typeParameters, override var controlFlowGraphReference: FirControlFlowGraphReference? = null
)
override val annotations: List<FirAnnotationCall> by lazy { annotationBuilder() }
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
returnTypeRef.accept(visitor, data)
receiverTypeRef?.accept(visitor, data)
controlFlowGraphReference?.accept(visitor, data)
valueParameters.forEach { it.accept(visitor, data) }
body?.accept(visitor, data)
status.accept(visitor, data)
contractDescription.accept(visitor, data)
annotations.forEach { it.accept(visitor, data) }
typeParameters.forEach { it.accept(visitor, data) }
}
override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirSimpleFunction {
transformReturnTypeRef(transformer, data)
transformReceiverTypeRef(transformer, data)
controlFlowGraphReference = controlFlowGraphReference?.transformSingle(transformer, data)
transformValueParameters(transformer, data)
transformBody(transformer, data)
transformStatus(transformer, data)
transformContractDescription(transformer, data)
transformAnnotations(transformer, data)
transformTypeParameters(transformer, data)
return this
}
override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirSimpleFunction {
returnTypeRef = returnTypeRef.transformSingle(transformer, data)
return this
}
override fun <D> transformReceiverTypeRef(transformer: FirTransformer<D>, data: D): FirSimpleFunction {
return this
}
override fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirSimpleFunction {
valueParameters.transformInplace(transformer, data)
return this
}
override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirSimpleFunction {
return this
}
override fun <D> transformStatus(transformer: FirTransformer<D>, data: D): FirSimpleFunction {
status = status.transformSingle(transformer, data)
return this
}
override fun <D> transformContractDescription(transformer: FirTransformer<D>, data: D): FirSimpleFunction {
return this
}
override fun <D> transformAnnotations(transformer: FirTransformer<D>, data: D): FirSimpleFunction {
return this
}
override fun <D> transformTypeParameters(transformer: FirTransformer<D>, data: D): FirSimpleFunction {
typeParameters.transformInplace(transformer, data)
return this
}
override fun replaceResolvePhase(newResolvePhase: FirResolvePhase) {
resolvePhase = newResolvePhase
}
override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef) {
returnTypeRef = newReturnTypeRef
}
override fun replaceReceiverTypeRef(newReceiverTypeRef: FirTypeRef?) {
}
override fun replaceControlFlowGraphReference(newControlFlowGraphReference: FirControlFlowGraphReference?) {
controlFlowGraphReference = newControlFlowGraphReference
}
override fun replaceValueParameters(newValueParameters: List<FirValueParameter>) {
valueParameters.clear()
valueParameters.addAll(newValueParameters)
}
override fun replaceBody(newBody: FirBlock?) {
}
override fun replaceContractDescription(newContractDescription: FirContractDescription) {
}
}
val ALL_JAVA_OPERATION_NAMES = val ALL_JAVA_OPERATION_NAMES =
UNARY_OPERATION_NAMES + BINARY_OPERATION_NAMES + ASSIGNMENT_OPERATIONS + DELEGATED_PROPERTY_OPERATORS + UNARY_OPERATION_NAMES + BINARY_OPERATION_NAMES + ASSIGNMENT_OPERATIONS + DELEGATED_PROPERTY_OPERATORS +
EQUALS + COMPARE_TO + CONTAINS + INVOKE + ITERATOR + GET + SET + NEXT + HAS_NEXT EQUALS + COMPARE_TO + CONTAINS + INVOKE + ITERATOR + GET + SET + NEXT + HAS_NEXT
@FirBuilderDsl @FirBuilderDsl
class FirJavaMethodBuilder : FirSimpleFunctionBuilder() { class FirJavaMethodBuilder : FirFunctionBuilder, FirTypeParametersOwnerBuilder, FirAnnotationContainerBuilder {
override var source: FirSourceElement? = null
override lateinit var session: FirSession
override var attributes: FirDeclarationAttributes = FirDeclarationAttributes()
override lateinit var returnTypeRef: FirTypeRef
override val valueParameters: MutableList<FirValueParameter> = mutableListOf()
override var body: FirBlock? = null
lateinit var status: FirDeclarationStatus
var dispatchReceiverType: ConeKotlinType? = null
lateinit var name: Name
lateinit var symbol: FirNamedFunctionSymbol
override val annotations: MutableList<FirAnnotationCall> = mutableListOf()
override val typeParameters: MutableList<FirTypeParameter> = mutableListOf()
lateinit var visibility: Visibility lateinit var visibility: Visibility
var modality: Modality? = null var modality: Modality? = null
var isStatic: Boolean by Delegates.notNull() var isStatic: Boolean by Delegates.notNull()
override var resolvePhase: FirResolvePhase = FirResolvePhase.ANALYZED_DEPENDENCIES var resolvePhase: FirResolvePhase = FirResolvePhase.ANALYZED_DEPENDENCIES
lateinit var annotationBuilder: () -> List<FirAnnotationCall>
@Deprecated("Modification of 'origin' has no impact for FirJavaFunctionBuilder", level = DeprecationLevel.HIDDEN) @Deprecated("Modification of 'origin' has no impact for FirJavaFunctionBuilder", level = DeprecationLevel.HIDDEN)
override var origin: FirDeclarationOrigin override var origin: FirDeclarationOrigin
@@ -101,15 +210,12 @@ class FirJavaMethodBuilder : FirSimpleFunctionBuilder() {
resolvePhase, resolvePhase,
attributes, attributes,
returnTypeRef as FirJavaTypeRef, returnTypeRef as FirJavaTypeRef,
receiverTypeRef = null,
typeParameters, typeParameters,
valueParameters, valueParameters,
body,
name, name,
status, status,
containerSource,
symbol, symbol,
annotations, annotationBuilder,
dispatchReceiverType, dispatchReceiverType,
) )
} }
@@ -102,7 +102,7 @@ class FirSignatureEnhancement(
modality = firElement.modality modality = firElement.modality
isVar = firElement.isVar isVar = firElement.isVar
isStatic = firElement.isStatic isStatic = firElement.isStatic
annotations += firElement.annotations annotationBuilder = { firElement.annotations }
status = firElement.status status = firElement.status
initializer = firElement.initializer initializer = firElement.initializer
dispatchReceiverType = firElement.dispatchReceiverType dispatchReceiverType = firElement.dispatchReceiverType
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.java.JavaTypeParameterStack import org.jetbrains.kotlin.fir.java.JavaTypeParameterStack
import org.jetbrains.kotlin.fir.java.enhancement.readOnlyToMutable import org.jetbrains.kotlin.fir.java.enhancement.readOnlyToMutable
import org.jetbrains.kotlin.fir.java.toConeKotlinTypeProbablyFlexible import org.jetbrains.kotlin.fir.java.toConeKotlinTypeProbablyFlexible
import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
import org.jetbrains.kotlin.fir.resolve.substitution.substitutorByMap import org.jetbrains.kotlin.fir.resolve.substitution.substitutorByMap
import org.jetbrains.kotlin.fir.scopes.impl.FirAbstractOverrideChecker import org.jetbrains.kotlin.fir.scopes.impl.FirAbstractOverrideChecker
@@ -35,8 +36,24 @@ class JavaOverrideChecker internal constructor(
if (candidateType is ConeFlexibleType) return isEqualTypes(candidateType.lowerBound, baseType, substitutor, mayBeSpecialBuiltIn) if (candidateType is ConeFlexibleType) return isEqualTypes(candidateType.lowerBound, baseType, substitutor, mayBeSpecialBuiltIn)
if (baseType is ConeFlexibleType) return isEqualTypes(candidateType, baseType.lowerBound, substitutor, mayBeSpecialBuiltIn) if (baseType is ConeFlexibleType) return isEqualTypes(candidateType, baseType.lowerBound, substitutor, mayBeSpecialBuiltIn)
if (candidateType is ConeClassLikeType && baseType is ConeClassLikeType) { if (candidateType is ConeClassLikeType && baseType is ConeClassLikeType) {
return candidateType.lookupTag.classId.let { it.readOnlyToMutable() ?: it } == val candidateTypeClassId = candidateType.fullyExpandedType(session).lookupTag.classId.let { it.readOnlyToMutable() ?: it }
baseType.lookupTag.classId.let { it.readOnlyToMutable() ?: it } val baseTypeClassId = baseType.fullyExpandedType(session).lookupTag.classId.let { it.readOnlyToMutable() ?: it }
if (candidateTypeClassId != baseTypeClassId) return false
if (candidateTypeClassId == StandardClassIds.Array) {
assert(candidateType.typeArguments.size == 1) {
"Array type with unexpected number of type arguments: $candidateType"
}
assert(baseType.typeArguments.size == 1) {
"Array type with unexpected number of type arguments: $baseType"
}
return isEqualArrayElementTypeProjections(
candidateType.typeArguments.single(),
baseType.typeArguments.single(),
substitutor,
mayBeSpecialBuiltIn
)
}
return true
} }
// TODO: handle the situation in more proper way // TODO: handle the situation in more proper way
// Typical case: class EnumMap<K extends Enum, V> implements Map<K, V> // Typical case: class EnumMap<K extends Enum, V> implements Map<K, V>
@@ -68,6 +85,20 @@ class JavaOverrideChecker internal constructor(
mayBeSpecialBuiltIn mayBeSpecialBuiltIn
) )
private fun isEqualArrayElementTypeProjections(
candidateTypeProjection: ConeTypeProjection,
baseTypeProjection: ConeTypeProjection,
substitutor: ConeSubstitutor,
mayBeSpecialBuiltIn: Boolean
): Boolean =
when {
candidateTypeProjection is ConeKotlinTypeProjection && baseTypeProjection is ConeKotlinTypeProjection ->
candidateTypeProjection.kind == baseTypeProjection.kind &&
isEqualTypes(candidateTypeProjection.type, baseTypeProjection.type, substitutor, mayBeSpecialBuiltIn)
candidateTypeProjection is ConeStarProjection && baseTypeProjection is ConeStarProjection -> true
else -> false
}
private fun Collection<FirTypeParameterRef>.buildErasure() = associate { private fun Collection<FirTypeParameterRef>.buildErasure() = associate {
val symbol = it.symbol val symbol = it.symbol
val firstBound = symbol.fir.bounds.first() // Note that in Java type parameter typed arguments always erased to first bound val firstBound = symbol.fir.bounds.first() // Note that in Java type parameter typed arguments always erased to first bound
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.fir.NoMutableState
import org.jetbrains.kotlin.fir.resolve.calls.FirSyntheticNamesProvider import org.jetbrains.kotlin.fir.resolve.calls.FirSyntheticNamesProvider
import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly
import org.jetbrains.kotlin.util.capitalizeDecapitalize.decapitalizeAsciiOnly
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toUpperCaseAsciiOnly import org.jetbrains.kotlin.util.capitalizeDecapitalize.toUpperCaseAsciiOnly
@NoMutableState @NoMutableState
@@ -91,7 +92,7 @@ object FirJavaSyntheticNamesProvider : FirSyntheticNamesProvider() {
else -> return emptyList() else -> return emptyList()
} }
val withoutPrefix = identifier.removePrefix(prefix) val withoutPrefix = identifier.removePrefix(prefix)
val withoutPrefixName = Name.identifier(withoutPrefix.decapitalize()) val withoutPrefixName = Name.identifier(withoutPrefix.decapitalizeAsciiOnly())
return if (prefix == SETTER_PREFIX) { return if (prefix == SETTER_PREFIX) {
listOf(withoutPrefixName, Name.identifier(IS_PREFIX + withoutPrefix)) listOf(withoutPrefixName, Name.identifier(IS_PREFIX + withoutPrefix))
} else { } else {
@@ -99,4 +100,3 @@ object FirJavaSyntheticNamesProvider : FirSyntheticNamesProvider() {
} }
} }
} }
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir.scopes.jvm
import org.jetbrains.kotlin.fir.declarations.FirFunction import org.jetbrains.kotlin.fir.declarations.FirFunction
import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction
import org.jetbrains.kotlin.fir.symbols.StandardClassIds
import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.*
import org.jetbrains.kotlin.fir.types.impl.FirImplicitAnyTypeRef import org.jetbrains.kotlin.fir.types.impl.FirImplicitAnyTypeRef
import org.jetbrains.kotlin.fir.types.impl.FirImplicitNullableAnyTypeRef import org.jetbrains.kotlin.fir.types.impl.FirImplicitNullableAnyTypeRef
@@ -101,8 +102,7 @@ private fun StringBuilder.appendConeType(coneType: ConeKotlinType) {
fun appendClassLikeType(type: ConeClassLikeType) { fun appendClassLikeType(type: ConeClassLikeType) {
val classId = type.lookupTag.classId val classId = type.lookupTag.classId
if (classId.shortClassName.isSpecial) return if (classId == StandardClassIds.Array) {
if (classId.shortClassName.identifier == "Array") {
append("[") append("[")
type.typeArguments.forEach { typeArg -> type.typeArguments.forEach { typeArg ->
when (typeArg) { when (typeArg) {
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.fir.resolve.calls package org.jetbrains.kotlin.fir.resolve.calls
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.declarations.builder.buildConstructedClassTypeParameterRef import org.jetbrains.kotlin.fir.declarations.builder.buildConstructedClassTypeParameterRef
@@ -23,6 +24,7 @@ import org.jetbrains.kotlin.fir.scopes.scopeForClass
import org.jetbrains.kotlin.fir.symbols.impl.* import org.jetbrains.kotlin.fir.symbols.impl.*
import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.*
import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.name.Name
import java.util.*
private operator fun <T> Pair<T, *>?.component1() = this?.first private operator fun <T> Pair<T, *>?.component1() = this?.first
private operator fun <T> Pair<*, T>?.component2() = this?.second private operator fun <T> Pair<*, T>?.component2() = this?.second
@@ -184,10 +186,13 @@ private fun processConstructors(
) )
} else basicScope } else basicScope
} }
is FirClassSymbol -> is FirClassSymbol -> {
(matchedSymbol.fir as FirClass<*>).scopeForClass( val firClass = matchedSymbol.fir as FirClass<*>
if (firClass.classKind == ClassKind.INTERFACE) null
else firClass.scopeForClass(
substitutor, session, bodyResolveComponents.scopeSession substitutor, session, bodyResolveComponents.scopeSession
) )
}
} }
//TODO: why don't we use declared member scope at this point? //TODO: why don't we use declared member scope at this point?
@@ -534,13 +534,16 @@ class FirCallCompletionResultsWriterTransformer(
syntheticCall: D, syntheticCall: D,
data: ExpectedArgumentType?, data: ExpectedArgumentType?,
): CompositeTransformResult<FirStatement> where D : FirResolvable, D : FirExpression { ): CompositeTransformResult<FirStatement> where D : FirResolvable, D : FirExpression {
syntheticCall.transformChildren(this, data?.getExpectedType(syntheticCall)?.toExpectedType())
val calleeReference = syntheticCall.calleeReference as? FirNamedReferenceWithCandidate ?: return syntheticCall.compose() val calleeReference = syntheticCall.calleeReference as? FirNamedReferenceWithCandidate ?: return syntheticCall.compose()
val declaration = calleeReference.candidate.symbol.fir as? FirSimpleFunction ?: return syntheticCall.compose() val declaration = calleeReference.candidate.symbol.fir as? FirSimpleFunction ?: return syntheticCall.compose()
val typeRef = typeCalculator.tryCalculateReturnType(declaration) val typeRef = typeCalculator.tryCalculateReturnType(declaration)
syntheticCall.replaceTypeRefWithSubstituted(calleeReference, typeRef) syntheticCall.replaceTypeRefWithSubstituted(calleeReference, typeRef)
syntheticCall.transformChildren(
this,
data = data?.getExpectedType(syntheticCall)?.toExpectedType() ?: syntheticCall.typeRef.coneType.toExpectedType()
)
return (syntheticCall.transformCalleeReference( return (syntheticCall.transformCalleeReference(
StoreCalleeReference, StoreCalleeReference,
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */

Some files were not shown because too many files have changed in this diff Show More